|
@@ -0,0 +1,146 @@
|
|
|
+import { Rule, RuleType } from '@midwayjs/validate';
|
|
|
+import { ApiProperty } from '@midwayjs/swagger';
|
|
|
+import {
|
|
|
+ FrameworkErrorEnum,
|
|
|
+ SearchBase,
|
|
|
+ ServiceError,
|
|
|
+} from 'free-midway-component';
|
|
|
+import get = require('lodash/get');
|
|
|
+const dealVO = (cla, data) => {
|
|
|
+ for (const key in cla) {
|
|
|
+ const val = get(data, key);
|
|
|
+ if (val || val === 0) cla[key] = val;
|
|
|
+ }
|
|
|
+};
|
|
|
+export class FVO_upkeep {
|
|
|
+ constructor(data: object) {
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ _id: string = undefined;
|
|
|
+ @ApiProperty({ description: '用户id' })
|
|
|
+ 'user': string = undefined;
|
|
|
+ @ApiProperty({ description: '用户名称' })
|
|
|
+ 'user_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '供应商id' })
|
|
|
+ 'supplier': string = undefined;
|
|
|
+ @ApiProperty({ description: '供应商名称' })
|
|
|
+ 'supplier_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '商品id' })
|
|
|
+ 'good': string = undefined;
|
|
|
+ @ApiProperty({ description: '商品名称' })
|
|
|
+ 'good_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '规格id' })
|
|
|
+ 'spec': string = undefined;
|
|
|
+ @ApiProperty({ description: '规格名称' })
|
|
|
+ 'spec_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '维修地址' })
|
|
|
+ 'address': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QDTO_upkeep extends SearchBase {
|
|
|
+ constructor() {
|
|
|
+ const like_prop = [];
|
|
|
+ const props = [
|
|
|
+ 'user',
|
|
|
+ 'user_name',
|
|
|
+ 'supplier',
|
|
|
+ 'supplier_name',
|
|
|
+ 'good',
|
|
|
+ 'good_name',
|
|
|
+ 'spec',
|
|
|
+ 'spec_name',
|
|
|
+ ];
|
|
|
+ const mapping = [];
|
|
|
+ super({ like_prop, props, mapping });
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '用户id' })
|
|
|
+ 'user': string = undefined;
|
|
|
+ @ApiProperty({ description: '用户名称' })
|
|
|
+ 'user_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '供应商id' })
|
|
|
+ 'supplier': string = undefined;
|
|
|
+ @ApiProperty({ description: '供应商名称' })
|
|
|
+ 'supplier_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '商品id' })
|
|
|
+ 'good': string = undefined;
|
|
|
+ @ApiProperty({ description: '商品名称' })
|
|
|
+ 'good_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '规格id' })
|
|
|
+ 'spec': string = undefined;
|
|
|
+ @ApiProperty({ description: '规格名称' })
|
|
|
+ 'spec_name': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QVO_upkeep extends FVO_upkeep {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class CDTO_upkeep {
|
|
|
+ @ApiProperty({ description: '用户id' })
|
|
|
+ @Rule(
|
|
|
+ RuleType['string']()
|
|
|
+ .required()
|
|
|
+ .error(new ServiceError('缺少用户id', FrameworkErrorEnum.NEED_BODY))
|
|
|
+ )
|
|
|
+ 'user': string = undefined;
|
|
|
+ @ApiProperty({ description: '用户名称' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'user_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '供应商id' })
|
|
|
+ @Rule(
|
|
|
+ RuleType['string']()
|
|
|
+ .required()
|
|
|
+ .error(new ServiceError('缺少供应商id', FrameworkErrorEnum.NEED_BODY))
|
|
|
+ )
|
|
|
+ 'supplier': string = undefined;
|
|
|
+ @ApiProperty({ description: '供应商名称' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'supplier_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '商品id' })
|
|
|
+ @Rule(
|
|
|
+ RuleType['string']()
|
|
|
+ .required()
|
|
|
+ .error(new ServiceError('缺少商品id', FrameworkErrorEnum.NEED_BODY))
|
|
|
+ )
|
|
|
+ 'good': string = undefined;
|
|
|
+ @ApiProperty({ description: '商品名称' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'good_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '规格id' })
|
|
|
+ @Rule(
|
|
|
+ RuleType['string']()
|
|
|
+ .required()
|
|
|
+ .error(new ServiceError('缺少规格id', FrameworkErrorEnum.NEED_BODY))
|
|
|
+ )
|
|
|
+ 'spec': string = undefined;
|
|
|
+ @ApiProperty({ description: '规格名称' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'spec_name': string = undefined;
|
|
|
+ @ApiProperty({ description: '维修地址' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'address': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class CVO_upkeep extends FVO_upkeep {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class UDTO_upkeep extends CDTO_upkeep {
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ _id: string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class UVAO_upkeep extends FVO_upkeep {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|