state.interface.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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_state {
  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. 'type': string = undefined;
  27. @ApiProperty({ description: '地址' })
  28. 'address': string = undefined;
  29. @ApiProperty({ description: '简介' })
  30. 'brief': string = undefined;
  31. @ApiProperty({ description: '是否公开' })
  32. 'is_show': string = undefined;
  33. @ApiProperty({ description: '状态' })
  34. 'status': string = undefined;
  35. }
  36. export class QDTO_state extends SearchBase {
  37. constructor() {
  38. const like_prop = [];
  39. const props = ['user', 'name', 'type', 'address', 'is_show', 'status'];
  40. const mapping = [];
  41. super({ like_prop, props, mapping });
  42. }
  43. @ApiProperty({ description: '平台用户id' })
  44. 'user': string = undefined;
  45. @ApiProperty({ description: '名称' })
  46. 'name': string = undefined;
  47. @ApiProperty({ description: '部门类型' })
  48. 'type': string = undefined;
  49. @ApiProperty({ description: '地址' })
  50. 'address': string = undefined;
  51. @ApiProperty({ description: '是否公开' })
  52. 'is_show': string = undefined;
  53. @ApiProperty({ description: '状态' })
  54. 'status': string = undefined;
  55. }
  56. export class QVO_state extends FVO_state {
  57. constructor(data: object) {
  58. super(data);
  59. dealVO(this, data);
  60. }
  61. }
  62. export class CDTO_state {
  63. @ApiProperty({ description: '平台用户id' })
  64. @Rule(RuleType['string']().empty(''))
  65. 'user': string = undefined;
  66. @ApiProperty({ description: '名称' })
  67. @Rule(RuleType['string']().empty(''))
  68. 'name': string = undefined;
  69. @ApiProperty({ description: '负责人' })
  70. @Rule(RuleType['string']().empty(''))
  71. 'person': string = undefined;
  72. @ApiProperty({ description: '负责人电话' })
  73. @Rule(RuleType['string']().empty(''))
  74. 'person_phone': string = undefined;
  75. @ApiProperty({ description: '部门类型' })
  76. @Rule(RuleType['string']().empty(''))
  77. 'type': string = undefined;
  78. @ApiProperty({ description: '地址' })
  79. @Rule(RuleType['string']().empty(''))
  80. 'address': string = undefined;
  81. @ApiProperty({ description: '简介' })
  82. @Rule(RuleType['string']().empty(''))
  83. 'brief': string = undefined;
  84. @ApiProperty({ description: '是否公开' })
  85. @Rule(RuleType['string']().empty(''))
  86. 'is_show': string = undefined;
  87. @ApiProperty({ description: '状态' })
  88. @Rule(RuleType['string']().empty(''))
  89. 'status': string = undefined;
  90. }
  91. export class CVO_state extends FVO_state {
  92. constructor(data: object) {
  93. super(data);
  94. dealVO(this, data);
  95. }
  96. }
  97. export class UDTO_state extends CDTO_state {
  98. @ApiProperty({ description: '数据id' })
  99. @Rule(RuleType['string']().empty(''))
  100. _id: string = undefined;
  101. }
  102. export class UVAO_state extends FVO_state {
  103. constructor(data: object) {
  104. super(data);
  105. dealVO(this, data);
  106. }
  107. }