系统菜单搜索优化2
parent
dc78e7d87f
commit
c1beb86dbd
|
@ -60,9 +60,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
*/
|
||||
@Override
|
||||
public List<SysMenu> selectMenuList (SysMenu menu, Long userId) {
|
||||
List<SysMenu> MenuList = null;
|
||||
List<SysMenu> menuList = null;
|
||||
boolean admin = SysUser.isAdmin(userId);
|
||||
// 管理员显示所有菜单信息
|
||||
if (SysUser.isAdmin(userId)) {
|
||||
// if (SysUser.isAdmin(userId)) {
|
||||
if (admin){
|
||||
menuList = menuMapper.selectMenuList(menu);
|
||||
} else {
|
||||
menu.getParams().put("userId", userId);
|
||||
|
@ -70,8 +73,13 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
}
|
||||
if (menuList.size() == 1){
|
||||
SysMenu sysMenu = menuList.get(0);
|
||||
List<SysMenu> childList = this.getChildList(menuMapper.selectMenuList(null), sysMenu);
|
||||
this.getMenuList(menuList,sysMenu);
|
||||
// List<SysMenu> childList = this.getChildList(menuMapper.selectMenuList(null), sysMenu);
|
||||
SysMenu sysMenu1 = new SysMenu();
|
||||
sysMenu1.setPerms(menu.getPerms());
|
||||
MenuList = admin ? menuMapper.selectMenuList(null) : menuMapper.selectMenuListByUserId(sysMenu1);
|
||||
// 找子节点
|
||||
List<SysMenu> childList = this.getChildList(MenuList, sysMenu);
|
||||
menuList.addAll(childList);
|
||||
}
|
||||
return menuList;
|
||||
|
|
Loading…
Reference in New Issue