ShopSetting.interface.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_ShopSetting {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '街道/社区' })
  18. 'office': string = undefined;
  19. @ApiProperty({ description: '领导' })
  20. 'leader': Array<any> = undefined;
  21. @ApiProperty({ description: '会计' })
  22. 'accounting': Array<any> = undefined;
  23. @ApiProperty({ description: '是否使用' })
  24. 'is_use': string = undefined;
  25. }
  26. export class QDTO_ShopSetting extends SearchBase {
  27. constructor() {
  28. const like_prop = [];
  29. const props = ['office'];
  30. const mapping = [];
  31. super({ like_prop, props, mapping });
  32. }
  33. @ApiProperty({ description: '街道/社区' })
  34. 'office': string = undefined;
  35. }
  36. export class QVO_ShopSetting extends FVO_ShopSetting {
  37. constructor(data: object) {
  38. super(data);
  39. dealVO(this, data);
  40. }
  41. }
  42. export class CDTO_ShopSetting {
  43. @ApiProperty({ description: '街道/社区' })
  44. @Rule(RuleType['string']().empty(''))
  45. 'office': string = undefined;
  46. @ApiProperty({ description: '领导' })
  47. @Rule(RuleType['array']().empty(''))
  48. 'leader': Array<any> = undefined;
  49. @ApiProperty({ description: '会计' })
  50. @Rule(RuleType['array']().empty(''))
  51. 'accounting': Array<any> = undefined;
  52. @ApiProperty({ description: '是否使用' })
  53. @Rule(RuleType['string']().empty(''))
  54. 'is_use': string = undefined;
  55. }
  56. export class CVO_ShopSetting extends FVO_ShopSetting {
  57. constructor(data: object) {
  58. super(data);
  59. dealVO(this, data);
  60. }
  61. }
  62. export class UDTO_ShopSetting extends CDTO_ShopSetting {
  63. @ApiProperty({ description: '数据id' })
  64. @Rule(RuleType['string']().empty(''))
  65. _id: string = undefined;
  66. }
  67. export class UVAO_ShopSetting extends FVO_ShopSetting {
  68. constructor(data: object) {
  69. super(data);
  70. dealVO(this, data);
  71. }
  72. }