equipment_list_entity_helper.dart 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. import 'package:deus_app/model/equipment_list_entity.dart';
  2. equipmentListEntityFromJson(EquipmentListEntity data, Map<String, dynamic> json) {
  3. if (json['code'] != null) {
  4. data.code = json['code'] is String
  5. ? int.tryParse(json['code'])
  6. : json['code'].toInt();
  7. }
  8. if (json['data'] != null) {
  9. data.data = EquipmentListData().fromJson(json['data']);
  10. }
  11. if (json['msg'] != null) {
  12. data.msg = json['msg'].toString();
  13. }
  14. return data;
  15. }
  16. Map<String, dynamic> equipmentListEntityToJson(EquipmentListEntity entity) {
  17. final Map<String, dynamic> data = new Map<String, dynamic>();
  18. data['code'] = entity.code;
  19. data['data'] = entity.data.toJson();
  20. data['msg'] = entity.msg;
  21. return data;
  22. }
  23. equipmentListDataFromJson(EquipmentListData data, Map<String, dynamic> json) {
  24. if (json['total'] != null) {
  25. data.total = json['total'] is String
  26. ? int.tryParse(json['total'])
  27. : json['total'].toInt();
  28. }
  29. if (json['index'] != null) {
  30. data.index = json['index'] is String
  31. ? int.tryParse(json['index'])
  32. : json['index'].toInt();
  33. }
  34. if (json['size'] != null) {
  35. data.size = json['size'] is String
  36. ? int.tryParse(json['size'])
  37. : json['size'].toInt();
  38. }
  39. if (json['sortBy'] != null) {
  40. data.sortBy = json['sortBy'];
  41. }
  42. if (json['sort'] != null) {
  43. data.sort = json['sort'];
  44. }
  45. if (json['query'] != null) {
  46. data.query = json['query'];
  47. }
  48. if (json['equipmentVOS'] != null) {
  49. data.equipmentVOS = (json['equipmentVOS'] as List).map((v) => EquipmentListDataEquipmentVOS().fromJson(v)).toList();
  50. }
  51. if (json['countDTO'] != null) {
  52. data.countDTO = EquipmentListDataCountDTO().fromJson(json['countDTO']);
  53. }
  54. return data;
  55. }
  56. Map<String, dynamic> equipmentListDataToJson(EquipmentListData entity) {
  57. final Map<String, dynamic> data = new Map<String, dynamic>();
  58. data['total'] = entity.total;
  59. data['index'] = entity.index;
  60. data['size'] = entity.size;
  61. data['sortBy'] = entity.sortBy;
  62. data['sort'] = entity.sort;
  63. data['query'] = entity.query;
  64. data['equipmentVOS'] = entity.equipmentVOS.map((v) => v.toJson()).toList();
  65. data['countDTO'] = entity.countDTO.toJson();
  66. return data;
  67. }
  68. equipmentListDataEquipmentVOSFromJson(EquipmentListDataEquipmentVOS data, Map<String, dynamic> json) {
  69. if (json['id'] != null) {
  70. data.id = json['id'] is String
  71. ? int.tryParse(json['id'])
  72. : json['id'].toInt();
  73. }
  74. if (json['name'] != null) {
  75. data.name = json['name'].toString();
  76. }
  77. if (json['showName'] != null) {
  78. data.showName = json['showName'].toString();
  79. }
  80. if (json['deviceKey'] != null) {
  81. data.deviceKey = json['deviceKey'].toString();
  82. }
  83. if (json['authType'] != null) {
  84. data.authType = json['authType'] is String
  85. ? int.tryParse(json['authType'])
  86. : json['authType'].toInt();
  87. }
  88. if (json['isEnable'] != null) {
  89. data.isEnable = json['isEnable'] is String
  90. ? int.tryParse(json['isEnable'])
  91. : json['isEnable'].toInt();
  92. }
  93. if (json['isActive'] != null) {
  94. data.isActive = json['isActive'];
  95. }
  96. if (json['deviceSecret'] != null) {
  97. data.deviceSecret = json['deviceSecret'].toString();
  98. }
  99. if (json['deviceId'] != null) {
  100. data.deviceId = json['deviceId'].toString();
  101. }
  102. if (json['productName'] != null) {
  103. data.productName = json['productName'].toString();
  104. }
  105. if (json['productKey'] != null) {
  106. data.productKey = json['productKey'].toString();
  107. }
  108. if (json['productId'] != null) {
  109. data.productId = json['productId'] is String
  110. ? int.tryParse(json['productId'])
  111. : json['productId'].toInt();
  112. }
  113. if (json['status'] != null) {
  114. data.status = json['status'] is String
  115. ? int.tryParse(json['status'])
  116. : json['status'].toInt();
  117. }
  118. if (json['nodeType'] != null) {
  119. data.nodeType = json['nodeType'] is String
  120. ? int.tryParse(json['nodeType'])
  121. : json['nodeType'].toInt();
  122. }
  123. if (json['connectionProtocol'] != null) {
  124. data.connectionProtocol = json['connectionProtocol'];
  125. }
  126. if (json['ip'] != null) {
  127. data.ip = json['ip'];
  128. }
  129. if (json['lastUpdateOn'] != null) {
  130. data.lastUpdateOn = json['lastUpdateOn'];
  131. }
  132. if (json['activationOn'] != null) {
  133. data.activationOn = json['activationOn'];
  134. }
  135. if (json['positionId'] != null) {
  136. data.positionId = json['positionId'];
  137. }
  138. if (json['number'] != null) {
  139. data.number = json['number'];
  140. }
  141. if (json['speedA'] != null) {
  142. data.speedA = json['speedA'].toString();
  143. }
  144. if (json['speedB'] != null) {
  145. data.speedB = json['speedB'].toString();
  146. }
  147. if (json['finenessA'] != null) {
  148. data.finenessA = json['finenessA'].toString();
  149. }
  150. if (json['finenessB'] != null) {
  151. data.finenessB = json['finenessB'].toString();
  152. }
  153. if (json['holeCountA'] != null) {
  154. data.holeCountA = json['holeCountA'].toString();
  155. }
  156. if (json['holeCountB'] != null) {
  157. data.holeCountB = json['holeCountB'].toString();
  158. }
  159. if (json['activePeriod'] != null) {
  160. data.activePeriod = json['activePeriod'];
  161. }
  162. if (json['createdOn'] != null) {
  163. data.createdOn = json['createdOn'].toString();
  164. }
  165. if (json['lastOnlineOn'] != null) {
  166. data.lastOnlineOn = json['lastOnlineOn'];
  167. }
  168. if (json['iotId'] != null) {
  169. data.iotId = json['iotId'].toString();
  170. }
  171. if (json['description'] != null) {
  172. data.description = json['description'].toString();
  173. }
  174. if (json['customerId'] != null) {
  175. data.customerId = json['customerId'].toString();
  176. }
  177. if (json['channelId'] != null) {
  178. data.channelId = json['channelId'];
  179. }
  180. if (json['imei'] != null) {
  181. data.imei = json['imei'];
  182. }
  183. return data;
  184. }
  185. Map<String, dynamic> equipmentListDataEquipmentVOSToJson(EquipmentListDataEquipmentVOS entity) {
  186. final Map<String, dynamic> data = new Map<String, dynamic>();
  187. data['id'] = entity.id;
  188. data['name'] = entity.name;
  189. data['showName'] = entity.showName;
  190. data['deviceKey'] = entity.deviceKey;
  191. data['authType'] = entity.authType;
  192. data['isEnable'] = entity.isEnable;
  193. data['isActive'] = entity.isActive;
  194. data['deviceSecret'] = entity.deviceSecret;
  195. data['deviceId'] = entity.deviceId;
  196. data['productName'] = entity.productName;
  197. data['productKey'] = entity.productKey;
  198. data['productId'] = entity.productId;
  199. data['status'] = entity.status;
  200. data['nodeType'] = entity.nodeType;
  201. data['connectionProtocol'] = entity.connectionProtocol;
  202. data['ip'] = entity.ip;
  203. data['lastUpdateOn'] = entity.lastUpdateOn;
  204. data['activationOn'] = entity.activationOn;
  205. data['positionId'] = entity.positionId;
  206. data['number'] = entity.number;
  207. data['speedA'] = entity.speedA;
  208. data['speedB'] = entity.speedB;
  209. data['finenessA'] = entity.finenessA;
  210. data['finenessB'] = entity.finenessB;
  211. data['holeCountA'] = entity.holeCountA;
  212. data['holeCountB'] = entity.holeCountB;
  213. data['activePeriod'] = entity.activePeriod;
  214. data['createdOn'] = entity.createdOn;
  215. data['lastOnlineOn'] = entity.lastOnlineOn;
  216. data['iotId'] = entity.iotId;
  217. data['description'] = entity.description;
  218. data['customerId'] = entity.customerId;
  219. data['channelId'] = entity.channelId;
  220. data['imei'] = entity.imei;
  221. return data;
  222. }
  223. equipmentListDataCountDTOFromJson(EquipmentListDataCountDTO data, Map<String, dynamic> json) {
  224. if (json['count'] != null) {
  225. data.count = json['count'] is String
  226. ? int.tryParse(json['count'])
  227. : json['count'].toInt();
  228. }
  229. if (json['active'] != null) {
  230. data.active = json['active'] is String
  231. ? int.tryParse(json['active'])
  232. : json['active'].toInt();
  233. }
  234. if (json['online'] != null) {
  235. data.online = json['online'] is String
  236. ? int.tryParse(json['online'])
  237. : json['online'].toInt();
  238. }
  239. if (json['offline'] != null) {
  240. data.offline = json['offline'] is String
  241. ? int.tryParse(json['offline'])
  242. : json['offline'].toInt();
  243. }
  244. return data;
  245. }
  246. Map<String, dynamic> equipmentListDataCountDTOToJson(EquipmentListDataCountDTO entity) {
  247. final Map<String, dynamic> data = new Map<String, dynamic>();
  248. data['count'] = entity.count;
  249. data['active'] = entity.active;
  250. data['online'] = entity.online;
  251. data['offline'] = entity.offline;
  252. return data;
  253. }