数据基础表中取消状态字段,状态应该由业务数据维护。 记录创建时间改为必填

This commit is contained in:
falcon 2022-09-08 13:58:49 +08:00
parent 3cbef851ea
commit 6a888ca9be

View File

@ -16,14 +16,8 @@ namespace Falcon.SugarApi.DatabaseDefinitions
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>
[SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建时间")] [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = false, ColumnDescription = "创建时间")]
public DateTime? CreateTime { get; set; } = DateTime.Now; public DateTime CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 记录状态。有效 无效
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "记录状态。有效 无效")]
public string Status { get; set; } = "有效";
/// <summary> /// <summary>
/// 将数据设置为新数据。 /// 将数据设置为新数据。
@ -33,16 +27,6 @@ namespace Falcon.SugarApi.DatabaseDefinitions
public virtual SugarBasicTable SetNew() { public virtual SugarBasicTable SetNew() {
this.Id = Guid.NewGuid(); this.Id = Guid.NewGuid();
this.CreateTime = DateTime.Now; this.CreateTime = DateTime.Now;
this.Status = "有效";
return this;
}
/// <summary>
/// 设置本条记录有效状态
/// </summary>
/// <param name="enable">有效还是无效,默认有效</param>
/// <returns>本条数据</returns>
public virtual SugarBasicTable SetEnable(bool enable = true) {
this.Status = enable ? "有效" : "无效";
return this; return this;
} }
} }