|
- 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
- {
- /// <summary>
- /// 主键 Guid
- /// </summary>
- [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; }
- /// <summary>
- /// 是否删除
- /// </summary>
- public int IsDeleted { get; set; } = 0;
- /// <summary>
- /// 新增
- /// </summary>
- 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";
- }
- }
- }
- }
|