123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- import 'liveConsultation.m.dart';
- import 'notification.m.dart';
- import 'device.m.dart';
- enum DictionaryTypeEnum2 {
- Default,
- Label,
- Menu,
- DynamicType,
- }
- class CreateDictionaryRequest extends TokenRequest{
- String? code;
- String? key;
- String? name;
- DictionaryTypeEnum2 type;
- String? description;
- CreateDictionaryRequest({
- this.code,
- this.key,
- this.name,
- this.type = DictionaryTypeEnum2.Default,
- this.description,
- String? token,
- }) : super(
- token: token,
- );
- factory CreateDictionaryRequest.fromJson(Map<String, dynamic> map) {
- return CreateDictionaryRequest(
- code: map['Code'],
- key: map['Key'],
- name: map['Name'],
- type: DictionaryTypeEnum2.values.firstWhere((e) => e.index == map['Type']),
- description: map['Description'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- if (key != null)
- map['Key'] = key;
- if (name != null)
- map['Name'] = name;
- map['Type'] = type.index;
- if (description != null)
- map['Description'] = description;
- return map;
- }
- }
- class DictionaryDTO2 extends BaseDTO{
- String? code;
- String? key;
- String? name;
- DictionaryTypeEnum2 type;
- String? description;
- DictionaryDTO2({
- this.code,
- this.key,
- this.name,
- this.type = DictionaryTypeEnum2.Default,
- this.description,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- createTime: createTime,
- updateTime: updateTime,
- );
- factory DictionaryDTO2.fromJson(Map<String, dynamic> map) {
- return DictionaryDTO2(
- code: map['Code'],
- key: map['Key'],
- name: map['Name'],
- type: DictionaryTypeEnum2.values.firstWhere((e) => e.index == map['Type']),
- 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 (code != null)
- map['Code'] = code;
- if (key != null)
- map['Key'] = key;
- if (name != null)
- map['Name'] = name;
- map['Type'] = type.index;
- if (description != null)
- map['Description'] = description;
- return map;
- }
- }
- class GetDictionaryRequest extends TokenRequest{
- String? code;
- GetDictionaryRequest({
- this.code,
- String? token,
- }) : super(
- token: token,
- );
- factory GetDictionaryRequest.fromJson(Map<String, dynamic> map) {
- return GetDictionaryRequest(
- code: map['Code'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- return map;
- }
- }
- class GetDictionaryByKeyRequest extends TokenRequest{
- String? key;
- String? value;
- GetDictionaryByKeyRequest({
- this.key,
- this.value,
- String? token,
- }) : super(
- token: token,
- );
- factory GetDictionaryByKeyRequest.fromJson(Map<String, dynamic> map) {
- return GetDictionaryByKeyRequest(
- key: map['Key'],
- value: map['Value'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (key != null)
- map['Key'] = key;
- if (value != null)
- map['Value'] = value;
- return map;
- }
- }
- class DictionaryPageRequest extends PageRequest{
- DictionaryPageRequest({
- int pageIndex = 0,
- int pageSize = 0,
- String? token,
- }) : super(
- pageIndex: pageIndex,
- pageSize: pageSize,
- token: token,
- );
- factory DictionaryPageRequest.fromJson(Map<String, dynamic> map) {
- return DictionaryPageRequest(
- pageIndex: map['PageIndex'],
- pageSize: map['PageSize'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- return map;
- }
- }
- class RemoveDictionaryRequest extends TokenRequest{
- String? code;
- RemoveDictionaryRequest({
- this.code,
- String? token,
- }) : super(
- token: token,
- );
- factory RemoveDictionaryRequest.fromJson(Map<String, dynamic> map) {
- return RemoveDictionaryRequest(
- code: map['Code'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- return map;
- }
- }
- class GetDictionaryListRequest extends TokenRequest{
- List<String>? codes;
- GetDictionaryListRequest({
- this.codes,
- String? token,
- }) : super(
- token: token,
- );
- factory GetDictionaryListRequest.fromJson(Map<String, dynamic> map) {
- return GetDictionaryListRequest(
- codes: map['Codes']?.cast<String>().toList(),
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (codes != null)
- map['Codes'] = codes;
- return map;
- }
- }
- class UpdateDictionaryRequest extends TokenRequest{
- String? code;
- String? key;
- String? name;
- DictionaryTypeEnum2 type;
- String? description;
- UpdateDictionaryRequest({
- this.code,
- this.key,
- this.name,
- this.type = DictionaryTypeEnum2.Default,
- this.description,
- String? token,
- }) : super(
- token: token,
- );
- factory UpdateDictionaryRequest.fromJson(Map<String, dynamic> map) {
- return UpdateDictionaryRequest(
- code: map['Code'],
- key: map['Key'],
- name: map['Name'],
- type: DictionaryTypeEnum2.values.firstWhere((e) => e.index == map['Type']),
- description: map['Description'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (code != null)
- map['Code'] = code;
- if (key != null)
- map['Key'] = key;
- if (name != null)
- map['Name'] = name;
- map['Type'] = type.index;
- if (description != null)
- map['Description'] = description;
- return map;
- }
- }
- class DictionaryWithUnitDTO extends DictionaryDTO2{
- String? unit;
- DictionaryWithUnitDTO({
- this.unit,
- String? code,
- String? key,
- String? name,
- DictionaryTypeEnum2 type = DictionaryTypeEnum2.Default,
- String? description,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- code: code,
- key: key,
- name: name,
- type: type,
- description: description,
- createTime: createTime,
- updateTime: updateTime,
- );
- factory DictionaryWithUnitDTO.fromJson(Map<String, dynamic> map) {
- return DictionaryWithUnitDTO(
- unit: map['Unit'],
- code: map['Code'],
- key: map['Key'],
- name: map['Name'],
- type: DictionaryTypeEnum2.values.firstWhere((e) => e.index == map['Type']),
- 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 (unit != null)
- map['Unit'] = unit;
- return map;
- }
- }
- class GetDictionaryNameAndUnitByKeysRequest extends TokenRequest{
- List<String>? keys;
- GetDictionaryNameAndUnitByKeysRequest({
- this.keys,
- String? token,
- }) : super(
- token: token,
- );
- factory GetDictionaryNameAndUnitByKeysRequest.fromJson(Map<String, dynamic> map) {
- return GetDictionaryNameAndUnitByKeysRequest(
- keys: map['Keys']?.cast<String>().toList(),
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (keys != null)
- map['Keys'] = keys;
- return map;
- }
- }
|