SysUser.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. using Mapster;
  2. using MiniExcelLibs.Attributes;
  3. using Vo;
  4. namespace Model
  5. {
  6. /// <summary>
  7. /// 用户表 sys_user
  8. /// </summary>
  9. [SugarTable("sys_user", "用户表")]
  10. [Tenant("0")]
  11. public class SysUser
  12. {
  13. /// <summary>
  14. /// 用户ID
  15. /// </summary>
  16. [SugarColumn(ColumnDescription = "用户ID", IsPrimaryKey = true, IsIdentity = true, ColumnName = "user_id")]
  17. public long userId { get; set; }
  18. /// <summary>
  19. /// 用户名
  20. /// </summary>
  21. [SugarColumn(ColumnDescription = "用户名", Length = 64, ColumnName = "username")]
  22. public string username { get; set; }
  23. /// <summary>
  24. /// 密码
  25. /// </summary>
  26. [SugarColumn(ColumnDescription = "密码", Length = 255, ColumnName = "password")]
  27. public string password { get; set; }
  28. /// <summary>
  29. /// 盐值
  30. /// </summary>
  31. [SugarColumn(ColumnDescription = "盐值", Length = 255, ColumnName = "salt")]
  32. public string salt { get; set; }
  33. /// <summary>
  34. /// 电话号码
  35. /// </summary>
  36. [SugarColumn(ColumnDescription = "电话号码", Length = 20, ColumnName = "phone")]
  37. public string phone { get; set; }
  38. /// <summary>
  39. /// 头像
  40. /// </summary>
  41. [SugarColumn(ColumnDescription = "头像", Length = 255, ColumnName = "avatar")]
  42. public string avatar { get; set; }
  43. /// <summary>
  44. /// 昵称
  45. /// </summary>
  46. [SugarColumn(ColumnDescription = "昵称", Length = 64, ColumnName = "nickname")]
  47. public string nickname { get; set; }
  48. /// <summary>
  49. /// 姓名
  50. /// </summary>
  51. [SugarColumn(ColumnDescription = "姓名", Length = 64, ColumnName = "name")]
  52. public string name { get; set; }
  53. /// <summary>
  54. /// 邮箱地址
  55. /// </summary>
  56. [SugarColumn(ColumnDescription = "邮箱地址", Length = 128, ColumnName = "email")]
  57. public string email { get; set; }
  58. /// <summary>
  59. /// 所属部门ID
  60. /// </summary>
  61. [SugarColumn(ColumnDescription = "所属部门ID", ColumnName = "dept_id")]
  62. public long deptId { get; set; }
  63. /// <summary>
  64. /// 创建人
  65. /// </summary>
  66. [SugarColumn(ColumnDescription = "创建人", Length = 64, ColumnName = "create_by")]
  67. public string CreateBy { get; set; }
  68. /// <summary>
  69. /// 修改人
  70. /// </summary>
  71. [SugarColumn(ColumnDescription = "修改人", Length = 64, ColumnName = "update_by")]
  72. public string UpdateBy { get; set; }
  73. /// <summary>
  74. /// 创建时间
  75. /// </summary>
  76. [SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time")]
  77. public DateTime? CreateTime { get; set; }
  78. /// <summary>
  79. /// 修改时间
  80. /// </summary>
  81. [SugarColumn(ColumnDescription = "修改时间", ColumnName = "update_time")]
  82. public DateTime? UpdateTime { get; set; }
  83. /// <summary>
  84. /// 锁定标记,0未锁定,9已锁定
  85. /// </summary>
  86. [SugarColumn(ColumnDescription = "锁定标记,0未锁定,9已锁定", Length = 1, ColumnName = "lock_flag")]
  87. public string LockFlag { get; set; }
  88. /// <summary>
  89. /// 删除标记,0未删除,1已删除
  90. /// </summary>
  91. [SugarColumn(ColumnDescription = "删除标记,0未删除,1已删除", Length = 1, ColumnName = "del_flag")]
  92. public string DelFlag { get; set; }
  93. /// <summary>
  94. /// 微信登录openId
  95. /// </summary>
  96. [SugarColumn(ColumnDescription = "微信登录openId", Length = 32, ColumnName = "wx_openid")]
  97. public string WxOpenid { get; set; }
  98. /// <summary>
  99. /// 小程序openId
  100. /// </summary>
  101. [SugarColumn(ColumnDescription = "小程序openId", Length = 32, ColumnName = "mini_openid")]
  102. public string MiniOpenid { get; set; }
  103. /// <summary>
  104. /// QQ openId
  105. /// </summary>
  106. [SugarColumn(ColumnDescription = "QQ openId", Length = 32, ColumnName = "qq_openid")]
  107. public string QqOpenid { get; set; }
  108. /// <summary>
  109. /// 码云标识
  110. /// </summary>
  111. [SugarColumn(ColumnDescription = "码云标识", Length = 100, ColumnName = "gitee_login")]
  112. public string GiteeLogin { get; set; }
  113. /// <summary>
  114. /// 开源中国标识
  115. /// </summary>
  116. [SugarColumn(ColumnDescription = "开源中国标识", Length = 100, ColumnName = "osc_id")]
  117. public string OscId { get; set; }
  118. /// <summary>
  119. /// 角色id集合
  120. /// </summary>
  121. [SugarColumn(IsIgnore = true)]
  122. [ExcelIgnore]
  123. public long[] RoleIds { get; set; }
  124. /// <summary>
  125. /// 岗位集合
  126. /// </summary>
  127. [SugarColumn(IsIgnore = true)]
  128. [ExcelIgnore]
  129. public int[] PostIds { get; set; }
  130. [SugarColumn(IsIgnore = true)]
  131. public List<SysRole> RoleList { get; set; }
  132. [SugarColumn(IsIgnore = true)]
  133. public List<SysPost> PostList { get; set; }
  134. [SugarColumn(IsIgnore = true)]
  135. public DeptFeignVo deptInfo
  136. {
  137. get
  138. {
  139. return deptJoin.Adapt<DeptFeignVo>();
  140. }
  141. }
  142. [SugarColumn(IsIgnore = true)]
  143. [Navigate(NavigateType.OneToOne, nameof(deptId))]
  144. public SysDept deptJoin { get; set; }
  145. public bool IsAdmin()
  146. {
  147. return IsAdmin(userId);
  148. }
  149. public static bool IsAdmin(long userId)
  150. {
  151. return 1 == userId;
  152. }
  153. [SugarColumn(IsIgnore = true)]
  154. public string deptName { get; set; }
  155. }
  156. }