using BPA.SAAS.Manage.Comm.Const; using Furion; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BPA.SAAS.Manage.Core.Base { public abstract class IBaseEntity: IDeleted { /// /// 主键 Guid /// [SugarColumn(IsPrimaryKey = true, ColumnDataType = "Nvarchar(64)", IsNullable = false)] public string Id { get; set; } public DateTime CreateAt { get; set; } = DateTime.Now; public string CreateBy { get; set; } /// /// 是否删除 /// public int IsDeleted { get; set; } = 0; /// /// 新增 /// public virtual void Create() { var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; this.Id = string.IsNullOrWhiteSpace(Id) ? Guid.NewGuid().ToString() : Id; this.CreateAt = DateTime.Now; if (!string.IsNullOrEmpty(userId)) { this.CreateBy = userId; } else { this.CreateBy = "admin"; } } } }