user_entity.dart 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. class UserEntity {
  2. String userId;
  3. String mobile;
  4. String name;
  5. String avatarUrl;
  6. String token;
  7. int userLevel;
  8. String userLevelName;
  9. MaintenanceCompany maintenanceCompany;
  10. Role role;
  11. List<AppMenus> appMenus;
  12. int expertFlag;
  13. int expertLevel;
  14. UserEntity(
  15. {this.userId,
  16. this.mobile,
  17. this.name,
  18. this.avatarUrl,
  19. this.token,
  20. this.userLevel,
  21. this.userLevelName,
  22. this.maintenanceCompany,
  23. this.role,
  24. this.expertFlag,
  25. this.expertLevel,
  26. this.appMenus});
  27. UserEntity.fromJsonMap(Map<String, dynamic> json) {
  28. userId = json['userId'];
  29. expertFlag = json['expertFlag'];
  30. expertLevel = json['expertLevel'];
  31. mobile = json['mobile'];
  32. name = json['name'];
  33. avatarUrl = json['avatarUrl'];
  34. token = json['token'];
  35. userLevel = json['userLevel'];
  36. userLevelName = json['userLevelName'];
  37. maintenanceCompany = json['maintenanceCompany'] != null
  38. ? new MaintenanceCompany.fromJsonMap(json['maintenanceCompany'])
  39. : null;
  40. role = json['role'] != null ? new Role.fromJsonMap(json['role']) : null;
  41. if (json['appMenus'] != null) {
  42. appMenus = new List<AppMenus>();
  43. json['appMenus'].forEach((v) {
  44. appMenus.add(new AppMenus.fromJsonMap(v));
  45. });
  46. }
  47. }
  48. Map<String, dynamic> toJson() {
  49. final Map<String, dynamic> data = new Map<String, dynamic>();
  50. data['userId'] = this.userId;
  51. data['mobile'] = this.mobile;
  52. data['name'] = this.name;
  53. data['expertFlag'] = this.expertFlag;
  54. data['expertLevel'] = this.expertLevel;
  55. data['avatarUrl'] = this.avatarUrl;
  56. data['token'] = this.token;
  57. data['userLevel'] = this.userLevel;
  58. data['userLevelName'] = this.userLevelName;
  59. if (this.maintenanceCompany != null) {
  60. data['maintenanceCompany'] = this.maintenanceCompany.toJson();
  61. }
  62. if (this.role != null) {
  63. data['role'] = this.role.toJson();
  64. }
  65. if (this.appMenus != null) {
  66. data['appMenus'] = this.appMenus.map((v) => v.toJson()).toList();
  67. }
  68. return data;
  69. }
  70. }
  71. class MaintenanceCompany {
  72. String id;
  73. String name;
  74. String address;
  75. MaintenanceCompany({this.id, this.name, this.address});
  76. MaintenanceCompany.fromJsonMap(Map<String, dynamic> json) {
  77. id = json['id'];
  78. name = json['name'];
  79. address = json['address'];
  80. }
  81. Map<String, dynamic> toJson() {
  82. final Map<String, dynamic> data = new Map<String, dynamic>();
  83. data['id'] = this.id;
  84. data['name'] = this.name;
  85. data['address'] = this.address;
  86. return data;
  87. }
  88. }
  89. class Role {
  90. String id;
  91. String name;
  92. String code;
  93. String description;
  94. Role({this.id, this.name, this.code, this.description});
  95. Role.fromJsonMap(Map<String, dynamic> json) {
  96. id = json['id'];
  97. name = json['name'];
  98. code = json['code'];
  99. description = json['description'];
  100. }
  101. Map<String, dynamic> toJson() {
  102. final Map<String, dynamic> data = new Map<String, dynamic>();
  103. data['id'] = this.id;
  104. data['name'] = this.name;
  105. data['code'] = this.code;
  106. data['description'] = this.description;
  107. return data;
  108. }
  109. }
  110. class AppMenus {
  111. int id;
  112. String name;
  113. String router;
  114. int status;
  115. AppMenus({this.id, this.name, this.router, this.status});
  116. AppMenus.fromJsonMap(Map<String, dynamic> json) {
  117. id = json['id'];
  118. name = json['name'];
  119. router = json['router'];
  120. status = json['status'];
  121. }
  122. Map<String, dynamic> toJson() {
  123. final Map<String, dynamic> data = new Map<String, dynamic>();
  124. data['id'] = this.id;
  125. data['name'] = this.name;
  126. data['router'] = this.router;
  127. data['status'] = this.status;
  128. return data;
  129. }
  130. }