using Mapster; using MiniExcelLibs.Attributes; using Vo; namespace Model { /// /// 用户表 sys_user /// [SugarTable("sys_user", "用户表")] [Tenant("0")] public class SysUser { /// /// 用户ID /// [SugarColumn(ColumnDescription = "用户ID", IsPrimaryKey = true, IsIdentity = true, ColumnName = "user_id")] public long userId { get; set; } /// /// 用户名 /// [SugarColumn(ColumnDescription = "用户名", Length = 64, ColumnName = "username")] public string username { get; set; } /// /// 密码 /// [SugarColumn(ColumnDescription = "密码", Length = 255, ColumnName = "password")] public string password { get; set; } /// /// 盐值 /// [SugarColumn(ColumnDescription = "盐值", Length = 255, ColumnName = "salt")] public string salt { get; set; } /// /// 电话号码 /// [SugarColumn(ColumnDescription = "电话号码", Length = 20, ColumnName = "phone")] public string phone { get; set; } /// /// 头像 /// [SugarColumn(ColumnDescription = "头像", Length = 255, ColumnName = "avatar")] public string avatar { get; set; } /// /// 昵称 /// [SugarColumn(ColumnDescription = "昵称", Length = 64, ColumnName = "nickname")] public string nickname { get; set; } /// /// 姓名 /// [SugarColumn(ColumnDescription = "姓名", Length = 64, ColumnName = "name")] public string name { get; set; } /// /// 邮箱地址 /// [SugarColumn(ColumnDescription = "邮箱地址", Length = 128, ColumnName = "email")] public string email { get; set; } /// /// 所属部门ID /// [SugarColumn(ColumnDescription = "所属部门ID", ColumnName = "dept_id")] public long deptId { get; set; } /// /// 创建人 /// [SugarColumn(ColumnDescription = "创建人", Length = 64, ColumnName = "create_by")] public string CreateBy { get; set; } /// /// 修改人 /// [SugarColumn(ColumnDescription = "修改人", Length = 64, ColumnName = "update_by")] public string UpdateBy { get; set; } /// /// 创建时间 /// [SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time")] public DateTime? CreateTime { get; set; } /// /// 修改时间 /// [SugarColumn(ColumnDescription = "修改时间", ColumnName = "update_time")] public DateTime? UpdateTime { get; set; } /// /// 锁定标记,0未锁定,9已锁定 /// [SugarColumn(ColumnDescription = "锁定标记,0未锁定,9已锁定", Length = 1, ColumnName = "lock_flag")] public string LockFlag { get; set; } /// /// 删除标记,0未删除,1已删除 /// [SugarColumn(ColumnDescription = "删除标记,0未删除,1已删除", Length = 1, ColumnName = "del_flag")] public string DelFlag { get; set; } /// /// 微信登录openId /// [SugarColumn(ColumnDescription = "微信登录openId", Length = 32, ColumnName = "wx_openid")] public string WxOpenid { get; set; } /// /// 小程序openId /// [SugarColumn(ColumnDescription = "小程序openId", Length = 32, ColumnName = "mini_openid")] public string MiniOpenid { get; set; } /// /// QQ openId /// [SugarColumn(ColumnDescription = "QQ openId", Length = 32, ColumnName = "qq_openid")] public string QqOpenid { get; set; } /// /// 码云标识 /// [SugarColumn(ColumnDescription = "码云标识", Length = 100, ColumnName = "gitee_login")] public string GiteeLogin { get; set; } /// /// 开源中国标识 /// [SugarColumn(ColumnDescription = "开源中国标识", Length = 100, ColumnName = "osc_id")] public string OscId { get; set; } /// /// 角色id集合 /// [SugarColumn(IsIgnore = true)] [ExcelIgnore] public long[] RoleIds { get; set; } /// /// 岗位集合 /// [SugarColumn(IsIgnore = true)] [ExcelIgnore] public int[] PostIds { get; set; } [SugarColumn(IsIgnore = true)] public List RoleList { get; set; } [SugarColumn(IsIgnore = true)] public List PostList { get; set; } [SugarColumn(IsIgnore = true)] public DeptFeignVo deptInfo { get { return deptJoin.Adapt(); } } [SugarColumn(IsIgnore = true)] [Navigate(NavigateType.OneToOne, nameof(deptId))] public SysDept deptJoin { get; set; } public bool IsAdmin() { return IsAdmin(userId); } public static bool IsAdmin(long userId) { return 1 == userId; } [SugarColumn(IsIgnore = true)] public string deptName { get; set; } } }