| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | |
| | | @Override |
| | | public void removeRole(Long id) { |
| | | SysRole sysRole = this.getById(id); |
| | | SysRole sysRole = baseMapper.selectRoleById(id); |
| | | Long count = userRoleMapper.selectCount( |
| | | Wrappers.lambdaQuery(SysUserRole.class).eq(SysUserRole::getRoleId, id)); |
| | | if (count > 0) { |
| | | throw new ServiceException("角色已绑定账号,不能删除"); |
| | | } |
| | | if (StringUtils.isNull(sysRole)) { |
| | | throw new ServiceException("角色不存在"); |
| | | } |