123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- import 'connect.m.dart';
- import 'authentication.m.dart';
- class BaseRoleDTO extends BaseDTO{
- String? roleCode;
- String? roleName;
- String? description;
- BaseRoleDTO({
- this.roleCode,
- this.roleName,
- this.description,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- createTime: createTime,
- updateTime: updateTime,
- );
- factory BaseRoleDTO.fromJson(Map<String, dynamic> map) {
- return BaseRoleDTO(
- roleCode: map['RoleCode'],
- roleName: map['RoleName'],
- description: map['Description'],
- createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
- updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if(roleCode != null)
- map['RoleCode'] = roleCode;
- if(roleName != null)
- map['RoleName'] = roleName;
- if(description != null)
- map['Description'] = description;
- return map;
- }
- }
- enum RoleShowTypeEnum {
- NotShow,
- ISShow,
- }
- enum RoleQualificationEnum {
- NoNeed,
- ID,
- DocLicense,
- Both,
- }
- class RoleDTO extends BaseRoleDTO{
- RoleShowTypeEnum roleShowType;
- String? iConUrl;
- String? colorStart;
- String? colorEnd;
- RoleQualificationEnum roleQualification;
- String? userGroupCode;
- RoleDTO({
- this.roleShowType = RoleShowTypeEnum.NotShow,
- this.iConUrl,
- this.colorStart,
- this.colorEnd,
- this.roleQualification = RoleQualificationEnum.NoNeed,
- this.userGroupCode,
- String? roleCode,
- String? roleName,
- String? description,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- roleCode: roleCode,
- roleName: roleName,
- description: description,
- createTime: createTime,
- updateTime: updateTime,
- );
- factory RoleDTO.fromJson(Map<String, dynamic> map) {
- return RoleDTO(
- roleShowType: RoleShowTypeEnum.values.firstWhere((e) => e.index == map['RoleShowType']),
- iConUrl: map['IConUrl'],
- colorStart: map['ColorStart'],
- colorEnd: map['ColorEnd'],
- roleQualification: RoleQualificationEnum.values.firstWhere((e) => e.index == map['RoleQualification']),
- userGroupCode: map['UserGroupCode'],
- roleCode: map['RoleCode'],
- roleName: map['RoleName'],
- description: map['Description'],
- createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
- updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- map['RoleShowType'] = roleShowType.index;
- if(iConUrl != null)
- map['IConUrl'] = iConUrl;
- if(colorStart != null)
- map['ColorStart'] = colorStart;
- if(colorEnd != null)
- map['ColorEnd'] = colorEnd;
- map['RoleQualification'] = roleQualification.index;
- if(userGroupCode != null)
- map['UserGroupCode'] = userGroupCode;
- return map;
- }
- }
- class GetRoleByCodeRequest extends TokenRequest{
- String? roleCode;
- GetRoleByCodeRequest({
- this.roleCode,
- String? token,
- }) : super(
- token: token,
- );
- factory GetRoleByCodeRequest.fromJson(Map<String, dynamic> map) {
- return GetRoleByCodeRequest(
- roleCode: map['RoleCode'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if(roleCode != null)
- map['RoleCode'] = roleCode;
- return map;
- }
- }
- class FindDefaultRolesRequest extends TokenRequest{
- String? organizationCode;
- FindDefaultRolesRequest({
- this.organizationCode,
- String? token,
- }) : super(
- token: token,
- );
- factory FindDefaultRolesRequest.fromJson(Map<String, dynamic> map) {
- return FindDefaultRolesRequest(
- organizationCode: map['OrganizationCode'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if(organizationCode != null)
- map['OrganizationCode'] = organizationCode;
- return map;
- }
- }
- class FindAuthenticationRolesRequest extends TokenRequest{
- FindAuthenticationRolesRequest({
- String? token,
- }) : super(
- token: token,
- );
- factory FindAuthenticationRolesRequest.fromJson(Map<String, dynamic> map) {
- return FindAuthenticationRolesRequest(
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- return map;
- }
- }
|