import { Rule, RuleType } from '@midwayjs/validate'; import { ApiProperty } from '@midwayjs/swagger'; import { SearchBase } 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_unit { constructor(data: object) { dealVO(this, data); } @ApiProperty({ description: '数据id' }) _id: string = undefined; @ApiProperty({ description: '账户' }) 'account': string = undefined; @ApiProperty({ description: '密码' }) 'password': string = undefined; @ApiProperty({ description: '企业名称' }) 'unit_name': string = undefined; @ApiProperty({ description: '统一社会信用代码' }) 'unit_code': string = undefined; @ApiProperty({ description: '法人' }) 'legal_person': string = undefined; @ApiProperty({ description: '法人联系电话' }) 'legal_tel': string = undefined; @ApiProperty({ description: '法人身份证号' }) 'legal_card': string = undefined; @ApiProperty({ description: '联系邮箱' }) 'email': string = undefined; @ApiProperty({ description: '营业执照' }) 'files': Array = undefined; @ApiProperty({ description: '简介' }) 'brief': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QDTO_unit extends SearchBase { constructor() { const like_prop = ['account']; const props = ['account', 'unit_code', 'status']; const mapping = []; super({ like_prop, props, mapping }); } @ApiProperty({ description: '账户' }) 'account': string = undefined; @ApiProperty({ description: '统一社会信用代码' }) 'unit_code': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QVO_unit extends FVO_unit { constructor(data: object) { super(data); dealVO(this, data); } } export class CDTO_unit { @ApiProperty({ description: '账户' }) @Rule(RuleType['string']().empty('')) 'account': string = undefined; @ApiProperty({ description: '密码' }) @Rule(RuleType['string']().empty('')) 'password': string = undefined; @ApiProperty({ description: '企业名称' }) @Rule(RuleType['string']().empty('')) 'unit_name': string = undefined; @ApiProperty({ description: '统一社会信用代码' }) @Rule(RuleType['string']().empty('')) 'unit_code': string = undefined; @ApiProperty({ description: '法人' }) @Rule(RuleType['string']().empty('')) 'legal_person': string = undefined; @ApiProperty({ description: '法人联系电话' }) @Rule(RuleType['string']().empty('')) 'legal_tel': string = undefined; @ApiProperty({ description: '法人身份证号' }) @Rule(RuleType['string']().empty('')) 'legal_card': string = undefined; @ApiProperty({ description: '联系邮箱' }) @Rule(RuleType['string']().empty('')) 'email': string = undefined; @ApiProperty({ description: '营业执照' }) @Rule(RuleType['array']().empty('')) 'files': Array = undefined; @ApiProperty({ description: '简介' }) @Rule(RuleType['string']().empty('')) 'brief': string = undefined; @ApiProperty({ description: '状态' }) @Rule(RuleType['string']().empty('')) 'status': string = undefined; } export class CVO_unit extends FVO_unit { constructor(data: object) { super(data); dealVO(this, data); } } export class UDTO_unit extends CDTO_unit { @ApiProperty({ description: '数据id' }) @Rule(RuleType['string']().empty('')) _id: string = undefined; } export class UVAO_unit extends FVO_unit { constructor(data: object) { super(data); dealVO(this, data); } }