|
@@ -191,7 +191,7 @@ public class SysMenuServiceImpl extends AbstractCrudService<SysMenuMapper, SysMe
|
|
|
* @return 菜单列表
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<SysMenu> selectMenuTreeByUserId1(Long userId,Integer platformId)
|
|
|
+ public List<SysMenu> selectMenuTreeByUserId1(Long userId,Long platformId)
|
|
|
{
|
|
|
List<SysMenu> menus = null;
|
|
|
if (1L == userId)
|
|
@@ -293,20 +293,14 @@ public class SysMenuServiceImpl extends AbstractCrudService<SysMenuMapper, SysMe
|
|
|
|
|
|
/**
|
|
|
* 构建前端路由所需要的菜单
|
|
|
- *
|
|
|
- * @param menus 菜单列表
|
|
|
* @return 路由列表
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<PlatformRouterVo> buildPlatformMenus(List<SysMenu> menus)
|
|
|
+ public List<PlatformRouterVo> buildPlatformMenus()
|
|
|
{
|
|
|
List<PlatformRouterVo> platformRouterVos = new LinkedList<PlatformRouterVo>();
|
|
|
- LambdaQueryWrapper<SysUserRole> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.in(SysUserRole::getUserId,SecurityUtils.getUserId());
|
|
|
- List<SysUserRole> userRoleList = sysUserRoleMapper.selectList(queryWrapper);
|
|
|
- if (CollectionUtils.isNotEmpty(userRoleList)){
|
|
|
- List<SysPlatformVo> sysPlatformVos = sysPlatformMapper.getRolePlatformList(SecurityUtils.getTenantId(),
|
|
|
- userRoleList.get(0).getRoleId().intValue());
|
|
|
+ if (SecurityUtils.getLoginUser().getSysUser().getUserType().equals("01")){
|
|
|
+ List<SysPlatformVo> sysPlatformVos = sysPlatformMapper.getTenantPlatformList(SecurityUtils.getTenantId());
|
|
|
if (CollectionUtils.isNotEmpty(sysPlatformVos)){
|
|
|
for (SysPlatformVo platformVo : sysPlatformVos)
|
|
|
{
|
|
@@ -314,8 +308,10 @@ public class SysMenuServiceImpl extends AbstractCrudService<SysMenuMapper, SysMe
|
|
|
platformRouterVo.setPlatformId(platformVo.getId());
|
|
|
platformRouterVo.setPlatformName(platformVo.getPlatformName());
|
|
|
platformRouterVo.setIcon(platformVo.getIcon());
|
|
|
+ List<SysMenu> menus1 = this.selectMenuTreeByUserIdOne1(SecurityUtils.getTenantId(),
|
|
|
+ platformVo.getId());
|
|
|
List<RouterVo> routers = new LinkedList<RouterVo>();
|
|
|
- for (SysMenu menu : menus)
|
|
|
+ for (SysMenu menu : menus1)
|
|
|
{
|
|
|
RouterVo router = new RouterVo();
|
|
|
router.setHidden("1".equals(menu.getVisible()));
|
|
@@ -362,6 +358,71 @@ public class SysMenuServiceImpl extends AbstractCrudService<SysMenuMapper, SysMe
|
|
|
platformRouterVos.add(platformRouterVo);
|
|
|
}
|
|
|
}
|
|
|
+ }else {
|
|
|
+ LambdaQueryWrapper<SysUserRole> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.in(SysUserRole::getUserId,SecurityUtils.getUserId());
|
|
|
+ List<SysUserRole> userRoleList = sysUserRoleMapper.selectList(queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(userRoleList)){
|
|
|
+ List<SysPlatformVo> sysPlatformVos = sysPlatformMapper.getRolePlatformList(SecurityUtils.getTenantId(),
|
|
|
+ userRoleList.get(0).getRoleId().intValue());
|
|
|
+ if (CollectionUtils.isNotEmpty(sysPlatformVos)){
|
|
|
+ for (SysPlatformVo platformVo : sysPlatformVos)
|
|
|
+ {
|
|
|
+ PlatformRouterVo platformRouterVo = new PlatformRouterVo();
|
|
|
+ platformRouterVo.setPlatformId(platformVo.getId());
|
|
|
+ platformRouterVo.setPlatformName(platformVo.getPlatformName());
|
|
|
+ platformRouterVo.setIcon(platformVo.getIcon());
|
|
|
+ List<SysMenu> menus1 = this.selectMenuTreeByUserId1(SecurityUtils.getUserId(),
|
|
|
+ platformVo.getId().longValue());
|
|
|
+ List<RouterVo> routers = new LinkedList<RouterVo>();
|
|
|
+ for (SysMenu menu : menus1)
|
|
|
+ {
|
|
|
+ RouterVo router = new RouterVo();
|
|
|
+ router.setHidden("1".equals(menu.getVisible()));
|
|
|
+ router.setName(getRouteName(menu));
|
|
|
+ router.setPath(getRouterPath(menu));
|
|
|
+ router.setComponent(getComponent(menu));
|
|
|
+ router.setMeta(new MetaVo(menu.getMenuName(), menu.getMenuAliasName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getIsFrame(), menu.getIsNew(), menu.getRemark()));
|
|
|
+ List<SysMenu> cMenus = menu.getChildren();
|
|
|
+ if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
|
|
+ {
|
|
|
+ router.setAlwaysShow(true);
|
|
|
+ router.setRedirect("noRedirect");
|
|
|
+ router.setChildren(buildMenus(cMenus));
|
|
|
+ }
|
|
|
+ else if (isMenuFrame(menu))
|
|
|
+ {
|
|
|
+ router.setMeta(null);
|
|
|
+ List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
|
|
+ RouterVo children = new RouterVo();
|
|
|
+ children.setPath(menu.getPath());
|
|
|
+ children.setComponent(menu.getComponent());
|
|
|
+ children.setName(StringUtils.capitalize(menu.getPath()));
|
|
|
+ children.setMeta(new MetaVo(menu.getMenuName(), menu.getMenuAliasName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getIsFrame(), menu.getIsNew(), menu.getRemark()));
|
|
|
+ childrenList.add(children);
|
|
|
+ router.setChildren(childrenList);
|
|
|
+ }
|
|
|
+ else if (menu.getParentId().intValue() == 0 && isInnerLink(menu))
|
|
|
+ {
|
|
|
+ router.setMeta(new MetaVo(menu.getMenuName(), menu.getMenuAliasName(), menu.getIcon(), menu.getIsFrame(), menu.getIsNew(), menu.getRemark()));
|
|
|
+ router.setPath("/inner");
|
|
|
+ List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
|
|
+ RouterVo children = new RouterVo();
|
|
|
+ String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
|
|
|
+ children.setPath(routerPath);
|
|
|
+ children.setComponent(UserConstants.INNER_LINK);
|
|
|
+ children.setName(StringUtils.capitalize(routerPath));
|
|
|
+ children.setMeta(new MetaVo(menu.getMenuName(), menu.getMenuAliasName(), menu.getIcon(), menu.getPath(), menu.getIsFrame(), menu.getIsNew(), menu.getRemark()));
|
|
|
+ childrenList.add(children);
|
|
|
+ router.setChildren(childrenList);
|
|
|
+ }
|
|
|
+ routers.add(router);
|
|
|
+ }
|
|
|
+ platformRouterVo.setRouterVos(routers);
|
|
|
+ platformRouterVos.add(platformRouterVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return platformRouterVos;
|
|
|
}
|
|
@@ -815,4 +876,22 @@ public class SysMenuServiceImpl extends AbstractCrudService<SysMenuMapper, SysMe
|
|
|
{
|
|
|
return getChildMobileList(list, t).size() > 0 ? true : false;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<TenantPlatformMenuVo> selectRolePlatformMenu(Long roleId)
|
|
|
+ {
|
|
|
+ List<TenantPlatformMenuVo> list1 = new ArrayList<>();
|
|
|
+ List<SysPlatformVo> list = sysPlatformMapper.getTenantPlatformList(SecurityUtils.getTenantId());
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
+ TenantPlatformMenuVo tenantPlatformMenuVo = new TenantPlatformMenuVo();
|
|
|
+ tenantPlatformMenuVo.setId(list.get(i).getId());
|
|
|
+ tenantPlatformMenuVo.setLabel(list.get(i).getPlatformName());
|
|
|
+ List<SysMenu> menus = baseMapper.getTenantPlatformMenuList(SecurityUtils.getTenantId(),list.get(i).getId());
|
|
|
+ tenantPlatformMenuVo.setChildren(this.buildMenuTreeSelect(menus));
|
|
|
+ list1.add(tenantPlatformMenuVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list1;
|
|
|
+ }
|
|
|
}
|