| 1234567891011121314151617181920212223242526272829303132333435 |
- using SqlSugar;
- using System;
- namespace SKMC.Api.Common.DB.Entity
- {
- /// <summary>
- /// 基础的Entity模板
- /// </summary>
- 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;
- }
- }
- }
|