平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BaseEntity.cs 2.6 KiB

4 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. 
  2. //
  3. namespace SafeCampus.SqlSugar;
  4. /// <summary>
  5. /// 主键实体基类
  6. /// </summary>
  7. public abstract class PrimaryKeyEntity
  8. {
  9. /// <summary>
  10. /// 主键Id
  11. /// </summary>
  12. [SugarColumn(ColumnDescription = "Id", IsPrimaryKey = true)]
  13. public virtual long Id { get; set; }
  14. /// <summary>
  15. /// 拓展信息
  16. /// </summary>
  17. [SugarColumn(ColumnName = "ExtJson", ColumnDescription = "扩展信息", ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)]
  18. public virtual string ExtJson { get; set; }
  19. }
  20. /// <summary>
  21. /// 框架实体基类
  22. /// </summary>
  23. public class BaseEntity : PrimaryKeyEntity
  24. {
  25. [SugarColumn(ColumnName = "Status", ColumnDescription = "状态", Length = 20, DefaultValue = CommonStatusConst.ENABLE,
  26. IsNullable = true)]
  27. public virtual string Status { get; set; }
  28. /// <summary>
  29. /// 创建时间
  30. /// </summary>
  31. [SugarColumn(ColumnDescription = "创建时间", IsOnlyIgnoreUpdate = true, IsNullable = true)]
  32. public virtual DateTime? CreateTime { get; set; }
  33. /// <summary>
  34. /// 更新时间
  35. /// </summary>
  36. [SugarColumn(ColumnDescription = "更新时间", IsOnlyIgnoreInsert = true, IsNullable = true)]
  37. public virtual DateTime? UpdateTime { get; set; }
  38. /// <summary>
  39. /// 创建者Id
  40. /// </summary>
  41. [SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true, IsNullable = true)]
  42. public virtual long? CreateUserId { get; set; }
  43. /// <summary>
  44. /// 修改者Id
  45. /// </summary>
  46. [SugarColumn(ColumnDescription = "修改者Id", IsOnlyIgnoreInsert = true, IsNullable = true)]
  47. public virtual long? UpdateUserId { get; set; }
  48. /// <summary>
  49. /// 创建人
  50. /// </summary>
  51. [SugarColumn(ColumnDescription = "创建人", IsOnlyIgnoreUpdate = true, IsNullable = true)]
  52. public virtual string CreateUser { get; set; }
  53. /// <summary>
  54. /// 更新人
  55. /// </summary>
  56. [SugarColumn(ColumnDescription = "更新人", IsOnlyIgnoreInsert = true, IsNullable = true)]
  57. public virtual string UpdateUser { get; set; }
  58. /// <summary>
  59. /// 软删除
  60. /// </summary>
  61. [SugarColumn(ColumnDescription = "软删除", IsNullable = true)]
  62. public virtual bool IsDelete { get; set; }
  63. }
  64. /// <summary>
  65. /// 业务数据实体基类(数据权限)
  66. /// </summary>
  67. public abstract class DataEntityBase : BaseEntity
  68. {
  69. /// <summary>
  70. /// 创建者部门Id
  71. /// </summary>
  72. [SugarColumn(ColumnDescription = "创建者部门Id", IsOnlyIgnoreUpdate = true, IsNullable = true)]
  73. public virtual long CreateOrgId { get; set; }
  74. }