InsCertificatePaginationList.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.InsCertificateApiDTO import InsCertificateApiDTO
  6. class InsCertificatePaginationList(object):
  7. def __init__(self):
  8. self._current_page = None
  9. self._list = None
  10. self._page_size = None
  11. self._total_count = None
  12. self._total_page_num = None
  13. @property
  14. def current_page(self):
  15. return self._current_page
  16. @current_page.setter
  17. def current_page(self, value):
  18. self._current_page = value
  19. @property
  20. def list(self):
  21. return self._list
  22. @list.setter
  23. def list(self, value):
  24. if isinstance(value, list):
  25. self._list = list()
  26. for i in value:
  27. if isinstance(i, InsCertificateApiDTO):
  28. self._list.append(i)
  29. else:
  30. self._list.append(InsCertificateApiDTO.from_alipay_dict(i))
  31. @property
  32. def page_size(self):
  33. return self._page_size
  34. @page_size.setter
  35. def page_size(self, value):
  36. self._page_size = value
  37. @property
  38. def total_count(self):
  39. return self._total_count
  40. @total_count.setter
  41. def total_count(self, value):
  42. self._total_count = value
  43. @property
  44. def total_page_num(self):
  45. return self._total_page_num
  46. @total_page_num.setter
  47. def total_page_num(self, value):
  48. self._total_page_num = value
  49. def to_alipay_dict(self):
  50. params = dict()
  51. if self.current_page:
  52. if hasattr(self.current_page, 'to_alipay_dict'):
  53. params['current_page'] = self.current_page.to_alipay_dict()
  54. else:
  55. params['current_page'] = self.current_page
  56. if self.list:
  57. if isinstance(self.list, list):
  58. for i in range(0, len(self.list)):
  59. element = self.list[i]
  60. if hasattr(element, 'to_alipay_dict'):
  61. self.list[i] = element.to_alipay_dict()
  62. if hasattr(self.list, 'to_alipay_dict'):
  63. params['list'] = self.list.to_alipay_dict()
  64. else:
  65. params['list'] = self.list
  66. if self.page_size:
  67. if hasattr(self.page_size, 'to_alipay_dict'):
  68. params['page_size'] = self.page_size.to_alipay_dict()
  69. else:
  70. params['page_size'] = self.page_size
  71. if self.total_count:
  72. if hasattr(self.total_count, 'to_alipay_dict'):
  73. params['total_count'] = self.total_count.to_alipay_dict()
  74. else:
  75. params['total_count'] = self.total_count
  76. if self.total_page_num:
  77. if hasattr(self.total_page_num, 'to_alipay_dict'):
  78. params['total_page_num'] = self.total_page_num.to_alipay_dict()
  79. else:
  80. params['total_page_num'] = self.total_page_num
  81. return params
  82. @staticmethod
  83. def from_alipay_dict(d):
  84. if not d:
  85. return None
  86. o = InsCertificatePaginationList()
  87. if 'current_page' in d:
  88. o.current_page = d['current_page']
  89. if 'list' in d:
  90. o.list = d['list']
  91. if 'page_size' in d:
  92. o.page_size = d['page_size']
  93. if 'total_count' in d:
  94. o.total_count = d['total_count']
  95. if 'total_page_num' in d:
  96. o.total_page_num = d['total_page_num']
  97. return o