using System.ComponentModel.DataAnnotations; using SqlSugar; using static EasyTemplate.Tool.Entity.PublicEnum; namespace EasyTemplate.Tool.Entity; /// /// 系统菜单 /// [SugarTable(null, "系统菜单")] public class SystemMenu : EntityBaseLite { /// /// 父级Id /// [SugarColumn(ColumnDescription = "父级Id", DefaultValue ="0", IsNullable = true)] public long ParentId { get; set; } /// /// 路由 /// [SugarColumn(ColumnDescription = "路由", IsNullable = true)] public string Path { get; set; } /// /// 菜单名称 /// [SugarColumn(ColumnDescription = "菜单名称", IsNullable = true)] public string Name { get; set; } /// /// 键 /// [SugarColumn(ColumnDescription = "键", IsNullable = true)] public string Key { get; set; } /// /// 图标,从https://antblazor.com/zh-CN/components/icon获取名称 /// [SugarColumn(ColumnDescription = "图标,从https://antblazor.com/zh-CN/components/icon获取名称", IsNullable = true)] public string Icon { get; set; } /// /// 排序 /// [SugarColumn(ColumnDescription = "排序", DefaultValue ="0", IsNullable = true)] public int Sort { get; set; } /// /// 是否必需 /// [SugarColumn(ColumnDescription = "是否必需", DefaultValue = "0", IsNullable = true)] public bool Necessary { get; set; } /// /// 是否必需 /// [SugarColumn(ColumnDescription = "是否启用", DefaultValue = "1", IsNullable = true)] public bool Enabled { get; set; } /// /// /// [SugarColumn(IsIgnore = true)] public List Children { get; set; } /// /// /// [SugarColumn(IsIgnore = true)] public bool Checked { get; set; } } public class SystemMenuSeedData : ISeedData { public IEnumerable Generate() => [ new SystemMenu() { Id = 1, ParentId = 0, Path="/", Name="主页", Key="home", Necessary=true, Icon="home", Sort=0, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 2, ParentId = 0, Path="/system", Name="系统管理", Key="system", Icon="setting", Sort=999, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 3, ParentId = 2, Path="/system/setting", Name="系统设置", Key="system.setting", Icon="desktop", Sort=0, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 4, ParentId = 2, Path="/system/user", Name="用户管理", Key="system.user", Icon="idcard", Sort=1, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 5, ParentId = 2, Path="/system/role", Name="角色管理", Key="system.role", Icon="user", Sort=2, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 6, ParentId = 2, Path="/system/department", Name="部门管理", Key="system.department", Icon="apartment", Sort=3, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 7, ParentId = 2, Path="/system/dictionary", Name="字典管理", Key="system.dictionary", Icon="api", Sort=4, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 8, ParentId = 2, Path="/system/menu", Name="菜单管理", Key="system.menu", Icon="menu", Sort=5, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 9, ParentId = 2, Path="/system/area", Name="区域管理", Key="system.area", Icon="block", Sort=6, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 10, ParentId = 2, Path="/system/alllog", Name="日志管理", Key="system.alllog", Icon="file", Sort=7, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 11, ParentId = 10, Path="/system/alllog/log", Name="日志管理", Key="system.log", Icon="file-exclamation", Sort=0, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 12, ParentId = 10, Path="/system/alllog/apilog", Name="接口日志管理", Key="system.apilog", Icon="file-text", Sort=1, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 13, ParentId = 10, Path="/system/alllog/loginlog", Name="登录日志管理", Key="system.loginlog", Icon="file", Sort=2, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 14, ParentId = 2, Path="/system/apidoc", Name="接口文档", Key="system.apidoc", Icon="file-markdown", Sort=8, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 15, ParentId = 0, Path="/app", Name="应用管理", Key="app", Icon="appstore", Sort=1, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 16, ParentId = 15, Path="/app/product", Name="产品管理", Key="app.product", Icon="shopping", Sort=0, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 17, ParentId = 15, Path="/app/order", Name="订单管理", Key="app.order", Icon="snippets", Sort=1, Enabled=true, CreateTime = DateTime.Now }, new SystemMenu() { Id = 18, ParentId = 0, Path="/app/record", Name="交易记录", Key="app.record", Icon="snippets", Sort=2, Enabled=true, CreateTime = DateTime.Now }, ]; }