diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/GlobalUserRoleService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/GlobalUserRoleService.java index 646a4c762d..99c46b019f 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/GlobalUserRoleService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/GlobalUserRoleService.java @@ -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()) diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/GlobalUserRoleControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/GlobalUserRoleControllerTests.java index eaf7aefe84..5a20b3e74d 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/GlobalUserRoleControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/GlobalUserRoleControllerTests.java @@ -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);