SystemNotification.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System.ComponentModel.DataAnnotations;
  2. using Masuit.Tools.Models;
  3. using SqlSugar;
  4. using static EasyTemplate.Tool.Entity.PublicEnum;
  5. namespace EasyTemplate.Tool.Entity;
  6. /// <summary>
  7. /// 系统信息提醒
  8. /// </summary>
  9. [SugarTable(null, "系统信息提醒")]
  10. [SugarIndex("NotifyType", nameof(NotifyType), OrderByType.Asc)]
  11. public class SystemNotification : EntityBaseLite
  12. {
  13. /// <summary>
  14. /// 标题
  15. /// </summary>
  16. [SugarColumn(ColumnDescription = "标题", Length =500, IsNullable = true)]
  17. public string Title { get; set; }
  18. /// <summary>
  19. /// 提醒信息
  20. /// </summary>
  21. [SugarColumn(ColumnDescription = "提醒信息", ColumnDataType ="text", IsNullable = true)]
  22. public string Info { get; set; }
  23. /// <summary>
  24. /// 通知类型
  25. /// </summary>
  26. [SugarColumn(ColumnDescription = "通知类型", DefaultValue = "0", IsNullable = true)]
  27. public NotifyType NotifyType { get; set; }
  28. /// <summary>
  29. /// 通知状态
  30. /// </summary>
  31. [SugarColumn(ColumnDescription = "通知状态", DefaultValue = "0", IsNullable = true)]
  32. public NotifyStatus NotifyStatus { get; set; }
  33. /// <summary>
  34. /// 已读
  35. /// </summary>
  36. [SugarColumn(ColumnDescription = "已读", DefaultValue = "0", IsNullable = true)]
  37. public bool Seen { get; set; }
  38. }
  39. public class SystemNotificationSeedData : ISeedData<SystemNotification>
  40. {
  41. public IEnumerable<SystemNotification> Generate()
  42. =>
  43. [
  44. new SystemNotification() { Id = 1, Title="提醒1", Info="一切正常", NotifyType = NotifyType.Notify, NotifyStatus=NotifyStatus.Todo, CreateTime = DateTime.Now },
  45. new SystemNotification() { Id = 2, Title="提醒2", Info="一切不正常", NotifyType = NotifyType.Notify, NotifyStatus=NotifyStatus.Processing, Seen=true, CreateTime = DateTime.Now },
  46. new SystemNotification() { Id = 3, Title="消息1",Info="一切正常111", NotifyType = NotifyType.Info, Seen=false, CreateTime = DateTime.Now },
  47. ];
  48. }