|
@@ -102,8 +102,7 @@ namespace GxPress.Repository.Implement.Category
|
|
|
var result = new List<CategoryResult>();
|
|
|
result.Add(new CategoryResult { Id = 0, Name = "推荐", IsDisable = false });
|
|
|
var categoryResults = categoryAll.Where(n => n.ParentId == 0).Select(n => _mapper.Map<CategoryResult>(n)).ToList();
|
|
|
- result.AddRange(categoryResults);
|
|
|
- foreach (var item in result)
|
|
|
+ foreach (var item in categoryResults)
|
|
|
{
|
|
|
item.IsChildren = categoryAll.Any(n => n.ParentId == item.Id);
|
|
|
item.Children = categoryAll.Where(n => n.ParentId == item.Id).Select(n => _mapper.Map<CategoryResult>(n)).ToList();
|
|
@@ -116,6 +115,7 @@ namespace GxPress.Repository.Implement.Category
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ result.AddRange(categoryResults);
|
|
|
return result;
|
|
|
}
|
|
|
}
|