|
- using BPA.KitChen.GroupMeal.Core.Common.Const;
- using Furion;
- using SqlSugar;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPA.KitChen.GroupMeal.Core.Entity.Base
- {
- /// <summary>
- /// 修改人修改时间
- /// </summary>
- public class IBaseOPEntity : IBaseEntity
- {
- /// <summary>
- /// 删除标识
- /// 0=> 正常使用
- /// 1=> 已经被标记删除
- /// </summary>
- [SugarColumn(ColumnDataType = "int", ColumnDescription = "是否删除", IsNullable = false)]
- public int IsDeleted { get; set; } = 0;
- /// <summary>
- /// 删除时间
- /// </summary>
- [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "删除时间", IsNullable = true)]
- public DateTime? DeleteAt { get; set; }
- /// <summary>
- /// 删除人
- /// </summary>
- [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "删除人", IsNullable = true)]
- public string DeleteBy { get; set; }
- /// <summary>
- /// 更新时间
- /// </summary>
- [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "更新时间", IsNullable = true)]
- public DateTime? UpdateAt { get; set; }
- /// <summary>
- /// 更新人
- /// </summary>
- [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "更新人", IsNullable = true)]
- public string UpdateBy { get; set; }
- /// <summary>
- /// 创建时间
- /// </summary>
- [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)]
- public DateTime CreateAt { get; set; } = DateTime.Now;
- /// <summary>
- /// 创建人
- /// </summary>
- [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = true)]
- public string CreateBy { get; set; }
-
- /// <summary>
- /// 新增
- /// </summary>
- public virtual void Create()
- {
- var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
- var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
- this.Id = Guid.NewGuid().ToString();
- this.CreateAt = DateTime.Now;
- if (!string.IsNullOrEmpty(userId))
- {
- this.CreateBy = userId;
- }
- else
- {
-
- this.CreateBy = "admin";
- }
- }
- public virtual void Create(DateTime data)
- {
- var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
- var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
- this.Id = Guid.NewGuid().ToString();
- this.CreateAt = data;
- if (!string.IsNullOrEmpty(userId))
- {
- this.CreateBy = userId;
- }
- else
- {
-
- this.CreateBy = "admin";
- }
- }
- /// <summary>
- /// 修改
- /// </summary>
- public void Modify()
- {
- var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
- var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
- this.UpdateAt = DateTime.Now;
- if (!string.IsNullOrEmpty(userId))
- {
- this.UpdateBy = userId;
- }
- else
- {
-
- this.UpdateBy = "admin";
- }
- }
-
- /// <summary>
- /// 删除
- /// </summary>
- public void Delete()
- {
- var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
- var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
- this.DeleteAt = DateTime.Now;
- if (!string.IsNullOrEmpty(userId))
- {
- this.DeleteBy = userId;
- }
- else
- {
-
- this.DeleteBy = "admin";
- }
- }
- }
- }
|