association.interface.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import { Rule, RuleType } from '@midwayjs/validate';
  2. import { ApiProperty } from '@midwayjs/swagger';
  3. import { SearchBase } from 'free-midway-component';
  4. import get = require('lodash/get');
  5. const dealVO = (cla, data) => {
  6. for (const key in cla) {
  7. const val = get(data, key);
  8. if (val || val === 0) cla[key] = val;
  9. }
  10. };
  11. export class FVO_association {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '平台用户id' })
  18. 'user': string = undefined;
  19. @ApiProperty({ description: '名称' })
  20. 'name': string = undefined;
  21. @ApiProperty({ description: '负责人' })
  22. 'person': string = undefined;
  23. @ApiProperty({ description: '负责人电话' })
  24. 'person_phone': string = undefined;
  25. @ApiProperty({ description: '简介' })
  26. 'brief': string = undefined;
  27. @ApiProperty({ description: '地址' })
  28. 'address': string = undefined;
  29. @ApiProperty({ description: '是否公开' })
  30. 'is_show': string = undefined;
  31. @ApiProperty({ description: '状态' })
  32. 'status': string = undefined;
  33. }
  34. export class QDTO_association extends SearchBase {
  35. constructor() {
  36. const like_prop = [];
  37. const props = ['user', 'name', 'person_phone', 'is_show', 'status'];
  38. const mapping = [];
  39. super({ like_prop, props, mapping });
  40. }
  41. @ApiProperty({ description: '平台用户id' })
  42. 'user': string = undefined;
  43. @ApiProperty({ description: '名称' })
  44. 'name': string = undefined;
  45. @ApiProperty({ description: '负责人电话' })
  46. 'person_phone': string = undefined;
  47. @ApiProperty({ description: '是否公开' })
  48. 'is_show': string = undefined;
  49. @ApiProperty({ description: '状态' })
  50. 'status': string = undefined;
  51. }
  52. export class QVO_association extends FVO_association {
  53. constructor(data: object) {
  54. super(data);
  55. dealVO(this, data);
  56. }
  57. }
  58. export class CDTO_association {
  59. @ApiProperty({ description: '平台用户id' })
  60. @Rule(RuleType['string']().empty(''))
  61. 'user': string = undefined;
  62. @ApiProperty({ description: '名称' })
  63. @Rule(RuleType['string']().empty(''))
  64. 'name': string = undefined;
  65. @ApiProperty({ description: '负责人' })
  66. @Rule(RuleType['string']().empty(''))
  67. 'person': string = undefined;
  68. @ApiProperty({ description: '负责人电话' })
  69. @Rule(RuleType['string']().empty(''))
  70. 'person_phone': string = undefined;
  71. @ApiProperty({ description: '简介' })
  72. @Rule(RuleType['string']().empty(''))
  73. 'brief': string = undefined;
  74. @ApiProperty({ description: '地址' })
  75. @Rule(RuleType['string']().empty(''))
  76. 'address': string = undefined;
  77. @ApiProperty({ description: '是否公开' })
  78. @Rule(RuleType['string']().empty(''))
  79. 'is_show': string = undefined;
  80. @ApiProperty({ description: '状态' })
  81. @Rule(RuleType['string']().empty(''))
  82. 'status': string = undefined;
  83. }
  84. export class CVO_association extends FVO_association {
  85. constructor(data: object) {
  86. super(data);
  87. dealVO(this, data);
  88. }
  89. }
  90. export class UDTO_association extends CDTO_association {
  91. @ApiProperty({ description: '数据id' })
  92. @Rule(RuleType['string']().empty(''))
  93. _id: string = undefined;
  94. }
  95. export class UVAO_association extends FVO_association {
  96. constructor(data: object) {
  97. super(data);
  98. dealVO(this, data);
  99. }
  100. }