SysUser.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using Furion.DatabaseAccessor;
  2. using Furion.JsonSerialization;
  3. using Microsoft.EntityFrameworkCore;
  4. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  5. using System;
  6. using System.ComponentModel.DataAnnotations;
  7. using System.ComponentModel.DataAnnotations.Schema;
  8. namespace YBEE.EQM.Core;
  9. /// <summary>
  10. /// 用户
  11. /// </summary>
  12. [Comment("用户")]
  13. public partial class SysUser : DEntityBase, IEntityTypeBuilder<SysUser>
  14. {
  15. /// <summary>
  16. /// 机构ID
  17. /// </summary>
  18. [Comment("机构ID")]
  19. [Required]
  20. public short SysOrgId { get; set; }
  21. /// <summary>
  22. /// 名称
  23. /// </summary>
  24. [Comment("名称")]
  25. [Required, StringLength(200)]
  26. public string Name { get; set; }
  27. /// <summary>
  28. /// 头像地址
  29. /// </summary>
  30. [Comment("头像地址")]
  31. [StringLength(500)]
  32. public string Avatar { get; set; }
  33. /// <summary>
  34. /// 手机
  35. /// </summary>
  36. [Comment("手机")]
  37. [StringLength(16)]
  38. public string Mobile { get; set; }
  39. /// <summary>
  40. /// 电子邮箱
  41. /// </summary>
  42. [Comment("电子邮箱")]
  43. [StringLength(200)]
  44. public string Email { get; set; }
  45. /// <summary>
  46. /// 工号
  47. /// </summary>
  48. [Comment("工号")]
  49. [StringLength(200)]
  50. public string JobNumber { get; set; }
  51. /// <summary>
  52. /// 备注
  53. /// </summary>
  54. [Comment("备注")]
  55. [StringLength(200)]
  56. public string Remark { get; set; }
  57. /// <summary>
  58. /// 登录名
  59. /// </summary>
  60. [Comment("登录名")]
  61. [Required, StringLength(50)]
  62. public string Account { get; set; }
  63. /// <summary>
  64. /// 密码
  65. /// </summary>
  66. [Comment("密码")]
  67. [Required, StringLength(100)]
  68. public string Password { get; set; }
  69. /// <summary>
  70. /// 是否已激活
  71. /// </summary>
  72. [Comment("是否已激活")]
  73. [Required]
  74. public bool IsActivated { get; set; } = false;
  75. /// <summary>
  76. /// 激活时间
  77. /// </summary>
  78. [Comment("激活时间")]
  79. public DateTime? ActivateTime { get; set; }
  80. /// <summary>
  81. /// 最后登录IP
  82. /// </summary>
  83. [Comment("最后登录IP")]
  84. [MaxLength(21)]
  85. public string LastLoginIp { get; set; }
  86. /// <summary>
  87. /// 最后登录时间
  88. /// </summary>
  89. [Comment("最后登录时间")]
  90. public DateTime? LastLoginTime { get; set; }
  91. /// <summary>
  92. /// 用户自定义配置
  93. /// </summary>
  94. [Comment("用户自定义配置")]
  95. [Column(TypeName = "json")]
  96. public string Config { get; set; } = "{}";
  97. /// <summary>
  98. /// 用户权限
  99. /// </summary>
  100. [Comment("用户权限")]
  101. [Column(TypeName = "json")]
  102. public string Permission { get; set; } = JSON.Serialize(new UserPermission());
  103. /// <summary>
  104. /// 状态
  105. /// </summary>
  106. [Comment("状态")]
  107. [Required]
  108. public CommonStatus Status { get; set; }
  109. /// <summary>
  110. /// 一对一引用(机构)
  111. /// </summary>
  112. public virtual SysOrg SysOrg { get; set; }
  113. public void Configure(EntityTypeBuilder<SysUser> entityBuilder, DbContext dbContext, Type dbContextLocator)
  114. {
  115. entityBuilder.Ignore(t => t.CreateSysUser).Ignore(t => t.UpdateSysUser);
  116. }
  117. }