role.m.dart 6.2 KB

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