SystemUser.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System.ComponentModel.DataAnnotations;
  2. using AntDesign;
  3. using SqlSugar;
  4. using static EasyTemplate.Tool.Entity.PublicEnum;
  5. namespace EasyTemplate.Tool.Entity;
  6. /// <summary>
  7. /// 系统用户
  8. /// </summary>
  9. [SugarTable(null, "系统用户")]
  10. public class SystemUser: EntityBase
  11. {
  12. /// <summary>
  13. /// 账号
  14. /// </summary>
  15. [SugarColumn(ColumnDescription = "账号", Length = 32, IsNullable = true)]
  16. public string Account { get; set; }
  17. /// <summary>
  18. /// 密码
  19. /// </summary>
  20. [SugarColumn(ColumnDescription = "密码", Length = 32, IsNullable = true)]
  21. public string Password { get; set; }
  22. /// <summary>
  23. /// 昵称
  24. /// </summary>
  25. [SugarColumn(ColumnDescription = "昵称", Length = 32, IsNullable = true)]
  26. public string NickName { get; set; }
  27. /// <summary>
  28. /// 头像
  29. /// </summary>
  30. [SugarColumn(ColumnDescription = "头像", DefaultValue = "/assets/default_avatar.png", IsNullable = true)]
  31. public string Avatar { get; set; }
  32. /// <summary>
  33. /// 手机
  34. /// </summary>
  35. [SugarColumn(ColumnDescription = "手机", IsNullable = true)]
  36. public string Mobile { get; set; }
  37. /// <summary>
  38. /// 邮箱
  39. /// </summary>
  40. [SugarColumn(ColumnDescription = "邮箱", IsNullable = true)]
  41. public string Email { get; set; }
  42. /// <summary>
  43. /// 地区id
  44. /// </summary>
  45. [SugarColumn(ColumnDescription = "地区id", IsNullable = true)]
  46. public string AreaIds { get; set; }
  47. /// <summary>
  48. /// 地址
  49. /// </summary>
  50. [SugarColumn(ColumnDescription = "地址", IsNullable = true)]
  51. public string Address { get; set; }
  52. /// <summary>
  53. /// 签名
  54. /// </summary>
  55. [SugarColumn(ColumnDescription = "签名", IsNullable = true)]
  56. public string Signature { get; set; }
  57. /// <summary>
  58. /// 角色id
  59. /// </summary>
  60. [SugarColumn(ColumnDescription = "角色id", IsNullable = true)]
  61. public long RoleId { get; set; }
  62. /// <summary>
  63. /// 部门id
  64. /// </summary>
  65. [SugarColumn(ColumnDescription = "部门id", IsNullable = true)]
  66. public long DepartmentId { get; set; }
  67. /// <summary>
  68. /// 是否启用
  69. /// </summary>
  70. [SugarColumn(ColumnDescription = "是否启用", DefaultValue ="1", IsNullable = true)]
  71. public bool Enabled { get; set; }
  72. /// <summary>
  73. /// 绑定谷歌账号
  74. /// </summary>
  75. [SugarColumn(ColumnDescription = "绑定谷歌账号", IsNullable = true)]
  76. public string BindingGoogle { get; set; }
  77. /// <summary>
  78. /// 绑定X账号
  79. /// </summary>
  80. [SugarColumn(ColumnDescription = "绑定X账号", IsNullable = true)]
  81. public string BindingX { get; set; }
  82. /// <summary>
  83. /// 绑定Facebook账号
  84. /// </summary>
  85. [SugarColumn(ColumnDescription = "绑定Facebook账号", IsNullable = true)]
  86. public string BindingFacebook { get; set; }
  87. /// <summary>
  88. /// 过期时间
  89. /// </summary>
  90. [SugarColumn(IsIgnore = true)]
  91. public DateTime Expired { get; set; }
  92. /// <summary>
  93. /// 确认密码
  94. /// </summary>
  95. [SugarColumn(IsIgnore = true)]
  96. public string ConfirmPassword { get; set; }
  97. /// <summary>
  98. /// 角色名称
  99. /// </summary>
  100. [SugarColumn(IsIgnore = true)]
  101. public string RoleName { get; set; }
  102. /// <summary>
  103. /// 部门名称
  104. /// </summary>
  105. [SugarColumn(IsIgnore = true)]
  106. public string DepartmentName { get; set; }
  107. /// <summary>
  108. /// 最后一个区域id,用于级联回显
  109. /// </summary>
  110. [SugarColumn(IsIgnore = true)]
  111. public string LastAreadId { get; set; }
  112. /// <summary>
  113. /// 地区全拼
  114. /// </summary>
  115. [SugarColumn(IsIgnore = true)]
  116. public string Area { get; set; }
  117. }
  118. public class SystemUserSeedData : ISeedData<SystemUser>
  119. {
  120. public IEnumerable<SystemUser> Generate()
  121. =>
  122. [
  123. new SystemUser() { Id = 1, Account = "admin", Password = "e10adc3949ba59abbe56e057f20f883e", Enabled=true, Avatar="/assets/default_avatar.png", NickName="超级管理员", Mobile="13789756548", AreaIds="37,82,85", Email="asdfkuhuasd@163.com", RoleId=1, DepartmentId=1, CreateTime = DateTime.Now },
  124. new SystemUser() { Id = 2, Account = "david111", Password = "e10adc3949ba59abbe56e057f20f883e", Enabled=true, Avatar="/assets/default_avatar.png", NickName="用户1", Mobile="15364878984", Email="12312323@sina.com", RoleId=2, DepartmentId=1,CreateTime = DateTime.Now },
  125. ];
  126. }
  127. public class LoginInput
  128. {
  129. [Required] public string Account { get; set; }
  130. [Required] public string Password { get; set; }
  131. public string Mobile { get; set; }
  132. public string Captcha { get; set; }
  133. public string VerifyCode { get; set; }
  134. public string LoginType { get; set; }
  135. public bool AutoLogin { get; set; }
  136. }