| | |
| | | package com.ruoyi.project.system.service.impl;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | | import java.util.LinkedList;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | | import java.util.stream.Collectors;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | |
| | | import com.ruoyi.project.system.mapper.SysRoleMapper;
|
| | | import com.ruoyi.project.system.mapper.SysRoleMenuMapper;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.*;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * 菜单 业务层处理
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Service
|
| | | @RequiredArgsConstructor
|
| | | public class SysMenuServiceImpl implements ISysMenuService
|
| | | {
|
| | | public static final String PREMISSION_STRING = "perms[\"{0}\"]";
|
| | |
|
| | | @Autowired
|
| | | private SysMenuMapper menuMapper;
|
| | |
|
| | | @Autowired
|
| | | private SysRoleMapper roleMapper;
|
| | |
|
| | | @Autowired
|
| | | private SysRoleMenuMapper roleMenuMapper;
|
| | | private final SysMenuMapper menuMapper;
|
| | | private final SysRoleMapper roleMapper;
|
| | | private final SysRoleMenuMapper roleMenuMapper;
|
| | |
|
| | | /**
|
| | | * 根据用户查询系统菜单列表
|
| | |
| | | router.setName(getRouteName(menu));
|
| | | router.setPath(getRouterPath(menu));
|
| | | router.setComponent(getComponent(menu));
|
| | | router.setAppComponent(menu.getAppComponent());
|
| | | router.setQuery(menu.getQuery());
|
| | | router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
| | | List<SysMenu> cMenus = menu.getChildren();
|
| | |
| | | List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
| | | RouterVo children = new RouterVo();
|
| | | children.setPath(menu.getPath());
|
| | | children.setAppComponent(menu.getAppComponent());
|
| | | children.setComponent(menu.getComponent());
|
| | | children.setName(getRouteName(menu.getRouteName(), menu.getPath()));
|
| | | children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
| | |
| | | RouterVo children = new RouterVo();
|
| | | String routerPath = innerLinkReplaceEach(menu.getPath());
|
| | | children.setPath(routerPath);
|
| | | children.setAppComponent(menu.getAppComponent());
|
| | | children.setComponent(UserConstants.INNER_LINK);
|
| | | children.setName(getRouteName(menu.getRouteName(), routerPath));
|
| | | children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath()));
|
| | |
| | | /**
|
| | | * 获取路由名称,如没有配置路由名称则取路由地址
|
| | | *
|
| | | * @param routerName 路由名称
|
| | | * @param name 路由名称
|
| | | * @param path 路由地址
|
| | | * @return 路由名称(驼峰格式)
|
| | | */
|
| | |
| | | return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType())
|
| | | && menu.getIsFrame().equals(UserConstants.NO_FRAME);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 是否为parent_view组件
|
| | | *
|