Commit 1c3c9d10 by huangjinxin

feat:重写角色修改

1 parent 5bdc2b37
...@@ -49,7 +49,8 @@ public class RoleController implements IRole { ...@@ -49,7 +49,8 @@ public class RoleController implements IRole {
@Override @Override
public Result<RoleInfo> updateRole(@Validated RoleInfo roleInfo) { public Result<RoleInfo> updateRole(@Validated RoleInfo roleInfo) {
return roleService.updateRole(roleInfo); roleInfo = roleService.updateRole(roleInfo);
return Result.success(roleInfo);
} }
@Override @Override
......
...@@ -101,10 +101,11 @@ public class RoleService { ...@@ -101,10 +101,11 @@ public class RoleService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result<RoleInfo> updateRole(RoleInfo roleInfo) { public RoleInfo updateRole(RoleInfo roleInfo) {
RoleEntity entity = roleDao.findById(roleInfo.getId()).orElse(null); RoleEntity entity = roleDao.findById(roleInfo.getId()).orElse(null);
if (ObjectUtil.isEmpty(entity)) { if (ObjectUtil.isEmpty(entity)) {
return Result.failed(StatusCodeEnum.ROLE_DOES_NOT_EXIST, null); // return Result.failed(StatusCodeEnum.ROLE_DOES_NOT_EXIST, null);
return roleInfo;
} }
RoleEntity roleEntity = BeanUtil.copyProperties(roleInfo, RoleEntity.class); RoleEntity roleEntity = BeanUtil.copyProperties(roleInfo, RoleEntity.class);
roleEntity.setCreatedBy(entity.getCreatedBy()); roleEntity.setCreatedBy(entity.getCreatedBy());
...@@ -120,7 +121,7 @@ public class RoleService { ...@@ -120,7 +121,7 @@ public class RoleService {
} }
} }
roleInfo = BeanUtil.copyProperties(roleEntity, RoleInfo.class); roleInfo = BeanUtil.copyProperties(roleEntity, RoleInfo.class);
return Result.success(roleInfo); return roleInfo;
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!