role.m.dart 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. import 'liveConsultation.m.dart';
  2. class UserRoleLanguageConfigDTO {
  3. String? language;
  4. String? roleName;
  5. String? description;
  6. List<String >? fieldList;
  7. UserRoleLanguageConfigDTO({
  8. this.language,
  9. this.roleName,
  10. this.description,
  11. this.fieldList,
  12. });
  13. factory UserRoleLanguageConfigDTO.fromJson(Map<String, dynamic> map) {
  14. return UserRoleLanguageConfigDTO(
  15. language: map['Language'],
  16. roleName: map['RoleName'],
  17. description: map['Description'],
  18. fieldList: map['FieldList'] != null ? map['FieldList'].cast<String>().toList() : null,
  19. );
  20. }
  21. Map<String, dynamic> toJson() {
  22. final map = Map<String, dynamic>();
  23. if(language != null)
  24. map['Language'] = language;
  25. if(roleName != null)
  26. map['RoleName'] = roleName;
  27. if(description != null)
  28. map['Description'] = description;
  29. if(fieldList != null)
  30. map['FieldList'] = fieldList;
  31. return map;
  32. }
  33. }
  34. class BaseRoleDTO extends BaseDTO{
  35. String? roleCode;
  36. String? roleName;
  37. String? description;
  38. List<UserRoleLanguageConfigDTO >? languageConfigs;
  39. BaseRoleDTO({
  40. this.roleCode,
  41. this.roleName,
  42. this.description,
  43. this.languageConfigs,
  44. DateTime? createTime,
  45. DateTime? updateTime,
  46. }) : super(
  47. createTime: createTime,
  48. updateTime: updateTime,
  49. );
  50. factory BaseRoleDTO.fromJson(Map<String, dynamic> map) {
  51. return BaseRoleDTO(
  52. roleCode: map['RoleCode'],
  53. roleName: map['RoleName'],
  54. description: map['Description'],
  55. languageConfigs: map['LanguageConfigs'] != null ? (map['LanguageConfigs'] as List).map((e)=>UserRoleLanguageConfigDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  56. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  57. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  58. );
  59. }
  60. Map<String, dynamic> toJson() {
  61. final map = super.toJson();
  62. if(roleCode != null)
  63. map['RoleCode'] = roleCode;
  64. if(roleName != null)
  65. map['RoleName'] = roleName;
  66. if(description != null)
  67. map['Description'] = description;
  68. if(languageConfigs != null)
  69. map['LanguageConfigs'] = languageConfigs;
  70. return map;
  71. }
  72. }
  73. enum RoleShowTypeEnum {
  74. NotShow,
  75. ISShow,
  76. }
  77. enum RoleQualificationEnum {
  78. NoNeed,
  79. ID,
  80. DocLicense,
  81. Both,
  82. }
  83. class RoleDTO extends BaseRoleDTO{
  84. RoleShowTypeEnum roleShowType;
  85. String? iConUrl;
  86. String? colorStart;
  87. String? colorEnd;
  88. RoleQualificationEnum roleQualification;
  89. String? userGroupCode;
  90. RoleShowTypeEnum fieldShowType;
  91. List<String >? fieldList;
  92. RoleDTO({
  93. this.roleShowType = RoleShowTypeEnum.NotShow,
  94. this.iConUrl,
  95. this.colorStart,
  96. this.colorEnd,
  97. this.roleQualification = RoleQualificationEnum.NoNeed,
  98. this.userGroupCode,
  99. this.fieldShowType = RoleShowTypeEnum.NotShow,
  100. this.fieldList,
  101. String? roleCode,
  102. String? roleName,
  103. String? description,
  104. List<UserRoleLanguageConfigDTO >? languageConfigs,
  105. DateTime? createTime,
  106. DateTime? updateTime,
  107. }) : super(
  108. roleCode: roleCode,
  109. roleName: roleName,
  110. description: description,
  111. languageConfigs: languageConfigs,
  112. createTime: createTime,
  113. updateTime: updateTime,
  114. );
  115. factory RoleDTO.fromJson(Map<String, dynamic> map) {
  116. return RoleDTO(
  117. roleShowType: RoleShowTypeEnum.values.firstWhere((e) => e.index == map['RoleShowType']),
  118. iConUrl: map['IConUrl'],
  119. colorStart: map['ColorStart'],
  120. colorEnd: map['ColorEnd'],
  121. roleQualification: RoleQualificationEnum.values.firstWhere((e) => e.index == map['RoleQualification']),
  122. userGroupCode: map['UserGroupCode'],
  123. fieldShowType: RoleShowTypeEnum.values.firstWhere((e) => e.index == map['FieldShowType']),
  124. fieldList: map['FieldList'] != null ? map['FieldList'].cast<String>().toList() : null,
  125. roleCode: map['RoleCode'],
  126. roleName: map['RoleName'],
  127. description: map['Description'],
  128. languageConfigs: map['LanguageConfigs'] != null ? (map['LanguageConfigs'] as List).map((e)=>UserRoleLanguageConfigDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  129. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  130. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  131. );
  132. }
  133. Map<String, dynamic> toJson() {
  134. final map = super.toJson();
  135. map['RoleShowType'] = roleShowType.index;
  136. if(iConUrl != null)
  137. map['IConUrl'] = iConUrl;
  138. if(colorStart != null)
  139. map['ColorStart'] = colorStart;
  140. if(colorEnd != null)
  141. map['ColorEnd'] = colorEnd;
  142. map['RoleQualification'] = roleQualification.index;
  143. if(userGroupCode != null)
  144. map['UserGroupCode'] = userGroupCode;
  145. map['FieldShowType'] = fieldShowType.index;
  146. if(fieldList != null)
  147. map['FieldList'] = fieldList;
  148. return map;
  149. }
  150. }
  151. class GetRoleByCodeRequest extends TokenRequest{
  152. String? roleCode;
  153. String? language;
  154. GetRoleByCodeRequest({
  155. this.roleCode,
  156. this.language,
  157. String? token,
  158. }) : super(
  159. token: token,
  160. );
  161. factory GetRoleByCodeRequest.fromJson(Map<String, dynamic> map) {
  162. return GetRoleByCodeRequest(
  163. roleCode: map['RoleCode'],
  164. language: map['Language'],
  165. token: map['Token'],
  166. );
  167. }
  168. Map<String, dynamic> toJson() {
  169. final map = super.toJson();
  170. if(roleCode != null)
  171. map['RoleCode'] = roleCode;
  172. if(language != null)
  173. map['Language'] = language;
  174. return map;
  175. }
  176. }
  177. class FindDefaultRolesRequest extends TokenRequest{
  178. String? organizationCode;
  179. String? language;
  180. FindDefaultRolesRequest({
  181. this.organizationCode,
  182. this.language,
  183. String? token,
  184. }) : super(
  185. token: token,
  186. );
  187. factory FindDefaultRolesRequest.fromJson(Map<String, dynamic> map) {
  188. return FindDefaultRolesRequest(
  189. organizationCode: map['OrganizationCode'],
  190. language: map['Language'],
  191. token: map['Token'],
  192. );
  193. }
  194. Map<String, dynamic> toJson() {
  195. final map = super.toJson();
  196. if(organizationCode != null)
  197. map['OrganizationCode'] = organizationCode;
  198. if(language != null)
  199. map['Language'] = language;
  200. return map;
  201. }
  202. }
  203. class FindAuthenticationRolesRequest extends TokenRequest{
  204. String? language;
  205. FindAuthenticationRolesRequest({
  206. this.language,
  207. String? token,
  208. }) : super(
  209. token: token,
  210. );
  211. factory FindAuthenticationRolesRequest.fromJson(Map<String, dynamic> map) {
  212. return FindAuthenticationRolesRequest(
  213. language: map['Language'],
  214. token: map['Token'],
  215. );
  216. }
  217. Map<String, dynamic> toJson() {
  218. final map = super.toJson();
  219. if(language != null)
  220. map['Language'] = language;
  221. return map;
  222. }
  223. }