class UserEntity { String userId; String mobile; String name; String avatarUrl; String token; int userLevel; String userLevelName; MaintenanceCompany maintenanceCompany; Role role; List appMenus; int expertFlag; int expertLevel; UserEntity( {this.userId, this.mobile, this.name, this.avatarUrl, this.token, this.userLevel, this.userLevelName, this.maintenanceCompany, this.role, this.expertFlag, this.expertLevel, this.appMenus}); UserEntity.fromJsonMap(Map json) { userId = json['userId']; expertFlag = json['expertFlag']; expertLevel = json['expertLevel']; mobile = json['mobile']; name = json['name']; avatarUrl = json['avatarUrl']; token = json['token']; userLevel = json['userLevel']; userLevelName = json['userLevelName']; maintenanceCompany = json['maintenanceCompany'] != null ? new MaintenanceCompany.fromJsonMap(json['maintenanceCompany']) : null; role = json['role'] != null ? new Role.fromJsonMap(json['role']) : null; if (json['appMenus'] != null) { appMenus = new List(); json['appMenus'].forEach((v) { appMenus.add(new AppMenus.fromJsonMap(v)); }); } } Map toJson() { final Map data = new Map(); data['userId'] = this.userId; data['mobile'] = this.mobile; data['name'] = this.name; data['expertFlag'] = this.expertFlag; data['expertLevel'] = this.expertLevel; data['avatarUrl'] = this.avatarUrl; data['token'] = this.token; data['userLevel'] = this.userLevel; data['userLevelName'] = this.userLevelName; if (this.maintenanceCompany != null) { data['maintenanceCompany'] = this.maintenanceCompany.toJson(); } if (this.role != null) { data['role'] = this.role.toJson(); } if (this.appMenus != null) { data['appMenus'] = this.appMenus.map((v) => v.toJson()).toList(); } return data; } } class MaintenanceCompany { String id; String name; String address; MaintenanceCompany({this.id, this.name, this.address}); MaintenanceCompany.fromJsonMap(Map json) { id = json['id']; name = json['name']; address = json['address']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['address'] = this.address; return data; } } class Role { String id; String name; String code; String description; Role({this.id, this.name, this.code, this.description}); Role.fromJsonMap(Map json) { id = json['id']; name = json['name']; code = json['code']; description = json['description']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['code'] = this.code; data['description'] = this.description; return data; } } class AppMenus { int id; String name; String router; int status; AppMenus({this.id, this.name, this.router, this.status}); AppMenus.fromJsonMap(Map json) { id = json['id']; name = json['name']; router = json['router']; status = json['status']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['router'] = this.router; data['status'] = this.status; return data; } }