import 'package:json_annotation/json_annotation.dart'; import 'package:lszlgl/model/num_converter.dart'; import 'package:lszlgl/model/string_converter.dart'; part 'user_rsp.g.dart'; @JsonSerializable(converters: [NumConverter(), StringConverter()]) 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? roles; final DepartmentRsp? dept; final List? 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 json) => _$UserRspFromJson(json); Map 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(converters: [NumConverter(), StringConverter()]) class DepartmentRsp { final num? id; final String? name; final num? parentId; const DepartmentRsp({ this.id, this.name, this.parentId, }); factory DepartmentRsp.fromJson(Map json) => _$DepartmentRspFromJson(json); Map toJson() => _$DepartmentRspToJson(this); } @JsonSerializable(converters: [NumConverter(), StringConverter()]) class EnumRsp { final num? id; final String? name; const EnumRsp({ this.id, this.name, }); factory EnumRsp.fromJson(Map json) => _$EnumRspFromJson(json); Map toJson() => _$EnumRspToJson(this); } @JsonSerializable(converters: [StringConverter(), NumConverter()]) class PersonRsp { /// ID num? id; /// 出生年月 String? csny; /// 年龄 num? age; /// 获得荣誉 String? hdry; /// 民族 num? minzu; /// 姓名 String? name; /// 牵头或参与科研项目 String? qthcykyxm; /// 企业编码 String? qybm; /// 账号角色 num? role; /// 是否从事行政管理 num? sfcsxzgl; /// 是否在编 num? sfzb; /// 学历 num? xueli; /// 账号 String? zhanghao; /// 职称 num? zhicheng; /// 职务 String? zhiwu; /// 专业 String? zhuanye; /// 政治面貌 党员/共青团员/群众/民主党派成员/无党派人士 num? zzmm; /// 在职学历 String? zzxl; /// 在职专业 String? zzzy; /// 企业基本信息主键ID num? zjBaseEnterpriseId; /// 机构名称 String? enterpriseName; /// 性别 num? sex; /// 系统用户id num? userId; /// 创建时间 String? createTime; /// 奖励情况 String? jlqk; /// 人员照片URL String? userPictureUrl; /// 用户详细信息 String? userName; /// 机构审批状态 num? flowStatus; PersonRsp({ this.id, this.csny, this.age, this.hdry, this.minzu, this.name, this.qthcykyxm, this.qybm, this.role, this.sfcsxzgl, this.sfzb, this.xueli, this.zhanghao, this.zhicheng, this.zhiwu, this.zhuanye, this.zzmm, this.zzxl, this.zzzy, this.zjBaseEnterpriseId, this.enterpriseName, this.sex, this.userId, this.createTime, this.jlqk, this.userPictureUrl, this.userName, this.flowStatus, }); factory PersonRsp.fromJson(Map json) => _$PersonRspFromJson(json); Map toJson() => _$PersonRspToJson(this); }