C#递归计算树形菜单
2021-06-09 05:04
标签:nts inf list order lis sum == vat summary 1 先获取1级菜单集合 /// } private List foreach (var item in list.Where(p => p.ParentMenuId == departmentId)) C#递归计算树形菜单 标签:nts inf list order lis sum == vat summary 原文地址:https://www.cnblogs.com/dyc-zlj/p/10668283.html
/// 获取菜单列表
///
///
public List
{
List
List
_menuinfoRepository.Queryable().OrderBy("MenuId").Select(p => new MenuInfoExt()
{
ParentMenuId=p.ParentMenuId,
MenuId = p.MenuId,
Name = p.Name
}).ToList();
foreach (var item in menuinfoses)
{
if (item.ParentMenuId == 0)
{
MenuInfodepartment = new MenuInfo();
department.id = item.MenuId;
department.text = item.Name;
department.children = AddChildNode(menuinfoses, item.MenuId);
departments.Add(department);
}
}
return departments;
{
List
{
MenuInfodepartment = new MenuInfo();
department.id = item.MenuId;
department.text = item.Name;
department.children = AddChildNode(list, item.MenuId);
departments.Add(department);
}
return departments;
}