|
|
|
|
@ -1,34 +1,10 @@ |
|
|
|
|
/** |
|
|
|
|
* BladeX Commercial License Agreement |
|
|
|
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
|
|
|
|
* <p> |
|
|
|
|
* Use of this software is governed by the Commercial License Agreement |
|
|
|
|
* obtained after purchasing a license from BladeX. |
|
|
|
|
* <p> |
|
|
|
|
* 1. This software is for development use only under a valid license |
|
|
|
|
* from BladeX. |
|
|
|
|
* <p> |
|
|
|
|
* 2. Redistribution of this software's source code to any third party |
|
|
|
|
* without a commercial license is strictly prohibited. |
|
|
|
|
* <p> |
|
|
|
|
* 3. Licensees may copyright their own code but cannot use segments |
|
|
|
|
* from this software for such purposes. Copyright of this software |
|
|
|
|
* remains with BladeX. |
|
|
|
|
* <p> |
|
|
|
|
* Using this software signifies agreement to this License, and the software |
|
|
|
|
* must not be used for illegal purposes. |
|
|
|
|
* <p> |
|
|
|
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
|
|
|
|
* not liable for any claims arising from secondary or illegal development. |
|
|
|
|
* <p> |
|
|
|
|
* Author: Chill Zhuang (bladejava@qq.com) |
|
|
|
|
*/ |
|
|
|
|
package com.nov.KgLowDurable.service.Impl; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import com.nov.KgLowDurable.constant.RoleConstant; |
|
|
|
|
import com.nov.KgLowDurable.exception.ServiceException; |
|
|
|
|
import com.nov.KgLowDurable.mapper.RoleMapper; |
|
|
|
|
import com.nov.KgLowDurable.pojo.entity.Role; |
|
|
|
|
@ -78,15 +54,15 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR |
|
|
|
|
|
|
|
|
|
private boolean grantRoleMenu(List<Long> roleIds, List<Long> menuIds) { |
|
|
|
|
// 防止越权配置超管角色
|
|
|
|
|
Integer administratorCount = baseMapper.selectCount(Wrappers.<Role>query().lambda().in(Role::getId, roleIds)); |
|
|
|
|
if (administratorCount > 0L) { |
|
|
|
|
throw new ServiceException("无权配置超管角色!"); |
|
|
|
|
} |
|
|
|
|
// Integer administratorCount = baseMapper.selectCount(Wrappers.<Role>query().lambda().eq(Role::getCode, RoleConstant.ADMINISTRATOR).in(Role::getId, roleIds));
|
|
|
|
|
// if (administratorCount > 0L) {
|
|
|
|
|
// throw new ServiceException("无权配置超管角色!");
|
|
|
|
|
// }
|
|
|
|
|
// 防止越权配置管理员角色
|
|
|
|
|
Integer adminCount = baseMapper.selectCount(Wrappers.<Role>query().lambda().in(Role::getId, roleIds)); |
|
|
|
|
if ( adminCount > 0L) { |
|
|
|
|
throw new ServiceException("无权配置管理员角色!"); |
|
|
|
|
} |
|
|
|
|
// Integer adminCount = baseMapper.selectCount(Wrappers.<Role>query().lambda().eq(Role::getCode, RoleConstant.ADMIN).in(Role::getId, roleIds));
|
|
|
|
|
// if ( adminCount > 0L) {
|
|
|
|
|
// throw new ServiceException("无权配置管理员角色!");
|
|
|
|
|
// }
|
|
|
|
|
// 删除角色配置的菜单集合
|
|
|
|
|
roleMenuService.remove(Wrappers.<RoleMenu>update().lambda().in(RoleMenu::getRoleId, roleIds)); |
|
|
|
|
// 组装配置
|
|
|
|
|
|