|
|
|
@ -24,7 +24,6 @@ import lombok.AllArgsConstructor;
|
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.utils.SecureUtil; |
|
|
|
|
import org.springblade.core.tool.constant.BladeConstant; |
|
|
|
|
import org.springblade.core.tool.constant.RoleConstant; |
|
|
|
|
import org.springblade.core.tool.node.ForestNodeMerger; |
|
|
|
|
import org.springblade.core.tool.support.Kv; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
@ -72,10 +71,8 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
|
|
|
|
|
if (StringUtil.isBlank(roleId)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
String userRole = SecureUtil.getUserRole(); |
|
|
|
|
boolean isAdministrator = StringUtil.containsAny(userRole, RoleConstant.ADMINISTRATOR); |
|
|
|
|
List<Menu> allMenus = baseMapper.allMenu(); |
|
|
|
|
List<Menu> roleMenus = baseMapper.roleMenu(Func.toLongList(roleId), topMenuId); |
|
|
|
|
List<Menu> roleMenus = (SecureUtil.isAdministrator()) ? allMenus : baseMapper.roleMenu(Func.toLongList(roleId), topMenuId); |
|
|
|
|
return buildRoutes(allMenus, roleMenus); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -98,7 +95,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<MenuVO> buttons(String roleId) { |
|
|
|
|
List<Menu> buttons = baseMapper.buttons(Func.toLongList(roleId)); |
|
|
|
|
List<Menu> buttons = (SecureUtil.isAdministrator()) ? baseMapper.allButtons() : baseMapper.buttons(Func.toLongList(roleId)); |
|
|
|
|
MenuWrapper menuWrapper = new MenuWrapper(); |
|
|
|
|
return menuWrapper.listNodeVO(buttons); |
|
|
|
|
} |
|
|
|
|