You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

129 lines
4.0 KiB

  1. using BPA.KitChen.GroupMeal.Core.Common.Const;
  2. using Furion;
  3. using SqlSugar;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace BPA.KitChen.GroupMeal.Core.Entity.Base
  10. {
  11. /// <summary>
  12. /// 修改人修改时间
  13. /// </summary>
  14. public class IBaseOPEntity : IBaseEntity
  15. {
  16. /// <summary>
  17. /// 删除标识
  18. /// 0=> 正常使用
  19. /// 1=> 已经被标记删除
  20. /// </summary>
  21. [SugarColumn(ColumnDataType = "int", ColumnDescription = "是否删除", IsNullable = false)]
  22. public int IsDeleted { get; set; } = 0;
  23. /// <summary>
  24. /// 删除时间
  25. /// </summary>
  26. [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "删除时间", IsNullable = true)]
  27. public DateTime? DeleteAt { get; set; }
  28. /// <summary>
  29. /// 删除人
  30. /// </summary>
  31. [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "删除人", IsNullable = true)]
  32. public string DeleteBy { get; set; }
  33. /// <summary>
  34. /// 更新时间
  35. /// </summary>
  36. [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "更新时间", IsNullable = true)]
  37. public DateTime? UpdateAt { get; set; }
  38. /// <summary>
  39. /// 更新人
  40. /// </summary>
  41. [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "更新人", IsNullable = true)]
  42. public string UpdateBy { get; set; }
  43. /// <summary>
  44. /// 创建时间
  45. /// </summary>
  46. [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)]
  47. public DateTime CreateAt { get; set; } = DateTime.Now;
  48. /// <summary>
  49. /// 创建人
  50. /// </summary>
  51. [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = true)]
  52. public string CreateBy { get; set; }
  53. /// <summary>
  54. /// 新增
  55. /// </summary>
  56. public virtual void Create()
  57. {
  58. var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
  59. var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
  60. this.Id = Guid.NewGuid().ToString();
  61. this.CreateAt = DateTime.Now;
  62. if (!string.IsNullOrEmpty(userId))
  63. {
  64. this.CreateBy = userId;
  65. }
  66. else
  67. {
  68. this.CreateBy = "admin";
  69. }
  70. }
  71. public virtual void Create(DateTime data)
  72. {
  73. var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
  74. var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
  75. this.Id = Guid.NewGuid().ToString();
  76. this.CreateAt = data;
  77. if (!string.IsNullOrEmpty(userId))
  78. {
  79. this.CreateBy = userId;
  80. }
  81. else
  82. {
  83. this.CreateBy = "admin";
  84. }
  85. }
  86. /// <summary>
  87. /// 修改
  88. /// </summary>
  89. public void Modify()
  90. {
  91. var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
  92. var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
  93. this.UpdateAt = DateTime.Now;
  94. if (!string.IsNullOrEmpty(userId))
  95. {
  96. this.UpdateBy = userId;
  97. }
  98. else
  99. {
  100. this.UpdateBy = "admin";
  101. }
  102. }
  103. /// <summary>
  104. /// 删除
  105. /// </summary>
  106. public void Delete()
  107. {
  108. var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
  109. var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
  110. this.DeleteAt = DateTime.Now;
  111. if (!string.IsNullOrEmpty(userId))
  112. {
  113. this.DeleteBy = userId;
  114. }
  115. else
  116. {
  117. this.DeleteBy = "admin";
  118. }
  119. }
  120. }
  121. }