| | |
| | | { |
| | | List<SysMenu> menuList = null; |
| | | // 管理员显示所有菜单信息 |
| | | if (SysUser.isAdmin(userId)) |
| | | if (isAdmin(userId)) |
| | | { |
| | | menuList = menuMapper.selectMenuList(menu); |
| | | } |
| | |
| | | public List<SysMenu> selectMenuTreeByUserId(Long userId) |
| | | { |
| | | List<SysMenu> menus = null; |
| | | if (SecurityUtils.isAdmin(userId)) |
| | | if (isAdmin(userId)) |
| | | { |
| | | menus = menuMapper.selectMenuTreeAll(); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 管理员既包括固定超级管理员用户,也包括显式绑定管理员角色的用户。 |
| | | */ |
| | | private boolean isAdmin(Long userId) |
| | | { |
| | | if (SysUser.isAdmin(userId)) |
| | | { |
| | | return true; |
| | | } |
| | | List<SysRole> roles = roleMapper.selectRolePermissionByUserId(userId); |
| | | if (roles != null) |
| | | { |
| | | for (SysRole role : roles) |
| | | { |
| | | if (role != null && role.isAdmin()) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 根据角色ID查询菜单树信息 |
| | | * |
| | | * @param roleId 角色ID |