From db472f10a3ac09870ee45f120d4fa93a60cc7ea2 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Fri, 1 Sep 2023 11:42:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E7=BB=84=E6=9B=B4=E6=96=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=B8=8D=E4=BC=A0name=E4=BC=9A=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1029536 --user=陈建星 系统设置-用户组-后台问题汇总 https://www.tapd.cn/55049933/s/1411174 --- .../io/metersphere/system/service/GlobalUserRoleService.java | 4 ++++ .../system/controller/GlobalUserRoleControllerTests.java | 5 +++++ 2 files changed, 9 insertions(+) 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);