refactor(系统设置): 用户组更新接口不传name会报错

--bug=1029536 --user=陈建星 系统设置-用户组-后台问题汇总 https://www.tapd.cn/55049933/s/1411174
This commit is contained in:
AgAngle 2023-09-01 11:42:00 +08:00 committed by fit2-zhao
parent 7e4bbd595d
commit db472f10a3
2 changed files with 9 additions and 0 deletions

View File

@ -87,6 +87,10 @@ public class GlobalUserRoleService extends BaseUserRoleService {
}
public void checkExist(UserRole userRole) {
if (StringUtils.isBlank(userRole.getName())) {
return;
}
UserRoleExample example = new UserRoleExample();
UserRoleExample.Criteria criteria = example.createCriteria()
.andNameEqualTo(userRole.getName())

View File

@ -116,6 +116,11 @@ class GlobalUserRoleControllerTests extends BaseTest {
Assertions.assertEquals(request.getType(), userRoleResult.getType());
Assertions.assertEquals(request.getDescription(), userRoleResult.getDescription());
// 不修改信息
UserRoleUpdateRequest emptyRequest = new UserRoleUpdateRequest();
emptyRequest.setId(addUserRole.getId());
this.requestPostWithOk(DEFAULT_UPDATE, emptyRequest);
// @@校验日志
checkLog(request.getId(), OperationLogType.UPDATE);