123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- import 'package:json_annotation/json_annotation.dart';
- part 'user_rsp.g.dart';
- @JsonSerializable(genericArgumentFactories: true)
- class UserRsp {
- /*
- {
- "id": 1,
- "username": "admin",
- "nickname": "超级管理员",
- "email": "aoteman@126.com",
- "mobile": "15612345678",
- "sex": 1,
- "avatar": "http://127.0.0.1:48080/admin-api/infra/file/4/get/37e56010ecbee472cdd821ac4b608e151e62a74d9633f15d085aee026eedeb60.png",
- "loginIp": "210.12.51.197",
- "loginDate": 1708417207000,
- "createTime": 1609837427000,
- "roles": [
- {
- "id": 1,
- "name": "超级管理员"
- }
- ],
- "dept": {
- "id": 3010,
- "name": "国家局",
- "parentId": 0,
- "tyshxydm": null,
- "isRoot": null
- },
- "posts": [
- {
- "id": 1,
- "name": "董事长"
- }
- ],
- "socialUsers": []
- }
- */
- final num? id;
- final String? username;
- final String? nickname;
- final String? email;
- final String? mobile;
- final num? sex;
- final String? avatar;
- final String? loginIp;
- final num? loginDate;
- final num? createTime;
- final List<EnumRsp>? roles;
- final DepartmentRsp? dept;
- final List<EnumRsp>? posts;
- const UserRsp({
- this.id,
- this.username,
- this.nickname,
- this.email,
- this.mobile,
- this.sex,
- this.avatar,
- this.loginIp,
- this.loginDate,
- this.createTime,
- this.roles,
- this.dept,
- this.posts,
- });
- factory UserRsp.fromJson(Map<String, dynamic> json) => _$UserRspFromJson(json);
- Map<String, dynamic> toJson() => _$UserRspToJson(this);
- String? getMobile() {
- if (mobile == null) return null;
- var start = mobile!.substring(0, 3);
- var end = mobile!.substring(mobile!.length - 3);
- return '$start*****$end';
- }
- }
- @JsonSerializable(genericArgumentFactories: true)
- class DepartmentRsp {
- final num? id;
- final String? name;
- final num? parentId;
- const DepartmentRsp({
- this.id,
- this.name,
- this.parentId,
- });
- factory DepartmentRsp.fromJson(Map<String, dynamic> json) => _$DepartmentRspFromJson(json);
- Map<String, dynamic> toJson() => _$DepartmentRspToJson(this);
- }
- @JsonSerializable(genericArgumentFactories: true)
- class EnumRsp {
- final num? id;
- final String? name;
- const EnumRsp({
- this.id,
- this.name,
- });
- factory EnumRsp.fromJson(Map<String, dynamic> json) => _$EnumRspFromJson(json);
- Map<String, dynamic> toJson() => _$EnumRspToJson(this);
- }
|