user.m.dart 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. class UserInfo {
  2. String? userCode;
  3. String? userName;
  4. String? secretPassword;
  5. String? phone;
  6. String? email;
  7. String? nickName;
  8. String? fullName;
  9. String? headImageToken;
  10. String? organizationCode;
  11. List<String>? authorityGroups;
  12. List<String>? bindDevices;
  13. int score;
  14. String? lastIP;
  15. String? id;
  16. DateTime? createTime;
  17. DateTime? updateTime;
  18. bool isDelete;
  19. UserInfo({
  20. this.userCode,
  21. this.userName,
  22. this.secretPassword,
  23. this.phone,
  24. this.email,
  25. this.nickName,
  26. this.fullName,
  27. this.headImageToken,
  28. this.organizationCode,
  29. this.authorityGroups,
  30. this.bindDevices,
  31. this.score=0,
  32. this.lastIP,
  33. this.id,
  34. this.createTime,
  35. this.updateTime,
  36. this.isDelete=false,
  37. });
  38. factory UserInfo.fromJson(Map<String, dynamic> map) {
  39. return UserInfo(
  40. userCode: map['UserCode'],
  41. userName: map['UserName'],
  42. secretPassword: map['SecretPassword'],
  43. phone: map['Phone'],
  44. email: map['Email'],
  45. nickName: map['NickName'],
  46. fullName: map['FullName'],
  47. headImageToken: map['HeadImageToken'],
  48. organizationCode: map['OrganizationCode'],
  49. authorityGroups: map['AuthorityGroups'].cast<String>().toList(),
  50. bindDevices: map['BindDevices'].cast<String>().toList(),
  51. score: map['Score'],
  52. lastIP: map['LastIP'],
  53. id: map['Id'],
  54. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  55. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  56. isDelete: map['IsDelete'],
  57. );
  58. }
  59. Map<String, dynamic> toJson() {
  60. final map = Map<String, dynamic>();
  61. if(userCode != null)
  62. map['UserCode'] = userCode;
  63. if(userName != null)
  64. map['UserName'] = userName;
  65. if(secretPassword != null)
  66. map['SecretPassword'] = secretPassword;
  67. if(phone != null)
  68. map['Phone'] = phone;
  69. if(email != null)
  70. map['Email'] = email;
  71. if(nickName != null)
  72. map['NickName'] = nickName;
  73. if(fullName != null)
  74. map['FullName'] = fullName;
  75. if(headImageToken != null)
  76. map['HeadImageToken'] = headImageToken;
  77. if(organizationCode != null)
  78. map['OrganizationCode'] = organizationCode;
  79. if(authorityGroups != null)
  80. map['AuthorityGroups'] = authorityGroups;
  81. if(bindDevices != null)
  82. map['BindDevices'] = bindDevices;
  83. map['Score'] = score;
  84. if(lastIP != null)
  85. map['LastIP'] = lastIP;
  86. if(id != null)
  87. map['Id'] = id;
  88. if(createTime != null)
  89. map['CreateTime'] = createTime;
  90. if(updateTime != null)
  91. map['UpdateTime'] = updateTime;
  92. map['IsDelete'] = isDelete;
  93. return map;
  94. }
  95. }