CmItemInfo.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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.ItemExtInfo import ItemExtInfo
  6. from alipay.aop.api.domain.MaterialInfo import MaterialInfo
  7. from alipay.aop.api.domain.ItemPropertyInfo import ItemPropertyInfo
  8. from alipay.aop.api.domain.CmItemSkuInfo import CmItemSkuInfo
  9. class CmItemInfo(object):
  10. def __init__(self):
  11. self._description = None
  12. self._ext_info = None
  13. self._front_category_id_list = None
  14. self._gmt_create = None
  15. self._gmt_modified = None
  16. self._item_id = None
  17. self._material_list = None
  18. self._name = None
  19. self._property_list = None
  20. self._sku_list = None
  21. self._standard_category_id = None
  22. self._status = None
  23. self._target_id = None
  24. self._target_type = None
  25. self._type = None
  26. @property
  27. def description(self):
  28. return self._description
  29. @description.setter
  30. def description(self, value):
  31. self._description = value
  32. @property
  33. def ext_info(self):
  34. return self._ext_info
  35. @ext_info.setter
  36. def ext_info(self, value):
  37. if isinstance(value, list):
  38. self._ext_info = list()
  39. for i in value:
  40. if isinstance(i, ItemExtInfo):
  41. self._ext_info.append(i)
  42. else:
  43. self._ext_info.append(ItemExtInfo.from_alipay_dict(i))
  44. @property
  45. def front_category_id_list(self):
  46. return self._front_category_id_list
  47. @front_category_id_list.setter
  48. def front_category_id_list(self, value):
  49. if isinstance(value, list):
  50. self._front_category_id_list = list()
  51. for i in value:
  52. self._front_category_id_list.append(i)
  53. @property
  54. def gmt_create(self):
  55. return self._gmt_create
  56. @gmt_create.setter
  57. def gmt_create(self, value):
  58. self._gmt_create = value
  59. @property
  60. def gmt_modified(self):
  61. return self._gmt_modified
  62. @gmt_modified.setter
  63. def gmt_modified(self, value):
  64. self._gmt_modified = value
  65. @property
  66. def item_id(self):
  67. return self._item_id
  68. @item_id.setter
  69. def item_id(self, value):
  70. self._item_id = value
  71. @property
  72. def material_list(self):
  73. return self._material_list
  74. @material_list.setter
  75. def material_list(self, value):
  76. if isinstance(value, list):
  77. self._material_list = list()
  78. for i in value:
  79. if isinstance(i, MaterialInfo):
  80. self._material_list.append(i)
  81. else:
  82. self._material_list.append(MaterialInfo.from_alipay_dict(i))
  83. @property
  84. def name(self):
  85. return self._name
  86. @name.setter
  87. def name(self, value):
  88. self._name = value
  89. @property
  90. def property_list(self):
  91. return self._property_list
  92. @property_list.setter
  93. def property_list(self, value):
  94. if isinstance(value, list):
  95. self._property_list = list()
  96. for i in value:
  97. if isinstance(i, ItemPropertyInfo):
  98. self._property_list.append(i)
  99. else:
  100. self._property_list.append(ItemPropertyInfo.from_alipay_dict(i))
  101. @property
  102. def sku_list(self):
  103. return self._sku_list
  104. @sku_list.setter
  105. def sku_list(self, value):
  106. if isinstance(value, list):
  107. self._sku_list = list()
  108. for i in value:
  109. if isinstance(i, CmItemSkuInfo):
  110. self._sku_list.append(i)
  111. else:
  112. self._sku_list.append(CmItemSkuInfo.from_alipay_dict(i))
  113. @property
  114. def standard_category_id(self):
  115. return self._standard_category_id
  116. @standard_category_id.setter
  117. def standard_category_id(self, value):
  118. self._standard_category_id = value
  119. @property
  120. def status(self):
  121. return self._status
  122. @status.setter
  123. def status(self, value):
  124. self._status = value
  125. @property
  126. def target_id(self):
  127. return self._target_id
  128. @target_id.setter
  129. def target_id(self, value):
  130. self._target_id = value
  131. @property
  132. def target_type(self):
  133. return self._target_type
  134. @target_type.setter
  135. def target_type(self, value):
  136. self._target_type = value
  137. @property
  138. def type(self):
  139. return self._type
  140. @type.setter
  141. def type(self, value):
  142. self._type = value
  143. def to_alipay_dict(self):
  144. params = dict()
  145. if self.description:
  146. if hasattr(self.description, 'to_alipay_dict'):
  147. params['description'] = self.description.to_alipay_dict()
  148. else:
  149. params['description'] = self.description
  150. if self.ext_info:
  151. if isinstance(self.ext_info, list):
  152. for i in range(0, len(self.ext_info)):
  153. element = self.ext_info[i]
  154. if hasattr(element, 'to_alipay_dict'):
  155. self.ext_info[i] = element.to_alipay_dict()
  156. if hasattr(self.ext_info, 'to_alipay_dict'):
  157. params['ext_info'] = self.ext_info.to_alipay_dict()
  158. else:
  159. params['ext_info'] = self.ext_info
  160. if self.front_category_id_list:
  161. if isinstance(self.front_category_id_list, list):
  162. for i in range(0, len(self.front_category_id_list)):
  163. element = self.front_category_id_list[i]
  164. if hasattr(element, 'to_alipay_dict'):
  165. self.front_category_id_list[i] = element.to_alipay_dict()
  166. if hasattr(self.front_category_id_list, 'to_alipay_dict'):
  167. params['front_category_id_list'] = self.front_category_id_list.to_alipay_dict()
  168. else:
  169. params['front_category_id_list'] = self.front_category_id_list
  170. if self.gmt_create:
  171. if hasattr(self.gmt_create, 'to_alipay_dict'):
  172. params['gmt_create'] = self.gmt_create.to_alipay_dict()
  173. else:
  174. params['gmt_create'] = self.gmt_create
  175. if self.gmt_modified:
  176. if hasattr(self.gmt_modified, 'to_alipay_dict'):
  177. params['gmt_modified'] = self.gmt_modified.to_alipay_dict()
  178. else:
  179. params['gmt_modified'] = self.gmt_modified
  180. if self.item_id:
  181. if hasattr(self.item_id, 'to_alipay_dict'):
  182. params['item_id'] = self.item_id.to_alipay_dict()
  183. else:
  184. params['item_id'] = self.item_id
  185. if self.material_list:
  186. if isinstance(self.material_list, list):
  187. for i in range(0, len(self.material_list)):
  188. element = self.material_list[i]
  189. if hasattr(element, 'to_alipay_dict'):
  190. self.material_list[i] = element.to_alipay_dict()
  191. if hasattr(self.material_list, 'to_alipay_dict'):
  192. params['material_list'] = self.material_list.to_alipay_dict()
  193. else:
  194. params['material_list'] = self.material_list
  195. if self.name:
  196. if hasattr(self.name, 'to_alipay_dict'):
  197. params['name'] = self.name.to_alipay_dict()
  198. else:
  199. params['name'] = self.name
  200. if self.property_list:
  201. if isinstance(self.property_list, list):
  202. for i in range(0, len(self.property_list)):
  203. element = self.property_list[i]
  204. if hasattr(element, 'to_alipay_dict'):
  205. self.property_list[i] = element.to_alipay_dict()
  206. if hasattr(self.property_list, 'to_alipay_dict'):
  207. params['property_list'] = self.property_list.to_alipay_dict()
  208. else:
  209. params['property_list'] = self.property_list
  210. if self.sku_list:
  211. if isinstance(self.sku_list, list):
  212. for i in range(0, len(self.sku_list)):
  213. element = self.sku_list[i]
  214. if hasattr(element, 'to_alipay_dict'):
  215. self.sku_list[i] = element.to_alipay_dict()
  216. if hasattr(self.sku_list, 'to_alipay_dict'):
  217. params['sku_list'] = self.sku_list.to_alipay_dict()
  218. else:
  219. params['sku_list'] = self.sku_list
  220. if self.standard_category_id:
  221. if hasattr(self.standard_category_id, 'to_alipay_dict'):
  222. params['standard_category_id'] = self.standard_category_id.to_alipay_dict()
  223. else:
  224. params['standard_category_id'] = self.standard_category_id
  225. if self.status:
  226. if hasattr(self.status, 'to_alipay_dict'):
  227. params['status'] = self.status.to_alipay_dict()
  228. else:
  229. params['status'] = self.status
  230. if self.target_id:
  231. if hasattr(self.target_id, 'to_alipay_dict'):
  232. params['target_id'] = self.target_id.to_alipay_dict()
  233. else:
  234. params['target_id'] = self.target_id
  235. if self.target_type:
  236. if hasattr(self.target_type, 'to_alipay_dict'):
  237. params['target_type'] = self.target_type.to_alipay_dict()
  238. else:
  239. params['target_type'] = self.target_type
  240. if self.type:
  241. if hasattr(self.type, 'to_alipay_dict'):
  242. params['type'] = self.type.to_alipay_dict()
  243. else:
  244. params['type'] = self.type
  245. return params
  246. @staticmethod
  247. def from_alipay_dict(d):
  248. if not d:
  249. return None
  250. o = CmItemInfo()
  251. if 'description' in d:
  252. o.description = d['description']
  253. if 'ext_info' in d:
  254. o.ext_info = d['ext_info']
  255. if 'front_category_id_list' in d:
  256. o.front_category_id_list = d['front_category_id_list']
  257. if 'gmt_create' in d:
  258. o.gmt_create = d['gmt_create']
  259. if 'gmt_modified' in d:
  260. o.gmt_modified = d['gmt_modified']
  261. if 'item_id' in d:
  262. o.item_id = d['item_id']
  263. if 'material_list' in d:
  264. o.material_list = d['material_list']
  265. if 'name' in d:
  266. o.name = d['name']
  267. if 'property_list' in d:
  268. o.property_list = d['property_list']
  269. if 'sku_list' in d:
  270. o.sku_list = d['sku_list']
  271. if 'standard_category_id' in d:
  272. o.standard_category_id = d['standard_category_id']
  273. if 'status' in d:
  274. o.status = d['status']
  275. if 'target_id' in d:
  276. o.target_id = d['target_id']
  277. if 'target_type' in d:
  278. o.target_type = d['target_type']
  279. if 'type' in d:
  280. o.type = d['type']
  281. return o