Commit 81bdd156 authored by 黄奎's avatar 黄奎

页面修改

parent 53741b29
......@@ -944,12 +944,13 @@ namespace Mall.WebApi.Controllers.User
{
list = menuList;
}
var rootList = list.Where(qitem => qitem.MenuLevel == 1).OrderBy(qitem => qitem.SortNum).ToList();
var newMenuList = list.GroupBy(qitem => new { qitem.MenuId, qitem.MenuLevel, qitem.ParentId, qitem.MenuName, qitem.MenuUrl, qitem.IconClass, qitem.SortNum }).OrderBy(qitem => qitem.Key.SortNum)
.Select(qitem => new { qitem.Key.MenuId, qitem.Key.MenuLevel, qitem.Key.ParentId, qitem.Key.MenuName, qitem.Key.MenuUrl, qitem.Key.IconClass, qitem.Key.SortNum }).ToList();
var rootList = newMenuList.Where(qitem => qitem.MenuLevel == 1);
foreach (var item in rootList)
{
List<object> subResultList = new List<object>();
var subList = list.Where(qitem => qitem.MenuLevel == 2 && qitem.ParentId == item.MenuId).OrderBy(qitem => qitem.SortNum).ToList();
var subList = newMenuList.Where(qitem => qitem.MenuLevel == 2 && qitem.ParentId == item.MenuId).OrderBy(qitem => qitem.SortNum).ToList();
foreach (var subItem in subList)
{
List<object> thirdResultList = new List<object>();
......@@ -959,7 +960,7 @@ namespace Mall.WebApi.Controllers.User
subItem.MenuName,
subItem.MenuUrl,
subItem.IconClass,
ThirdList = list.Where(qitem => qitem.MenuLevel == 3 && qitem.ParentId == subItem.MenuId).OrderBy(qitem => qitem.SortNum).Select(qitem => new
ThirdList = newMenuList.Where(qitem => qitem.MenuLevel == 3 && qitem.ParentId == subItem.MenuId).OrderBy(qitem => qitem.SortNum).Select(qitem => new
{
qitem.MenuId,
qitem.MenuName,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment