update 优化 角色编辑状态未校验问题

This commit is contained in:
疯狂的狮子Li
2024-08-15 20:00:19 +08:00
parent d764c6a823
commit 26447cc5c0

View File

@@ -293,6 +293,10 @@ public class SysRoleServiceImpl implements ISysRoleService {
@Transactional(rollbackFor = Exception.class)
public int updateRole(SysRoleBo bo) {
SysRole role = MapstructUtils.convert(bo, SysRole.class);
if (UserConstants.ROLE_DISABLE.equals(role.getStatus()) && this.countUserRoleByRoleId(role.getRoleId()) > 0) {
throw new ServiceException("角色已分配,不能禁用!");
}
// 修改角色信息
baseMapper.updateById(role);
// 删除角色与菜单关联