user_response_entity_helper.dart 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. import 'package:deus_app/model/user_response_entity.dart';
  2. userResponseEntityFromJson(UserResponseEntity 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 = UserResponseData().fromJson(json['data']);
  10. }
  11. if (json['msg'] != null) {
  12. data.msg = json['msg'].toString();
  13. }
  14. return data;
  15. }
  16. Map<String, dynamic> userResponseEntityToJson(UserResponseEntity 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. userResponseDataFromJson(UserResponseData data, Map<String, dynamic> json) {
  24. if (json['id'] != null) {
  25. data.id = json['id'] is String
  26. ? int.tryParse(json['id'])
  27. : json['id'].toInt();
  28. }
  29. if (json['accId'] != null) {
  30. data.accId = json['accId'] is String
  31. ? int.tryParse(json['accId'])
  32. : json['accId'].toInt();
  33. }
  34. if (json['name'] != null) {
  35. data.name = json['name'].toString();
  36. }
  37. if (json['phone'] != null) {
  38. data.phone = json['phone'].toString();
  39. }
  40. if (json['password'] != null) {
  41. data.password = json['password'];
  42. }
  43. if (json['enable'] != null) {
  44. data.enable = json['enable'] is String
  45. ? int.tryParse(json['enable'])
  46. : json['enable'].toInt();
  47. }
  48. if (json['isDelete'] != null) {
  49. data.isDelete = json['isDelete'] is String
  50. ? int.tryParse(json['isDelete'])
  51. : json['isDelete'].toInt();
  52. }
  53. if (json['orgType'] != null) {
  54. data.orgType = json['orgType'] is String
  55. ? int.tryParse(json['orgType'])
  56. : json['orgType'].toInt();
  57. }
  58. if (json['orgName'] != null) {
  59. data.orgName = json['orgName'].toString();
  60. }
  61. if (json['orgId'] != null) {
  62. data.orgId = json['orgId'] is String
  63. ? int.tryParse(json['orgId'])
  64. : json['orgId'].toInt();
  65. }
  66. if (json['userMenuList'] != null) {
  67. data.userMenuList = (json['userMenuList'] as List).map((v) => UserResponseDataUserMenuList().fromJson(v)).toList();
  68. }
  69. if (json['roleIdList'] != null) {
  70. data.roleIdList = json['roleIdList'];
  71. }
  72. if (json['roleList'] != null) {
  73. data.roleList = (json['roleList'] as List).map((v) => UserResponseDataRoleList().fromJson(v)).toList();
  74. }
  75. return data;
  76. }
  77. Map<String, dynamic> userResponseDataToJson(UserResponseData entity) {
  78. final Map<String, dynamic> data = new Map<String, dynamic>();
  79. data['id'] = entity.id;
  80. data['accId'] = entity.accId;
  81. data['name'] = entity.name;
  82. data['phone'] = entity.phone;
  83. data['password'] = entity.password;
  84. data['enable'] = entity.enable;
  85. data['isDelete'] = entity.isDelete;
  86. data['orgType'] = entity.orgType;
  87. data['orgName'] = entity.orgName;
  88. data['orgId'] = entity.orgId;
  89. data['userMenuList'] = entity.userMenuList.map((v) => v.toJson()).toList();
  90. data['roleIdList'] = entity.roleIdList;
  91. data['roleList'] = entity.roleList.map((v) => v.toJson()).toList();
  92. return data;
  93. }
  94. userResponseDataUserMenuListFromJson(UserResponseDataUserMenuList data, Map<String, dynamic> json) {
  95. if (json['id'] != null) {
  96. data.id = json['id'] is String
  97. ? int.tryParse(json['id'])
  98. : json['id'].toInt();
  99. }
  100. if (json['pid'] != null) {
  101. data.pid = json['pid'] is String
  102. ? int.tryParse(json['pid'])
  103. : json['pid'].toInt();
  104. }
  105. if (json['subCount'] != null) {
  106. data.subCount = json['subCount'] is String
  107. ? int.tryParse(json['subCount'])
  108. : json['subCount'].toInt();
  109. }
  110. if (json['type'] != null) {
  111. data.type = json['type'] is String
  112. ? int.tryParse(json['type'])
  113. : json['type'].toInt();
  114. }
  115. if (json['title'] != null) {
  116. data.title = json['title'].toString();
  117. }
  118. if (json['name'] != null) {
  119. data.name = json['name'].toString();
  120. }
  121. if (json['component'] != null) {
  122. data.component = json['component'].toString();
  123. }
  124. if (json['sort'] != null) {
  125. data.sort = json['sort'] is String
  126. ? int.tryParse(json['sort'])
  127. : json['sort'].toInt();
  128. }
  129. if (json['icon'] != null) {
  130. data.icon = json['icon'].toString();
  131. }
  132. if (json['iconActive'] != null) {
  133. data.iconActive = json['iconActive'].toString();
  134. }
  135. if (json['path'] != null) {
  136. data.path = json['path'].toString();
  137. }
  138. if (json['isEl'] != null) {
  139. data.isEl = json['isEl'];
  140. }
  141. if (json['isCache'] != null) {
  142. data.isCache = json['isCache'];
  143. }
  144. if (json['isHidden'] != null) {
  145. data.isHidden = json['isHidden'];
  146. }
  147. if (json['isDelete'] != null) {
  148. data.isDelete = json['isDelete'];
  149. }
  150. if (json['permission'] != null) {
  151. data.permission = json['permission'].toString();
  152. }
  153. if (json['creator'] != null) {
  154. data.creator = json['creator'].toString();
  155. }
  156. if (json['createTime'] != null) {
  157. data.createTime = json['createTime'].toString();
  158. }
  159. if (json['subMenu'] != null) {
  160. data.subMenu = json['subMenu'];
  161. }
  162. if (json['pname'] != null) {
  163. data.pname = json['pname'];
  164. }
  165. return data;
  166. }
  167. Map<String, dynamic> userResponseDataUserMenuListToJson(UserResponseDataUserMenuList entity) {
  168. final Map<String, dynamic> data = new Map<String, dynamic>();
  169. data['id'] = entity.id;
  170. data['pid'] = entity.pid;
  171. data['subCount'] = entity.subCount;
  172. data['type'] = entity.type;
  173. data['title'] = entity.title;
  174. data['name'] = entity.name;
  175. data['component'] = entity.component;
  176. data['sort'] = entity.sort;
  177. data['icon'] = entity.icon;
  178. data['iconActive'] = entity.iconActive;
  179. data['path'] = entity.path;
  180. data['isEl'] = entity.isEl;
  181. data['isCache'] = entity.isCache;
  182. data['isHidden'] = entity.isHidden;
  183. data['isDelete'] = entity.isDelete;
  184. data['permission'] = entity.permission;
  185. data['creator'] = entity.creator;
  186. data['createTime'] = entity.createTime;
  187. data['subMenu'] = entity.subMenu;
  188. data['pname'] = entity.pname;
  189. return data;
  190. }
  191. userResponseDataRoleListFromJson(UserResponseDataRoleList data, Map<String, dynamic> json) {
  192. if (json['id'] != null) {
  193. data.id = json['id'] is String
  194. ? int.tryParse(json['id'])
  195. : json['id'].toInt();
  196. }
  197. if (json['name'] != null) {
  198. data.name = json['name'].toString();
  199. }
  200. if (json['type'] != null) {
  201. data.type = json['type'];
  202. }
  203. if (json['level'] != null) {
  204. data.level = json['level'] is String
  205. ? int.tryParse(json['level'])
  206. : json['level'].toInt();
  207. }
  208. if (json['description'] != null) {
  209. data.description = json['description'].toString();
  210. }
  211. if (json['dataScope'] != null) {
  212. data.dataScope = json['dataScope'];
  213. }
  214. if (json['enable'] != null) {
  215. data.enable = json['enable'] is String
  216. ? int.tryParse(json['enable'])
  217. : json['enable'].toInt();
  218. }
  219. if (json['creator'] != null) {
  220. data.creator = json['creator'].toString();
  221. }
  222. if (json['createTime'] != null) {
  223. data.createTime = json['createTime'].toString();
  224. }
  225. if (json['menuList'] != null) {
  226. data.menuList = json['menuList'];
  227. }
  228. return data;
  229. }
  230. Map<String, dynamic> userResponseDataRoleListToJson(UserResponseDataRoleList entity) {
  231. final Map<String, dynamic> data = new Map<String, dynamic>();
  232. data['id'] = entity.id;
  233. data['name'] = entity.name;
  234. data['type'] = entity.type;
  235. data['level'] = entity.level;
  236. data['description'] = entity.description;
  237. data['dataScope'] = entity.dataScope;
  238. data['enable'] = entity.enable;
  239. data['creator'] = entity.creator;
  240. data['createTime'] = entity.createTime;
  241. data['menuList'] = entity.menuList;
  242. return data;
  243. }