vitalUserFeature.m.dart 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. import 'liveConsultation.m.dart';
  2. import 'notification.m.dart';
  3. import 'device.m.dart';
  4. enum ApplicationTypeEnum {
  5. Web,
  6. App,
  7. }
  8. enum FeatureTypeEnum {
  9. Menu,
  10. Operation,
  11. }
  12. class CreateUserFeatureRequest extends TokenRequest{
  13. String? code;
  14. String? featureName;
  15. String? featureShowName;
  16. String? description;
  17. String? fatherCode;
  18. int sort;
  19. ApplicationTypeEnum appType;
  20. FeatureTypeEnum featureType;
  21. CreateUserFeatureRequest({
  22. this.code,
  23. this.featureName,
  24. this.featureShowName,
  25. this.description,
  26. this.fatherCode,
  27. this.sort = 0,
  28. this.appType = ApplicationTypeEnum.Web,
  29. this.featureType = FeatureTypeEnum.Menu,
  30. String? token,
  31. }) : super(
  32. token: token,
  33. );
  34. factory CreateUserFeatureRequest.fromJson(Map<String, dynamic> map) {
  35. return CreateUserFeatureRequest(
  36. code: map['Code'],
  37. featureName: map['FeatureName'],
  38. featureShowName: map['FeatureShowName'],
  39. description: map['Description'],
  40. fatherCode: map['FatherCode'],
  41. sort: map['Sort'],
  42. appType: ApplicationTypeEnum.values.firstWhere((e) => e.index == map['AppType']),
  43. featureType: FeatureTypeEnum.values.firstWhere((e) => e.index == map['FeatureType']),
  44. token: map['Token'],
  45. );
  46. }
  47. Map<String, dynamic> toJson() {
  48. final map = super.toJson();
  49. if (code != null)
  50. map['Code'] = code;
  51. if (featureName != null)
  52. map['FeatureName'] = featureName;
  53. if (featureShowName != null)
  54. map['FeatureShowName'] = featureShowName;
  55. if (description != null)
  56. map['Description'] = description;
  57. if (fatherCode != null)
  58. map['FatherCode'] = fatherCode;
  59. map['Sort'] = sort;
  60. map['AppType'] = appType.index;
  61. map['FeatureType'] = featureType.index;
  62. return map;
  63. }
  64. }
  65. class UserFeatureDTO extends BaseDTO{
  66. String? code;
  67. String? featureName;
  68. String? featureShowName;
  69. String? description;
  70. String? fatherCode;
  71. int sort;
  72. ApplicationTypeEnum appType;
  73. FeatureTypeEnum featureType;
  74. UserFeatureDTO({
  75. this.code,
  76. this.featureName,
  77. this.featureShowName,
  78. this.description,
  79. this.fatherCode,
  80. this.sort = 0,
  81. this.appType = ApplicationTypeEnum.Web,
  82. this.featureType = FeatureTypeEnum.Menu,
  83. DateTime? createTime,
  84. DateTime? updateTime,
  85. }) : super(
  86. createTime: createTime,
  87. updateTime: updateTime,
  88. );
  89. factory UserFeatureDTO.fromJson(Map<String, dynamic> map) {
  90. return UserFeatureDTO(
  91. code: map['Code'],
  92. featureName: map['FeatureName'],
  93. featureShowName: map['FeatureShowName'],
  94. description: map['Description'],
  95. fatherCode: map['FatherCode'],
  96. sort: map['Sort'],
  97. appType: ApplicationTypeEnum.values.firstWhere((e) => e.index == map['AppType']),
  98. featureType: FeatureTypeEnum.values.firstWhere((e) => e.index == map['FeatureType']),
  99. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  100. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  101. );
  102. }
  103. Map<String, dynamic> toJson() {
  104. final map = super.toJson();
  105. if (code != null)
  106. map['Code'] = code;
  107. if (featureName != null)
  108. map['FeatureName'] = featureName;
  109. if (featureShowName != null)
  110. map['FeatureShowName'] = featureShowName;
  111. if (description != null)
  112. map['Description'] = description;
  113. if (fatherCode != null)
  114. map['FatherCode'] = fatherCode;
  115. map['Sort'] = sort;
  116. map['AppType'] = appType.index;
  117. map['FeatureType'] = featureType.index;
  118. return map;
  119. }
  120. }
  121. class GetUserFeatureRequest extends TokenRequest{
  122. String? code;
  123. GetUserFeatureRequest({
  124. this.code,
  125. String? token,
  126. }) : super(
  127. token: token,
  128. );
  129. factory GetUserFeatureRequest.fromJson(Map<String, dynamic> map) {
  130. return GetUserFeatureRequest(
  131. code: map['Code'],
  132. token: map['Token'],
  133. );
  134. }
  135. Map<String, dynamic> toJson() {
  136. final map = super.toJson();
  137. if (code != null)
  138. map['Code'] = code;
  139. return map;
  140. }
  141. }
  142. class GetUserFeatureByKeyRequest extends TokenRequest{
  143. String? key;
  144. String? value;
  145. GetUserFeatureByKeyRequest({
  146. this.key,
  147. this.value,
  148. String? token,
  149. }) : super(
  150. token: token,
  151. );
  152. factory GetUserFeatureByKeyRequest.fromJson(Map<String, dynamic> map) {
  153. return GetUserFeatureByKeyRequest(
  154. key: map['Key'],
  155. value: map['Value'],
  156. token: map['Token'],
  157. );
  158. }
  159. Map<String, dynamic> toJson() {
  160. final map = super.toJson();
  161. if (key != null)
  162. map['Key'] = key;
  163. if (value != null)
  164. map['Value'] = value;
  165. return map;
  166. }
  167. }
  168. class UserFeaturePageRequest extends PageRequest{
  169. UserFeaturePageRequest({
  170. int pageIndex = 0,
  171. int pageSize = 0,
  172. String? token,
  173. }) : super(
  174. pageIndex: pageIndex,
  175. pageSize: pageSize,
  176. token: token,
  177. );
  178. factory UserFeaturePageRequest.fromJson(Map<String, dynamic> map) {
  179. return UserFeaturePageRequest(
  180. pageIndex: map['PageIndex'],
  181. pageSize: map['PageSize'],
  182. token: map['Token'],
  183. );
  184. }
  185. Map<String, dynamic> toJson() {
  186. final map = super.toJson();
  187. return map;
  188. }
  189. }
  190. class RemoveUserFeatureRequest extends TokenRequest{
  191. String? code;
  192. RemoveUserFeatureRequest({
  193. this.code,
  194. String? token,
  195. }) : super(
  196. token: token,
  197. );
  198. factory RemoveUserFeatureRequest.fromJson(Map<String, dynamic> map) {
  199. return RemoveUserFeatureRequest(
  200. code: map['Code'],
  201. token: map['Token'],
  202. );
  203. }
  204. Map<String, dynamic> toJson() {
  205. final map = super.toJson();
  206. if (code != null)
  207. map['Code'] = code;
  208. return map;
  209. }
  210. }
  211. class GetUserFeatureListRequest extends TokenRequest{
  212. List<String>? codes;
  213. GetUserFeatureListRequest({
  214. this.codes,
  215. String? token,
  216. }) : super(
  217. token: token,
  218. );
  219. factory GetUserFeatureListRequest.fromJson(Map<String, dynamic> map) {
  220. return GetUserFeatureListRequest(
  221. codes: map['Codes']?.cast<String>().toList(),
  222. token: map['Token'],
  223. );
  224. }
  225. Map<String, dynamic> toJson() {
  226. final map = super.toJson();
  227. if (codes != null)
  228. map['Codes'] = codes;
  229. return map;
  230. }
  231. }
  232. class UpdateUserFeatureRequest extends TokenRequest{
  233. String? code;
  234. String? featureName;
  235. String? featureShowName;
  236. String? description;
  237. String? fatherCode;
  238. int sort;
  239. ApplicationTypeEnum appType;
  240. FeatureTypeEnum featureType;
  241. UpdateUserFeatureRequest({
  242. this.code,
  243. this.featureName,
  244. this.featureShowName,
  245. this.description,
  246. this.fatherCode,
  247. this.sort = 0,
  248. this.appType = ApplicationTypeEnum.Web,
  249. this.featureType = FeatureTypeEnum.Menu,
  250. String? token,
  251. }) : super(
  252. token: token,
  253. );
  254. factory UpdateUserFeatureRequest.fromJson(Map<String, dynamic> map) {
  255. return UpdateUserFeatureRequest(
  256. code: map['Code'],
  257. featureName: map['FeatureName'],
  258. featureShowName: map['FeatureShowName'],
  259. description: map['Description'],
  260. fatherCode: map['FatherCode'],
  261. sort: map['Sort'],
  262. appType: ApplicationTypeEnum.values.firstWhere((e) => e.index == map['AppType']),
  263. featureType: FeatureTypeEnum.values.firstWhere((e) => e.index == map['FeatureType']),
  264. token: map['Token'],
  265. );
  266. }
  267. Map<String, dynamic> toJson() {
  268. final map = super.toJson();
  269. if (code != null)
  270. map['Code'] = code;
  271. if (featureName != null)
  272. map['FeatureName'] = featureName;
  273. if (featureShowName != null)
  274. map['FeatureShowName'] = featureShowName;
  275. if (description != null)
  276. map['Description'] = description;
  277. if (fatherCode != null)
  278. map['FatherCode'] = fatherCode;
  279. map['Sort'] = sort;
  280. map['AppType'] = appType.index;
  281. map['FeatureType'] = featureType.index;
  282. return map;
  283. }
  284. }