using Model; using Newtonsoft.Json; namespace Vo { /// /// Treeselect树结构实体类 /// public class LeftMenuVo { /// /// 节点Id /// public long Id { get; set; } /// /// 节点名称 /// public string Name { get; set; } public long ParentId { get; set; } public string MenuType { get; set; } public string Path { get; set; } public int SortOrder { get; set; } public TreeSelectMeta meta { get; set; } public List Permission { get; set; } public LeftMenuVo() { } public LeftMenuVo(SysMenu menu) { Id = menu.menuId; Name = menu.name; ParentId = menu.parentId; MenuType = menu.menuType; Path = menu.path; SortOrder = menu.sortOrder; meta = new TreeSelectMeta(); meta.title = menu.name; meta.enName = menu.enName; meta.icon = menu.icon; Permission = new List(); List child = new List(); foreach (var item in menu.children) { if(item.menuType == "0") { child.Add(new LeftMenuVo(item)); } else { Permission.Add(item.permission); } } Children = child; } public LeftMenuVo(SysDept dept) { Id = dept.deptId; Name = dept.name; List child = new List(); foreach (var item in dept.children) { child.Add(new LeftMenuVo(item)); } Children = child; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List Children { get; set; } } }