role.m.dart 6.2 KB

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