| | |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.exception.CustomException; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | |
| | | @Override |
| | | public void checkRoleAllowed(SysRole role) { |
| | | if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) { |
| | | throw new CustomException("不允许操作超级管理员角色"); |
| | | throw new ServiceException("不允许操作超级管理员角色"); |
| | | } |
| | | } |
| | | |
| | |
| | | checkRoleAllowed(new SysRole(roleId)); |
| | | SysRole role = selectRoleById(roleId); |
| | | if (countUserRoleByRoleId(roleId) > 0) { |
| | | throw new CustomException(String.format("%1$s已分配,不能删除", role.getRoleName())); |
| | | throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); |
| | | } |
| | | } |
| | | List<Long> ids = Arrays.asList(roleIds); |