role.m.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import 'connect.m.dart';
  2. import 'authentication.m.dart';
  3. class BaseRoleDTO extends BaseDTO{
  4. String? roleCode;
  5. String? roleName;
  6. String? description;
  7. BaseRoleDTO({
  8. this.roleCode,
  9. this.roleName,
  10. this.description,
  11. DateTime? createTime,
  12. DateTime? updateTime,
  13. }) : super(
  14. createTime: createTime,
  15. updateTime: updateTime,
  16. );
  17. factory BaseRoleDTO.fromJson(Map<String, dynamic> map) {
  18. return BaseRoleDTO(
  19. roleCode: map['RoleCode'],
  20. roleName: map['RoleName'],
  21. description: map['Description'],
  22. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  23. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  24. );
  25. }
  26. Map<String, dynamic> toJson() {
  27. final map = super.toJson();
  28. if(roleCode != null)
  29. map['RoleCode'] = roleCode;
  30. if(roleName != null)
  31. map['RoleName'] = roleName;
  32. if(description != null)
  33. map['Description'] = description;
  34. return map;
  35. }
  36. }
  37. enum RoleShowTypeEnum {
  38. NotShow,
  39. ISShow,
  40. }
  41. enum RoleQualificationEnum {
  42. NoNeed,
  43. ID,
  44. DocLicense,
  45. Both,
  46. }
  47. class RoleDTO extends BaseRoleDTO{
  48. RoleShowTypeEnum roleShowType;
  49. String? iConUrl;
  50. String? colorStart;
  51. String? colorEnd;
  52. RoleQualificationEnum roleQualification;
  53. String? userGroupCode;
  54. RoleDTO({
  55. this.roleShowType = RoleShowTypeEnum.NotShow,
  56. this.iConUrl,
  57. this.colorStart,
  58. this.colorEnd,
  59. this.roleQualification = RoleQualificationEnum.NoNeed,
  60. this.userGroupCode,
  61. String? roleCode,
  62. String? roleName,
  63. String? description,
  64. DateTime? createTime,
  65. DateTime? updateTime,
  66. }) : super(
  67. roleCode: roleCode,
  68. roleName: roleName,
  69. description: description,
  70. createTime: createTime,
  71. updateTime: updateTime,
  72. );
  73. factory RoleDTO.fromJson(Map<String, dynamic> map) {
  74. return RoleDTO(
  75. roleShowType: RoleShowTypeEnum.values.firstWhere((e) => e.index == map['RoleShowType']),
  76. iConUrl: map['IConUrl'],
  77. colorStart: map['ColorStart'],
  78. colorEnd: map['ColorEnd'],
  79. roleQualification: RoleQualificationEnum.values.firstWhere((e) => e.index == map['RoleQualification']),
  80. userGroupCode: map['UserGroupCode'],
  81. roleCode: map['RoleCode'],
  82. roleName: map['RoleName'],
  83. description: map['Description'],
  84. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  85. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  86. );
  87. }
  88. Map<String, dynamic> toJson() {
  89. final map = super.toJson();
  90. map['RoleShowType'] = roleShowType.index;
  91. if(iConUrl != null)
  92. map['IConUrl'] = iConUrl;
  93. if(colorStart != null)
  94. map['ColorStart'] = colorStart;
  95. if(colorEnd != null)
  96. map['ColorEnd'] = colorEnd;
  97. map['RoleQualification'] = roleQualification.index;
  98. if(userGroupCode != null)
  99. map['UserGroupCode'] = userGroupCode;
  100. return map;
  101. }
  102. }
  103. class GetRoleByCodeRequest extends TokenRequest{
  104. String? roleCode;
  105. GetRoleByCodeRequest({
  106. this.roleCode,
  107. String? token,
  108. }) : super(
  109. token: token,
  110. );
  111. factory GetRoleByCodeRequest.fromJson(Map<String, dynamic> map) {
  112. return GetRoleByCodeRequest(
  113. roleCode: map['RoleCode'],
  114. token: map['Token'],
  115. );
  116. }
  117. Map<String, dynamic> toJson() {
  118. final map = super.toJson();
  119. if(roleCode != null)
  120. map['RoleCode'] = roleCode;
  121. return map;
  122. }
  123. }
  124. class FindDefaultRolesRequest extends TokenRequest{
  125. String? organizationCode;
  126. FindDefaultRolesRequest({
  127. this.organizationCode,
  128. String? token,
  129. }) : super(
  130. token: token,
  131. );
  132. factory FindDefaultRolesRequest.fromJson(Map<String, dynamic> map) {
  133. return FindDefaultRolesRequest(
  134. organizationCode: map['OrganizationCode'],
  135. token: map['Token'],
  136. );
  137. }
  138. Map<String, dynamic> toJson() {
  139. final map = super.toJson();
  140. if(organizationCode != null)
  141. map['OrganizationCode'] = organizationCode;
  142. return map;
  143. }
  144. }
  145. class FindAuthenticationRolesRequest extends TokenRequest{
  146. FindAuthenticationRolesRequest({
  147. String? token,
  148. }) : super(
  149. token: token,
  150. );
  151. factory FindAuthenticationRolesRequest.fromJson(Map<String, dynamic> map) {
  152. return FindAuthenticationRolesRequest(
  153. token: map['Token'],
  154. );
  155. }
  156. Map<String, dynamic> toJson() {
  157. final map = super.toJson();
  158. return map;
  159. }
  160. }