SystemMenu.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System.ComponentModel.DataAnnotations;
  2. using SqlSugar;
  3. using static EasyTemplate.Tool.Entity.PublicEnum;
  4. namespace EasyTemplate.Tool.Entity;
  5. /// <summary>
  6. /// 系统菜单
  7. /// </summary>
  8. [SugarTable(null, "系统菜单")]
  9. public class SystemMenu : EntityBaseLite
  10. {
  11. /// <summary>
  12. /// 父级Id
  13. /// </summary>
  14. [SugarColumn(ColumnDescription = "父级Id", DefaultValue ="0", IsNullable = true)]
  15. public long ParentId { get; set; }
  16. /// <summary>
  17. /// 路由
  18. /// </summary>
  19. [SugarColumn(ColumnDescription = "路由", IsNullable = true)]
  20. public string Path { get; set; }
  21. /// <summary>
  22. /// 菜单名称
  23. /// </summary>
  24. [SugarColumn(ColumnDescription = "菜单名称", IsNullable = true)]
  25. public string Name { get; set; }
  26. /// <summary>
  27. /// 键
  28. /// </summary>
  29. [SugarColumn(ColumnDescription = "键", IsNullable = true)]
  30. public string Key { get; set; }
  31. /// <summary>
  32. /// 图标,从https://antblazor.com/zh-CN/components/icon获取名称
  33. /// </summary>
  34. [SugarColumn(ColumnDescription = "图标,从https://antblazor.com/zh-CN/components/icon获取名称", IsNullable = true)]
  35. public string Icon { get; set; }
  36. /// <summary>
  37. /// 排序
  38. /// </summary>
  39. [SugarColumn(ColumnDescription = "排序", DefaultValue ="0", IsNullable = true)]
  40. public int Sort { get; set; }
  41. /// <summary>
  42. /// 是否必需
  43. /// </summary>
  44. [SugarColumn(ColumnDescription = "是否必需", DefaultValue = "0", IsNullable = true)]
  45. public bool Necessary { get; set; }
  46. /// <summary>
  47. /// 是否必需
  48. /// </summary>
  49. [SugarColumn(ColumnDescription = "是否启用", DefaultValue = "1", IsNullable = true)]
  50. public bool Enabled { get; set; }
  51. /// <summary>
  52. ///
  53. /// </summary>
  54. [SugarColumn(IsIgnore = true)]
  55. public List<SystemMenu> Children { get; set; }
  56. /// <summary>
  57. ///
  58. /// </summary>
  59. [SugarColumn(IsIgnore = true)]
  60. public bool Checked { get; set; }
  61. }
  62. public class SystemMenuSeedData : ISeedData<SystemMenu>
  63. {
  64. public IEnumerable<SystemMenu> Generate()
  65. =>
  66. [
  67. new SystemMenu() { Id = 1, ParentId = 0, Path="/", Name="主页", Key="home", Necessary=true, Icon="home", Sort=0, Enabled=true, CreateTime = DateTime.Now },
  68. new SystemMenu() { Id = 2, ParentId = 0, Path="/system", Name="系统管理", Key="system", Icon="setting", Sort=999, Enabled=true, CreateTime = DateTime.Now },
  69. new SystemMenu() { Id = 3, ParentId = 2, Path="/system/setting", Name="系统设置", Key="system.setting", Icon="desktop", Sort=0, Enabled=true, CreateTime = DateTime.Now },
  70. new SystemMenu() { Id = 4, ParentId = 2, Path="/system/user", Name="用户管理", Key="system.user", Icon="idcard", Sort=1, Enabled=true, CreateTime = DateTime.Now },
  71. new SystemMenu() { Id = 5, ParentId = 2, Path="/system/role", Name="角色管理", Key="system.role", Icon="user", Sort=2, Enabled=true, CreateTime = DateTime.Now },
  72. new SystemMenu() { Id = 6, ParentId = 2, Path="/system/department", Name="部门管理", Key="system.department", Icon="apartment", Sort=3, Enabled=true, CreateTime = DateTime.Now },
  73. new SystemMenu() { Id = 7, ParentId = 2, Path="/system/dictionary", Name="字典管理", Key="system.dictionary", Icon="api", Sort=4, Enabled=true, CreateTime = DateTime.Now },
  74. new SystemMenu() { Id = 8, ParentId = 2, Path="/system/menu", Name="菜单管理", Key="system.menu", Icon="menu", Sort=5, Enabled=true, CreateTime = DateTime.Now },
  75. new SystemMenu() { Id = 9, ParentId = 2, Path="/system/area", Name="区域管理", Key="system.area", Icon="block", Sort=6, Enabled=true, CreateTime = DateTime.Now },
  76. new SystemMenu() { Id = 10, ParentId = 2, Path="/system/alllog", Name="日志管理", Key="system.alllog", Icon="file", Sort=7, Enabled=true, CreateTime = DateTime.Now },
  77. new SystemMenu() { Id = 11, ParentId = 10, Path="/system/alllog/log", Name="日志管理", Key="system.log", Icon="file-exclamation", Sort=0, Enabled=true, CreateTime = DateTime.Now },
  78. new SystemMenu() { Id = 12, ParentId = 10, Path="/system/alllog/apilog", Name="接口日志管理", Key="system.apilog", Icon="file-text", Sort=1, Enabled=true, CreateTime = DateTime.Now },
  79. new SystemMenu() { Id = 13, ParentId = 10, Path="/system/alllog/loginlog", Name="登录日志管理", Key="system.loginlog", Icon="file", Sort=2, Enabled=true, CreateTime = DateTime.Now },
  80. new SystemMenu() { Id = 14, ParentId = 2, Path="/system/apidoc", Name="接口文档", Key="system.apidoc", Icon="file-markdown", Sort=8, Enabled=true, CreateTime = DateTime.Now },
  81. new SystemMenu() { Id = 15, ParentId = 0, Path="/app", Name="应用管理", Key="app", Icon="appstore", Sort=1, Enabled=true, CreateTime = DateTime.Now },
  82. new SystemMenu() { Id = 16, ParentId = 15, Path="/app/product", Name="产品管理", Key="app.product", Icon="shopping", Sort=0, Enabled=true, CreateTime = DateTime.Now },
  83. new SystemMenu() { Id = 17, ParentId = 15, Path="/app/order", Name="订单管理", Key="app.order", Icon="snippets", Sort=1, Enabled=true, CreateTime = DateTime.Now },
  84. new SystemMenu() { Id = 18, ParentId = 0, Path="/app/record", Name="交易记录", Key="app.record", Icon="snippets", Sort=2, Enabled=true, CreateTime = DateTime.Now },
  85. ];
  86. }