|
@@ -0,0 +1,64 @@
|
|
|
+import { Rule, RuleType } from '@midwayjs/validate';
|
|
|
+import { ApiProperty } from '@midwayjs/swagger';
|
|
|
+import _ = require('lodash');
|
|
|
+import { SearchBase } from 'free-midway-component';
|
|
|
+export class FetchVO_test {
|
|
|
+ constructor(data: object) {
|
|
|
+ for (const key of Object.keys(this)) {
|
|
|
+ this[key] = _.get(data, key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ _id: string = undefined;
|
|
|
+ @ApiProperty({ description: '姓名' })
|
|
|
+ 'name': string = undefined;
|
|
|
+ @ApiProperty({ description: '性别' })
|
|
|
+ 'gender': string = undefined;
|
|
|
+ @ApiProperty({ description: '年龄' })
|
|
|
+ 'age': string = undefined;
|
|
|
+ @ApiProperty({ description: '手机号' })
|
|
|
+ 'phone': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QueryDTO_test extends SearchBase {
|
|
|
+ constructor() {
|
|
|
+ const like_prop = [];
|
|
|
+ const props = ['name', 'gender', 'age','phone'];
|
|
|
+ super({ like_prop, props });
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '姓名' })
|
|
|
+ 'name': string = undefined;
|
|
|
+ @ApiProperty({ description: '性别' })
|
|
|
+ 'gender': string = undefined;
|
|
|
+ @ApiProperty({ description: '年龄' })
|
|
|
+ 'age': string = undefined;
|
|
|
+ @ApiProperty({ description: '手机号' })
|
|
|
+ 'phone': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QueryVO_test extends FetchVO_test { }
|
|
|
+
|
|
|
+export class CreateDTO_test {
|
|
|
+ @ApiProperty({ description: '姓名' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'name': string = undefined;
|
|
|
+ @ApiProperty({ description: '性别' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'gender': string = undefined;
|
|
|
+ @ApiProperty({ description: '年龄' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'age': string = undefined;
|
|
|
+ @ApiProperty({ description: '手机号' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'phone': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class CreateVO_test extends FetchVO_test { }
|
|
|
+
|
|
|
+export class UpdateDTO_test extends CreateDTO_test {
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ _id: string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class UpdateVO_test extends FetchVO_test { }
|