【7.6.0】【sys】【role】更新修改角色接口

pull/55/MERGE
fengshuonan 2023-06-12 20:51:35 +08:00
parent e4cc2bad49
commit f5fce2c4cd
2 changed files with 12 additions and 1 deletions

View File

@ -16,7 +16,12 @@ public enum SysRoleExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
SYS_ROLE_NOT_EXISTED(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "查询结果不存在");
SYS_ROLE_NOT_EXISTED(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "查询结果不存在"),
/**
*
*/
SUPER_ADMIN_ROLE_CODE_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10002", "角色编码不能被修改");
/**
*

View File

@ -49,6 +49,12 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
@Override
public void edit(SysRoleRequest sysRoleRequest) {
SysRole sysRole = this.querySysRole(sysRoleRequest);
// 不允许修改角色编码
if (!sysRole.getRoleCode().equals(sysRoleRequest.getRoleCode())) {
throw new ServiceException(SysRoleExceptionEnum.SUPER_ADMIN_ROLE_CODE_ERROR);
}
BeanUtil.copyProperties(sysRoleRequest, sysRole);
this.updateById(sysRole);
}