order.interface.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_order {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '微信用户' })
  18. 'openid': string = undefined;
  19. @ApiProperty({ description: '日期' })
  20. 'date': string = undefined;
  21. @ApiProperty({ description: '早餐' })
  22. 'breakfast': object = undefined;
  23. @ApiProperty({ description: '午餐' })
  24. 'lunch': object = undefined;
  25. @ApiProperty({ description: '晚餐' })
  26. 'dinner': object = undefined;
  27. @ApiProperty({ description: '备注' })
  28. 'remark': string = undefined;
  29. }
  30. export class QDTO_order extends SearchBase {
  31. constructor() {
  32. const like_prop = [];
  33. const props = [];
  34. const mapping = [];
  35. super({ like_prop, props, mapping });
  36. }
  37. }
  38. export class QVO_order extends FVO_order {
  39. constructor(data: object) {
  40. super(data);
  41. dealVO(this, data);
  42. }
  43. }
  44. export class CDTO_order {
  45. @ApiProperty({ description: '微信用户' })
  46. @Rule(RuleType['string']().empty(''))
  47. 'openid': string = undefined;
  48. @ApiProperty({ description: '日期' })
  49. @Rule(RuleType['string']().empty(''))
  50. 'date': string = undefined;
  51. @ApiProperty({ description: '早餐' })
  52. @Rule(RuleType['object']().empty(''))
  53. 'breakfast': object = undefined;
  54. @ApiProperty({ description: '午餐' })
  55. @Rule(RuleType['object']().empty(''))
  56. 'lunch': object = undefined;
  57. @ApiProperty({ description: '晚餐' })
  58. @Rule(RuleType['object']().empty(''))
  59. 'dinner': object = undefined;
  60. @ApiProperty({ description: '备注' })
  61. @Rule(RuleType['string']().empty(''))
  62. 'remark': string = undefined;
  63. }
  64. export class CVO_order extends FVO_order {
  65. constructor(data: object) {
  66. super(data);
  67. dealVO(this, data);
  68. }
  69. }
  70. export class UDTO_order extends CDTO_order {
  71. @ApiProperty({ description: '数据id' })
  72. @Rule(RuleType['string']().empty(''))
  73. _id: string = undefined;
  74. }
  75. export class UVAO_order extends FVO_order {
  76. constructor(data: object) {
  77. super(data);
  78. dealVO(this, data);
  79. }
  80. }