mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】【role】更新修改角色接口
parent
e4cc2bad49
commit
f5fce2c4cd
|
@ -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", "角色编码不能被修改");
|
||||
|
||||
/**
|
||||
* 错误编码
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue