KoubeiMerchantDepartmentBatchBindModel.py 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.SimpleOperatorModel import SimpleOperatorModel
  6. class KoubeiMerchantDepartmentBatchBindModel(object):
  7. def __init__(self):
  8. self._auth_code = None
  9. self._dept_id = None
  10. self._dept_type = None
  11. self._operator_list = None
  12. @property
  13. def auth_code(self):
  14. return self._auth_code
  15. @auth_code.setter
  16. def auth_code(self, value):
  17. self._auth_code = value
  18. @property
  19. def dept_id(self):
  20. return self._dept_id
  21. @dept_id.setter
  22. def dept_id(self, value):
  23. self._dept_id = value
  24. @property
  25. def dept_type(self):
  26. return self._dept_type
  27. @dept_type.setter
  28. def dept_type(self, value):
  29. self._dept_type = value
  30. @property
  31. def operator_list(self):
  32. return self._operator_list
  33. @operator_list.setter
  34. def operator_list(self, value):
  35. if isinstance(value, list):
  36. self._operator_list = list()
  37. for i in value:
  38. if isinstance(i, SimpleOperatorModel):
  39. self._operator_list.append(i)
  40. else:
  41. self._operator_list.append(SimpleOperatorModel.from_alipay_dict(i))
  42. def to_alipay_dict(self):
  43. params = dict()
  44. if self.auth_code:
  45. if hasattr(self.auth_code, 'to_alipay_dict'):
  46. params['auth_code'] = self.auth_code.to_alipay_dict()
  47. else:
  48. params['auth_code'] = self.auth_code
  49. if self.dept_id:
  50. if hasattr(self.dept_id, 'to_alipay_dict'):
  51. params['dept_id'] = self.dept_id.to_alipay_dict()
  52. else:
  53. params['dept_id'] = self.dept_id
  54. if self.dept_type:
  55. if hasattr(self.dept_type, 'to_alipay_dict'):
  56. params['dept_type'] = self.dept_type.to_alipay_dict()
  57. else:
  58. params['dept_type'] = self.dept_type
  59. if self.operator_list:
  60. if isinstance(self.operator_list, list):
  61. for i in range(0, len(self.operator_list)):
  62. element = self.operator_list[i]
  63. if hasattr(element, 'to_alipay_dict'):
  64. self.operator_list[i] = element.to_alipay_dict()
  65. if hasattr(self.operator_list, 'to_alipay_dict'):
  66. params['operator_list'] = self.operator_list.to_alipay_dict()
  67. else:
  68. params['operator_list'] = self.operator_list
  69. return params
  70. @staticmethod
  71. def from_alipay_dict(d):
  72. if not d:
  73. return None
  74. o = KoubeiMerchantDepartmentBatchBindModel()
  75. if 'auth_code' in d:
  76. o.auth_code = d['auth_code']
  77. if 'dept_id' in d:
  78. o.dept_id = d['dept_id']
  79. if 'dept_type' in d:
  80. o.dept_type = d['dept_type']
  81. if 'operator_list' in d:
  82. o.operator_list = d['operator_list']
  83. return o