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_achievement { constructor(data: object) { dealVO(this, data); } @ApiProperty({ description: '数据id' }) _id: string = undefined; @ApiProperty({ description: '用户id' }) 'user': string = undefined; @ApiProperty({ description: '专利号' }) 'patent': string = undefined; @ApiProperty({ description: '名称' }) 'name': string = undefined; @ApiProperty({ description: '属性' }) 'attribute': string = undefined; @ApiProperty({ description: '出让方式' }) 'sell': string = undefined; @ApiProperty({ description: '成熟度' }) 'mature': string = undefined; @ApiProperty({ description: '行业领域' }) 'field': string = undefined; @ApiProperty({ description: '技术分类' }) 'technology': string = undefined; @ApiProperty({ description: '成果地区' }) 'area': Array = undefined; @ApiProperty({ description: '发布时间' }) 'time': string = undefined; @ApiProperty({ description: '参考价格' }) 'money': string = undefined; @ApiProperty({ description: '简介' }) 'brief': string = undefined; @ApiProperty({ description: '附件' }) 'file': Array = undefined; @ApiProperty({ description: '成果状态' }) 'achievement_status': string = undefined; @ApiProperty({ description: '是否公开' }) 'is_use': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QDTO_achievement extends SearchBase { constructor() { const like_prop = ['name']; const props = ['user', 'patent', 'name', 'attribute', 'sell', 'mature', 'field', 'technology', 'money', 'status', 'achievement_status', 'is_use']; const mapping = []; super({ like_prop, props, mapping }); } @ApiProperty({ description: '用户id' }) 'user': string = undefined; @ApiProperty({ description: '专利号' }) 'patent': string = undefined; @ApiProperty({ description: '名称' }) 'name': string = undefined; @ApiProperty({ description: '属性' }) 'attribute': string = undefined; @ApiProperty({ description: '出让方式' }) 'sell': string = undefined; @ApiProperty({ description: '成熟度' }) 'mature': string = undefined; @ApiProperty({ description: '行业领域' }) 'field': string = undefined; @ApiProperty({ description: '技术分类' }) 'technology': string = undefined; @ApiProperty({ description: '参考价格' }) 'money': string = undefined; @ApiProperty({ description: '成果状态' }) 'achievement_status': string = undefined; @ApiProperty({ description: '是否公开' }) 'is_use': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QVO_achievement extends FVO_achievement { constructor(data: object) { super(data); dealVO(this, data); } } export class CDTO_achievement { @ApiProperty({ description: '用户id' }) @Rule(RuleType['string']().empty('')) 'user': string = undefined; @ApiProperty({ description: '专利号' }) @Rule(RuleType['string']().empty('')) 'patent': string = undefined; @ApiProperty({ description: '名称' }) @Rule(RuleType['string']().empty('')) 'name': string = undefined; @ApiProperty({ description: '属性' }) @Rule(RuleType['string']().empty('')) 'attribute': string = undefined; @ApiProperty({ description: '出让方式' }) @Rule(RuleType['string']().empty('')) 'sell': string = undefined; @ApiProperty({ description: '成熟度' }) @Rule(RuleType['string']().empty('')) 'mature': string = undefined; @ApiProperty({ description: '行业领域' }) @Rule(RuleType['string']().empty('')) 'field': string = undefined; @ApiProperty({ description: '技术分类' }) @Rule(RuleType['string']().empty('')) 'technology': string = undefined; @ApiProperty({ description: '成果地区' }) @Rule(RuleType['array']().empty('')) 'area': Array = undefined; @ApiProperty({ description: '发布时间' }) @Rule(RuleType['string']().empty('')) 'time': string = undefined; @ApiProperty({ description: '参考价格' }) @Rule(RuleType['string']().empty('')) 'money': string = undefined; @ApiProperty({ description: '简介' }) @Rule(RuleType['string']().empty('')) 'brief': string = undefined; @ApiProperty({ description: '附件' }) @Rule(RuleType['array']().empty('')) 'file': Array = undefined; @ApiProperty({ description: 'achievement_status' }) @Rule(RuleType['string']().empty('')) 'achievement_status': string = undefined; @ApiProperty({ description: '状态' }) @Rule(RuleType['string']().empty('')) 'status': string = undefined; @ApiProperty({ description: '是否公开' }) @Rule(RuleType['string']().empty('')) 'is_use': string = undefined; } export class CVO_achievement extends FVO_achievement { constructor(data: object) { super(data); dealVO(this, data); } } export class UDTO_achievement extends CDTO_achievement { @ApiProperty({ description: '数据id' }) @Rule(RuleType['string']().empty('')) _id: string = undefined; } export class UVAO_achievement extends FVO_achievement { constructor(data: object) { super(data); dealVO(this, data); } }