Commit 91925330 authored by 吴春's avatar 吴春

提交代码

parent 8ade775b
...@@ -1869,27 +1869,31 @@ namespace Mall.WebApi.Controllers.Education ...@@ -1869,27 +1869,31 @@ namespace Mall.WebApi.Controllers.Education
} }
List<object> fileGroup = new List<object>(); List<object> fileGroup = new List<object>();
foreach (var item in fileList.GroupBy(x => x.Type))
for (int i = 2; i <= 1; i--)
{ {
List<object> fileObjectList = new List<object>(); List<object> fileObjectList = new List<object>();
foreach (var itemGroup in fileList.Where(x=>x.Type==item.Key).GroupBy(x => x.GroupId)) foreach (var itemGroup in fileList.Where(x => x.Type == i).GroupBy(x => x.GroupId))
{ {
fileObjectList.Add(new fileObjectList.Add(new
{ {
Name = group.Where(x => x.Id == itemGroup.Key).FirstOrDefault()?.Name ?? "默认", Name = group.Where(x => x.Id == itemGroup.Key).FirstOrDefault()?.Name ?? "默认",
Id = itemGroup.Key, Id = itemGroup.Key,
Type = item.Key, Type = i,
FileList= fileList.Where(x=>x.GroupId==itemGroup.Key&&x.Type==item.Key).ToList() FileList = fileList.Where(x => x.GroupId == itemGroup.Key && x.Type == i).ToList()
}); });
} }
fileGroup.Add(new fileGroup.Add(new
{ {
item.Key, Key = i,
// groupList = group.Where(x => x.Type == item.Key).ToList(), // groupList = group.Where(x => x.Type == item.Key).ToList(),
groupList= fileObjectList groupList = fileObjectList
}); });
} }
//foreach (var item in fileList.GroupBy(x => x.Type))
//{
//}
var data = new var data = new
{ {
......
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