Commit a67b4ef6 authored by 黄奎's avatar 黄奎

页面修改

parent fd169da4
using Mall.Model.Entity.MarketingCenter;
using System;
using System.Collections.Generic;
using VT.FW.DB;
namespace Mall.Model.Extend.MarketingCenter
......
......@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
using System.Linq;
namespace Mall.Module.MarketingCenter
{
......@@ -42,9 +43,44 @@ namespace Mall.Module.MarketingCenter
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Share_Category_Extend> GetShareCategoryListModule(RB_Share_Category_Extend query)
public List<object> GetShareCategoryListModule(RB_Share_Category_Extend query)
{
return share_CategoryRepository.GetShareCategoryListRepository(query);
List<object> resultList = new List<object>();
var list = share_CategoryRepository.GetShareCategoryListRepository(query);
if (list != null)
{
var leavelList = list.GroupBy(qitem => new { qitem.Level }).OrderBy(qitem => qitem.Key.Level);
foreach (var item in list.Where(qitem => qitem.Level == 1))
{
List<object> secondList = new List<object>();
var subList = list.Where(qitem => qitem.Level == 2 && qitem.ParentId == item.Id).ToList();
foreach (var subItem in subList)
{
var subModel = new
{
subItem.Id,
subItem.Level,
subItem.Name,
subItem.ParentId,
hasChildren = list.Where(qitem => qitem.Level == 3 && qitem.ParentId == subItem.Id)?.Count() > 0,
children = list.Where(qitem => qitem.Level == 3 && qitem.ParentId == subItem.Id).Select(qitem => new { qitem.Id, qitem.Name, qitem.Level, qitem.ParentId })
};
secondList.Add(subModel);
}
var rootModel = new
{
item.Id,
item.Level,
item.Name,
item.ParentId,
hasChildren = secondList?.Count>0,
children = secondList
};
resultList.Add(rootModel);
}
}
return resultList;
}
/// <summary>
......
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