unit.interface.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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_unit {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '账户' })
  18. 'account': string = undefined;
  19. @ApiProperty({ description: '密码' })
  20. 'password': string = undefined;
  21. @ApiProperty({ description: '企业名称' })
  22. 'unit_name': string = undefined;
  23. @ApiProperty({ description: '统一社会信用代码' })
  24. 'unit_code': string = undefined;
  25. @ApiProperty({ description: '法人' })
  26. 'legal_person': string = undefined;
  27. @ApiProperty({ description: '法人联系电话' })
  28. 'legal_tel': string = undefined;
  29. @ApiProperty({ description: '法人身份证号' })
  30. 'legal_card': string = undefined;
  31. @ApiProperty({ description: '联系邮箱' })
  32. 'email': string = undefined;
  33. @ApiProperty({ description: '营业执照' })
  34. 'files': Array<any> = undefined;
  35. @ApiProperty({ description: '简介' })
  36. 'brief': string = undefined;
  37. @ApiProperty({ description: '状态' })
  38. 'status': string = undefined;
  39. }
  40. export class QDTO_unit extends SearchBase {
  41. constructor() {
  42. const like_prop = ['account'];
  43. const props = ['account', 'unit_code', 'status'];
  44. const mapping = [];
  45. super({ like_prop, props, mapping });
  46. }
  47. @ApiProperty({ description: '账户' })
  48. 'account': string = undefined;
  49. @ApiProperty({ description: '统一社会信用代码' })
  50. 'unit_code': string = undefined;
  51. @ApiProperty({ description: '状态' })
  52. 'status': string = undefined;
  53. }
  54. export class QVO_unit extends FVO_unit {
  55. constructor(data: object) {
  56. super(data);
  57. dealVO(this, data);
  58. }
  59. }
  60. export class CDTO_unit {
  61. @ApiProperty({ description: '账户' })
  62. @Rule(RuleType['string']().empty(''))
  63. 'account': string = undefined;
  64. @ApiProperty({ description: '密码' })
  65. @Rule(RuleType['string']().empty(''))
  66. 'password': string = undefined;
  67. @ApiProperty({ description: '企业名称' })
  68. @Rule(RuleType['string']().empty(''))
  69. 'unit_name': string = undefined;
  70. @ApiProperty({ description: '统一社会信用代码' })
  71. @Rule(RuleType['string']().empty(''))
  72. 'unit_code': string = undefined;
  73. @ApiProperty({ description: '法人' })
  74. @Rule(RuleType['string']().empty(''))
  75. 'legal_person': string = undefined;
  76. @ApiProperty({ description: '法人联系电话' })
  77. @Rule(RuleType['string']().empty(''))
  78. 'legal_tel': string = undefined;
  79. @ApiProperty({ description: '法人身份证号' })
  80. @Rule(RuleType['string']().empty(''))
  81. 'legal_card': string = undefined;
  82. @ApiProperty({ description: '联系邮箱' })
  83. @Rule(RuleType['string']().empty(''))
  84. 'email': string = undefined;
  85. @ApiProperty({ description: '营业执照' })
  86. @Rule(RuleType['array']().empty(''))
  87. 'files': Array<any> = undefined;
  88. @ApiProperty({ description: '简介' })
  89. @Rule(RuleType['string']().empty(''))
  90. 'brief': string = undefined;
  91. @ApiProperty({ description: '状态' })
  92. @Rule(RuleType['string']().empty(''))
  93. 'status': string = undefined;
  94. }
  95. export class CVO_unit extends FVO_unit {
  96. constructor(data: object) {
  97. super(data);
  98. dealVO(this, data);
  99. }
  100. }
  101. export class UDTO_unit extends CDTO_unit {
  102. @ApiProperty({ description: '数据id' })
  103. @Rule(RuleType['string']().empty(''))
  104. _id: string = undefined;
  105. }
  106. export class UVAO_unit extends FVO_unit {
  107. constructor(data: object) {
  108. super(data);
  109. dealVO(this, data);
  110. }
  111. }