DepartmentDTO.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class DepartmentDTO(object):
  6. def __init__(self):
  7. self._biz_type = None
  8. self._dept_id = None
  9. self._dept_name = None
  10. self._dept_path = None
  11. self._label_code = None
  12. self._label_name = None
  13. self._parent_dept_id = None
  14. self._shop_id = None
  15. self._type = None
  16. @property
  17. def biz_type(self):
  18. return self._biz_type
  19. @biz_type.setter
  20. def biz_type(self, value):
  21. self._biz_type = value
  22. @property
  23. def dept_id(self):
  24. return self._dept_id
  25. @dept_id.setter
  26. def dept_id(self, value):
  27. self._dept_id = value
  28. @property
  29. def dept_name(self):
  30. return self._dept_name
  31. @dept_name.setter
  32. def dept_name(self, value):
  33. self._dept_name = value
  34. @property
  35. def dept_path(self):
  36. return self._dept_path
  37. @dept_path.setter
  38. def dept_path(self, value):
  39. self._dept_path = value
  40. @property
  41. def label_code(self):
  42. return self._label_code
  43. @label_code.setter
  44. def label_code(self, value):
  45. self._label_code = value
  46. @property
  47. def label_name(self):
  48. return self._label_name
  49. @label_name.setter
  50. def label_name(self, value):
  51. self._label_name = value
  52. @property
  53. def parent_dept_id(self):
  54. return self._parent_dept_id
  55. @parent_dept_id.setter
  56. def parent_dept_id(self, value):
  57. self._parent_dept_id = value
  58. @property
  59. def shop_id(self):
  60. return self._shop_id
  61. @shop_id.setter
  62. def shop_id(self, value):
  63. self._shop_id = value
  64. @property
  65. def type(self):
  66. return self._type
  67. @type.setter
  68. def type(self, value):
  69. self._type = value
  70. def to_alipay_dict(self):
  71. params = dict()
  72. if self.biz_type:
  73. if hasattr(self.biz_type, 'to_alipay_dict'):
  74. params['biz_type'] = self.biz_type.to_alipay_dict()
  75. else:
  76. params['biz_type'] = self.biz_type
  77. if self.dept_id:
  78. if hasattr(self.dept_id, 'to_alipay_dict'):
  79. params['dept_id'] = self.dept_id.to_alipay_dict()
  80. else:
  81. params['dept_id'] = self.dept_id
  82. if self.dept_name:
  83. if hasattr(self.dept_name, 'to_alipay_dict'):
  84. params['dept_name'] = self.dept_name.to_alipay_dict()
  85. else:
  86. params['dept_name'] = self.dept_name
  87. if self.dept_path:
  88. if hasattr(self.dept_path, 'to_alipay_dict'):
  89. params['dept_path'] = self.dept_path.to_alipay_dict()
  90. else:
  91. params['dept_path'] = self.dept_path
  92. if self.label_code:
  93. if hasattr(self.label_code, 'to_alipay_dict'):
  94. params['label_code'] = self.label_code.to_alipay_dict()
  95. else:
  96. params['label_code'] = self.label_code
  97. if self.label_name:
  98. if hasattr(self.label_name, 'to_alipay_dict'):
  99. params['label_name'] = self.label_name.to_alipay_dict()
  100. else:
  101. params['label_name'] = self.label_name
  102. if self.parent_dept_id:
  103. if hasattr(self.parent_dept_id, 'to_alipay_dict'):
  104. params['parent_dept_id'] = self.parent_dept_id.to_alipay_dict()
  105. else:
  106. params['parent_dept_id'] = self.parent_dept_id
  107. if self.shop_id:
  108. if hasattr(self.shop_id, 'to_alipay_dict'):
  109. params['shop_id'] = self.shop_id.to_alipay_dict()
  110. else:
  111. params['shop_id'] = self.shop_id
  112. if self.type:
  113. if hasattr(self.type, 'to_alipay_dict'):
  114. params['type'] = self.type.to_alipay_dict()
  115. else:
  116. params['type'] = self.type
  117. return params
  118. @staticmethod
  119. def from_alipay_dict(d):
  120. if not d:
  121. return None
  122. o = DepartmentDTO()
  123. if 'biz_type' in d:
  124. o.biz_type = d['biz_type']
  125. if 'dept_id' in d:
  126. o.dept_id = d['dept_id']
  127. if 'dept_name' in d:
  128. o.dept_name = d['dept_name']
  129. if 'dept_path' in d:
  130. o.dept_path = d['dept_path']
  131. if 'label_code' in d:
  132. o.label_code = d['label_code']
  133. if 'label_name' in d:
  134. o.label_name = d['label_name']
  135. if 'parent_dept_id' in d:
  136. o.parent_dept_id = d['parent_dept_id']
  137. if 'shop_id' in d:
  138. o.shop_id = d['shop_id']
  139. if 'type' in d:
  140. o.type = d['type']
  141. return o