diff --git a/Falcon.SugarApi/DatabaseDefinitions/SugarBasicTable.cs b/Falcon.SugarApi/DatabaseDefinitions/SugarBasicTable.cs index 56e8330..306d456 100644 --- a/Falcon.SugarApi/DatabaseDefinitions/SugarBasicTable.cs +++ b/Falcon.SugarApi/DatabaseDefinitions/SugarBasicTable.cs @@ -5,9 +5,9 @@ using System.ComponentModel.DataAnnotations; namespace Falcon.SugarApi.DatabaseDefinitions { /// - /// 基础表,定义表基础数据结构和构造方法 + /// 基础表.只定义表基础主键和创建时间 /// - public abstract class SugarBasicTable : ICreateNew + public abstract class SugarBasicTable { /// /// 主键 @@ -21,11 +21,6 @@ namespace Falcon.SugarApi.DatabaseDefinitions [SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建时间")] public DateTime CreateTime { get; set; } = DateTime.Now; - /// - public void CreateNew(string createBy) { - this.SetNew(); - } - /// /// 将数据设置为新数据。 /// 主要更新Id、创建时间和记录状态 diff --git a/Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs b/Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs index a8f201e..844b77f 100644 --- a/Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs +++ b/Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; namespace Falcon.SugarApi.DatabaseDefinitions { diff --git a/Falcon.SugarApi/DatabaseDefinitions/SugarTableBase.cs b/Falcon.SugarApi/DatabaseDefinitions/SugarTableBase.cs index 49b9ad8..d7749aa 100644 --- a/Falcon.SugarApi/DatabaseDefinitions/SugarTableBase.cs +++ b/Falcon.SugarApi/DatabaseDefinitions/SugarTableBase.cs @@ -5,25 +5,16 @@ using System.Reflection; namespace Falcon.SugarApi.DatabaseDefinitions { /// - /// 表基类。一般表应该继承此类 + /// 负载表基类。一般表应该继承此类,包括SugarBasicTable定义,和修改人,行状态,以及一些相关方法等 /// - public abstract class SugarTableBase : ICreateNew, IModify, IDelete + public abstract class SugarTableBase :SugarBasicTable, ICreateNew, IModify, IDelete { - /// - /// 主键 - /// - [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键")] - public Guid Id { get; set; } = Guid.NewGuid(); /// /// 创建人 /// [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "首次创建人")] public string? CreateBy { get; set; } - /// - /// 创建时间 - /// - [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "首次创建时间")] - public DateTime? CreateTime { get; set; } = DateTime.Now; + /// /// 更新人 /// @@ -45,9 +36,8 @@ namespace Falcon.SugarApi.DatabaseDefinitions /// /// 创建人 public virtual void CreateNew(string createBy) { - this.Id = Guid.NewGuid(); + base.SetNew(); this.CreateBy = createBy; - this.CreateTime = DateTime.Now; this.UpdateBy = this.CreateBy; this.UpdateTime = this.CreateTime; this.Status = RecordStetus.Effective;