菜单排序修改
parent
c11ede3fc1
commit
ef081aa373
|
|
@ -11,6 +11,7 @@ using Infrastructure.Helpers;
|
|||
using SqlSugar;
|
||||
using Infrastructure.Extensions;
|
||||
using Infrastructure.Utilities;
|
||||
using NPOI.POIFS.Properties;
|
||||
|
||||
namespace OpenAuth.WebApi.Controllers
|
||||
{
|
||||
|
|
@ -192,7 +193,7 @@ namespace OpenAuth.WebApi.Controllers
|
|||
|
||||
foreach (var module in modules)
|
||||
{
|
||||
if (string.IsNullOrEmpty(module.ParentId) ||module.ParentId == "0")
|
||||
if (string.IsNullOrEmpty(module.ParentId) || module.ParentId == "0")
|
||||
{
|
||||
rootNodes.Add(modulesMap[module.Id]);
|
||||
}
|
||||
|
|
@ -201,10 +202,13 @@ namespace OpenAuth.WebApi.Controllers
|
|||
parentNode.Children.Add(modulesMap[module.Id]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var moduleView in rootNodes)
|
||||
{
|
||||
moduleView.Children.Sort((a, b) => a.SortNo.CompareTo(b.SortNo));
|
||||
}
|
||||
return rootNodes.OrderBy(a => a.SortNo);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public Response<IEnumerable<ModuleView>> GetModulesTree(string typeid)
|
||||
{
|
||||
|
|
@ -247,7 +251,9 @@ namespace OpenAuth.WebApi.Controllers
|
|||
var result = new Response<IEnumerable<TreeItem<ModuleView>>>();
|
||||
try
|
||||
{
|
||||
result.Result = _authStrategyContext.Modules.WhereIF(!string.IsNullOrEmpty(typeid), a => a.ModuleTypeId == typeid).OrderBy(a => a.SortNo).GenerateTree(u => u.Id, u => u.ParentId, "0");
|
||||
result.Result = _authStrategyContext.Modules
|
||||
.WhereIF(!string.IsNullOrEmpty(typeid), a => a.ModuleTypeId == typeid).OrderBy(a => a.SortNo)
|
||||
.GenerateTree(u => u.Id, u => u.ParentId, "0");
|
||||
}
|
||||
catch (CommonException ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue