using JNPF.Common.Const; using JNPF.Common.Security; using JNPF.DependencyInjection; using SqlSugar; namespace JNPF.Common.Contracts; /// /// 创实体基类. /// [SuppressSniffer] public abstract class CEntityBase : EntityBase, ICreatorTime { /// /// 获取或设置 创建时间. /// [SugarColumn(ColumnName = "F_CREATORTIME", ColumnDescription = "创建时间")] public virtual DateTime? CreatorTime { get; set; } /// /// 获取或设置 创建用户. /// [SugarColumn(ColumnName = "F_CREATORUSERID", ColumnDescription = "创建用户")] public virtual string CreatorUserId { get; set; } /// /// 创建. /// public virtual void Creator() { var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value; this.CreatorTime = DateTime.Now; this.Id = SnowflakeIdHelper.NextId(); if (!string.IsNullOrEmpty(userId)) { this.CreatorUserId = userId; } } }