| | |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | |
| | | .orderByAsc(SysMenu::getParentId) |
| | | .orderByAsc(SysMenu::getOrderNum)); |
| | | } else { |
| | | menu.getParams().put("userId", userId); |
| | | menuList = baseMapper.selectMenuListByUserId(menu); |
| | | QueryWrapper<SysMenu> wrapper = Wrappers.query(); |
| | | wrapper.eq("ur.user_id", userId) |
| | | .like(StringUtils.isNotBlank(menu.getMenuName()), "m.menu_name", menu.getMenuName()) |
| | | .eq(StringUtils.isNotBlank(menu.getVisible()), "m.visible", menu.getVisible()) |
| | | .eq(StringUtils.isNotBlank(menu.getStatus()), "m.status", menu.getStatus()) |
| | | .orderByAsc("m.parent_id") |
| | | .orderByAsc("m.order_num"); |
| | | menuList = baseMapper.selectMenuListByUserId(wrapper); |
| | | } |
| | | return menuList; |
| | | } |
| | |
| | | router.setName(getRouteName(menu)); |
| | | router.setPath(getRouterPath(menu)); |
| | | router.setComponent(getComponent(menu)); |
| | | router.setQuery(menu.getQuery()); |
| | | router.setQuery(menu.getQueryParam()); |
| | | router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); |
| | | List<SysMenu> cMenus = (List<SysMenu>) menu.getChildren(); |
| | | List<SysMenu> cMenus = menu.getChildren(); |
| | | if (!cMenus.isEmpty() && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { |
| | | router.setAlwaysShow(true); |
| | | router.setRedirect("noRedirect"); |
| | |
| | | children.setComponent(menu.getComponent()); |
| | | children.setName(StringUtils.capitalize(menu.getPath())); |
| | | children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); |
| | | children.setQuery(menu.getQuery()); |
| | | children.setQuery(menu.getQueryParam()); |
| | | childrenList.add(children); |
| | | router.setChildren(childrenList); |
| | | } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { |
| | | router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); |
| | | router.setPath("/inner"); |
| | | router.setPath("/"); |
| | | List<RouterVo> childrenList = new ArrayList<RouterVo>(); |
| | | RouterVo children = new RouterVo(); |
| | | String routerPath = innerLinkReplaceEach(menu.getPath()); |