123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- import 'package:fis_jsonrpc/utils.dart';
- class BaseDTO {
- DateTime? createTime;
- DateTime? updateTime;
- BaseDTO({
- this.createTime,
- this.updateTime,
- });
- factory BaseDTO.fromJson(Map<String, dynamic> map) {
- return BaseDTO(
- createTime:
- map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
- updateTime:
- map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = Map<String, dynamic>();
- if (createTime != null)
- map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
- if (updateTime != null)
- map['UpdateTime'] = JsonRpcUtils.dateFormat(updateTime!);
- return map;
- }
- }
- enum RoleShowTypeEnum {
- NotShow,
- ISShow,
- }
- enum RoleQualificationEnum {
- NoNeed,
- ID,
- DocLicense,
- Both,
- }
- class RoleDTO extends BaseDTO {
- String? roleCode;
- String? roleName;
- RoleShowTypeEnum roleShowType;
- String? description;
- String? iConUrl;
- String? colorStart;
- String? colorEnd;
- RoleQualificationEnum roleQualification;
- RoleDTO({
- this.roleCode,
- this.roleName,
- this.roleShowType = RoleShowTypeEnum.NotShow,
- this.description,
- this.iConUrl,
- this.colorStart,
- this.colorEnd,
- this.roleQualification = RoleQualificationEnum.NoNeed,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- createTime: createTime,
- updateTime: updateTime,
- );
- factory RoleDTO.fromJson(Map<String, dynamic> map) {
- return RoleDTO(
- roleCode: map['RoleCode'],
- roleName: map['RoleName'],
- roleShowType: RoleShowTypeEnum.values
- .firstWhere((e) => e.index == map['RoleShowType']),
- description: map['Description'],
- iConUrl: map['IConUrl'],
- colorStart: map['ColorStart'],
- colorEnd: map['ColorEnd'],
- roleQualification: RoleQualificationEnum.values
- .firstWhere((e) => e.index == map['RoleQualification']),
- 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;
- map['RoleShowType'] = roleShowType.index;
- if (description != null) map['Description'] = description;
- if (iConUrl != null) map['IConUrl'] = iConUrl;
- if (colorStart != null) map['ColorStart'] = colorStart;
- if (colorEnd != null) map['ColorEnd'] = colorEnd;
- map['RoleQualification'] = roleQualification.index;
- return map;
- }
- }
- class BaseRequest {
- BaseRequest();
- factory BaseRequest.fromJson(Map<String, dynamic> map) {
- return BaseRequest();
- }
- Map<String, dynamic> toJson() {
- final map = Map<String, dynamic>();
- return map;
- }
- }
- class TokenRequest extends BaseRequest {
- String? token;
- TokenRequest({
- this.token,
- }) : super();
- factory TokenRequest.fromJson(Map<String, dynamic> map) {
- return TokenRequest(
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (token != null) map['Token'] = token;
- 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 {
- String? organizationCode;
- FindAuthenticationRolesRequest({
- this.organizationCode,
- String? token,
- }) : super(
- token: token,
- );
- factory FindAuthenticationRolesRequest.fromJson(Map<String, dynamic> map) {
- return FindAuthenticationRolesRequest(
- organizationCode: map['OrganizationCode'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (organizationCode != null) map['OrganizationCode'] = organizationCode;
- return map;
- }
- }
|