mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 10:37:55 +08:00
完成导航动态加载
This commit is contained in:
@@ -4,6 +4,7 @@ using OpenAuth.Domain.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenAuth.App.ViewModel;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
@@ -16,18 +17,6 @@ namespace OpenAuth.App
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public int GetModuleCntInOrg(int orgId)
|
||||
{
|
||||
if (orgId == 0)
|
||||
{
|
||||
return _repository.Find(null).Count();
|
||||
}
|
||||
else
|
||||
{
|
||||
return _repository.GetModuleCntInOrgs(GetSubOrgIds(orgId));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载一个部门及子部门全部Modules
|
||||
/// </summary>
|
||||
@@ -61,7 +50,19 @@ namespace OpenAuth.App
|
||||
return _repository.Find(u => u.ParentId == 0).ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<ModuleView> LoadByParent(int parentId)
|
||||
{
|
||||
var modules = new List<ModuleView>();
|
||||
var roots = _repository.Find(u => u.ParentId == parentId);
|
||||
foreach (var module in roots)
|
||||
{
|
||||
ModuleView mv = module;
|
||||
mv.Childern = LoadByParent(module.Id);
|
||||
modules.Add(mv);
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
||||
|
||||
public Module Find(int id)
|
||||
{
|
||||
@@ -141,6 +142,5 @@ namespace OpenAuth.App
|
||||
|
||||
#endregion 私有方法
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user