using SqlSugar; using System; namespace SKMC.Api.Common.DB.Entity { /// /// 基础的Entity模板 /// public class BaseEntity { [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] public long Id { get; set; } public string Oper { get; set; } public DateTime CreateTime { get; set; } public DateTime UpdateTime { get; set; } public long Seq { get; set; } public BaseEntity() { if (Id == 0) { Id = BitConverter.ToInt64(System.Guid.NewGuid().ToByteArray(), 0); } if (Oper == null) Oper = "OP"; if (CreateTime == null) CreateTime = DateTime.Now; if (UpdateTime == null) UpdateTime = DateTime.Now; if (Seq == 0) Seq = CreateTime.Ticks; } } }