基础服务api
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.
 
 

45 lines
1.2 KiB

  1. using BPA.SAAS.Manage.Comm.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.SAAS.Manage.Core.Base
  10. {
  11. public abstract class IBaseEntity: IDeleted
  12. {
  13. /// <summary>
  14. /// 主键 Guid
  15. /// </summary>
  16. [SugarColumn(IsPrimaryKey = true, ColumnDataType = "Nvarchar(64)", IsNullable = false)]
  17. public string Id { get; set; }
  18. public DateTime CreateAt { get; set; } = DateTime.Now;
  19. public string CreateBy { get; set; }
  20. /// <summary>
  21. /// 是否删除
  22. /// </summary>
  23. public int IsDeleted { get; set; } = 0;
  24. /// <summary>
  25. /// 新增
  26. /// </summary>
  27. public virtual void Create()
  28. {
  29. var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
  30. this.Id = string.IsNullOrWhiteSpace(Id) ? Guid.NewGuid().ToString() : Id;
  31. this.CreateAt = DateTime.Now;
  32. if (!string.IsNullOrEmpty(userId))
  33. {
  34. this.CreateBy = userId;
  35. }
  36. else
  37. {
  38. this.CreateBy = "admin";
  39. }
  40. }
  41. }
  42. }