using Mysqlx.Crud; namespace MasaBlazorApp3.Pojo { [Serializable] public class Premission { public Premission Parent { get; set; } = null; public void AddChild(Premission item) { item.Parent = this; this.Items = this.Items.Concat(new Premission[] { item }); } public int Id { get; set; } public string PremissionName { get; set; } /// /// 菜单路径 /// public string PremissionPath { get; set; } public IEnumerable Items { get; set; } = Enumerable.Empty(); public List getAdminPremission() { var list = new List(); Premission boxManage = new Premission { Id = 1, PremissionName = "套餐管理", PremissionPath = "planManage" }; boxManage.AddChild(new Premission() { Id = 11, PremissionName = "套餐管理", PremissionPath = "/planManage/Plan" }); Premission check = new Premission { Id = 2, PremissionName = "药盒核对", PremissionPath = "checkOrder" }; check.AddChild(new Premission() { Id = 21, PremissionName = "药盒核对", PremissionPath = "/checkOrder/Check" }); Premission stock = new Premission { Id = 3, PremissionName = "药盒库存", PremissionPath = "stock" }; stock.AddChild(new Premission() { Id = 31, PremissionName = "药盒库存", PremissionPath = "/stock/BoxStock" }); Premission box = new Premission { Id = 4, PremissionName = "绑定药盒", PremissionPath = "Box" }; box.AddChild(new Premission() { Id = 41, PremissionName = "绑定药盒", PremissionPath = "/Box/BoxBindings" }); Premission sysSetting = new Premission { Id = 5, PremissionName = "系统设置", PremissionPath = "sysSetting" }; sysSetting.AddChild(new Premission() { Id = 51, PremissionName = "用户设置", PremissionPath = "/sysSetting/user" }); sysSetting.AddChild(new Premission() { Id = 52, PremissionName = "权限设置", PremissionPath = "/sysSetting/role" }); sysSetting.AddChild(new Premission() { Id = 53, PremissionName = "系统设置", PremissionPath = "/sysSetting/setting" }); list.Add(boxManage); list.Add(check); list.Add(stock); list.Add(box); list.Add(sysSetting); return list; } public bool HasChild() { return this.Items.Count() > 0; } } }