diff --git a/ZR.Repository/System/SysMenuRepository.cs b/ZR.Repository/System/SysMenuRepository.cs
index 4ab4478..d3d09ba 100644
--- a/ZR.Repository/System/SysMenuRepository.cs
+++ b/ZR.Repository/System/SysMenuRepository.cs
@@ -30,7 +30,7 @@ namespace ZR.Repository.System
}
///
- /// 根据用户查询系统菜单列表(菜单管理)
+ /// 根据用户查询系统菜单列表
///
///
/// 用户角色集合
@@ -38,15 +38,16 @@ namespace ZR.Repository.System
public List SelectTreeMenuListByRoles(MenuQueryDto menu, List roles)
{
var roleMenus = Context.Queryable()
- .Where(r => roles.Contains(r.Role_id));
+ .Where(r => roles.Contains(r.Role_id))
+ .Select(f => f.Menu_id).Distinct().ToList();
return Context.Queryable()
- .InnerJoin(roleMenus, (c, j) => c.MenuId == j.Menu_id)
- .WhereIF(!string.IsNullOrEmpty(menu.MenuName), (c, j) => c.MenuName.Contains(menu.MenuName))
- .WhereIF(!string.IsNullOrEmpty(menu.Visible), (c, j) => c.visible == menu.Visible)
- .WhereIF(!string.IsNullOrEmpty(menu.Status), (c, j) => c.status == menu.Status)
+ .Where(c => roleMenus.Contains(c.MenuId))
+ .WhereIF(!string.IsNullOrEmpty(menu.MenuName), (c) => c.MenuName.Contains(menu.MenuName))
+ .WhereIF(!string.IsNullOrEmpty(menu.Visible), (c) => c.visible == menu.Visible)
+ .WhereIF(!string.IsNullOrEmpty(menu.Status), (c) => c.status == menu.Status)
.WhereIF(!string.IsNullOrEmpty(menu.MenuTypeIds), c => menu.MenuTypeIdArr.Contains(c.menuType))
- .OrderBy((c, j) => new { c.parentId, c.orderNum })
+ .OrderBy((c) => new { c.parentId, c.orderNum })
.Select(c => c)
.ToTree(it => it.children, it => it.parentId, 0);
}
@@ -87,27 +88,6 @@ namespace ZR.Repository.System
.ToList();
}
- #region 左侧菜单树
-
- /////
- ///// 根据用户角色获取左侧菜单树
- /////
- /////
- /////
- //public List SelectMenuTreeByRoleIds(List roleIds)
- //{
- // var menuTypes = new string[] { "M", "C" };
- // return Context.Queryable()
- // .Where((menu) =>
- // menuTypes.Contains(menu.menuType)
- // && menu.status == "0"
- // && SqlFunc.Subqueryable().Where(s => roleIds.Contains(s.Role_id) && s.Menu_id == menu.MenuId).Any())
- // .OrderBy((menu) => new { menu.parentId, menu.orderNum })
- // .Select((menu) => menu).ToList();
- //}
-
- #endregion
-
///
/// 获取菜单详情
///