| | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.ruoyi.domain.ZfAncestor; |
| | | import com.ruoyi.service.ZfAncestorService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.common.constant.Constants; |
| | |
| | | @Autowired |
| | | private SysRoleMenuMapper roleMenuMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private ZfAncestorService zfService; |
| | | |
| | | /** |
| | | * 根据用户查询系统菜单列表 |
| | | * |
| | |
| | | { |
| | | List<SysMenu> menuList = null; |
| | | // 管理员显示所有菜单信息 |
| | | if (SysUser.isAdmin(userId)) |
| | | { |
| | | menuList = menuMapper.selectMenuList(menu); |
| | | } |
| | | else |
| | | // if (SysUser.isAdmin(userId)) |
| | | // { |
| | | // menuList = menuMapper.selectMenuList(menu); |
| | | // } |
| | | // else |
| | | { |
| | | menu.getParams().put("userId", userId); |
| | | menuList = menuMapper.selectMenuListByUserId(menu); |
| | |
| | | public List<SysMenu> selectMenuTreeByUserId(Long userId) |
| | | { |
| | | List<SysMenu> menus = null; |
| | | if (SecurityUtils.isAdmin(userId)) |
| | | ZfAncestor zfAncestor = new ZfAncestor(); |
| | | zfAncestor.setSysId(userId); |
| | | zfAncestor = zfService.selectZfAncestor(zfAncestor); |
| | | System.out.println("---------++++++++____________"); |
| | | System.out.println(zfAncestor); |
| | | //判断是否是超级管理员 |
| | | if(zfAncestor!=null && zfAncestor.getId()==1L && zfAncestor.getRoleId()==0L) |
| | | { |
| | | //如果是超级管理员,把左侧所有的目录和菜单都查出来 |
| | | menus = menuMapper.selectMenuTreeAllSuperAdmin(); |
| | | |
| | | } |
| | | else if(zfAncestor!=null && zfAncestor.getRoleId()==2) |
| | | { |
| | | //如果是普通管理员,把普通管理员的菜单显示出来 |
| | | menus = menuMapper.selectMenuTreeAll(); |
| | | } |
| | | else |