From ce9537644debbb9a79f61b25e30d9a0cab35558d Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Wed, 31 Jan 2024 10:43:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=BB=84=E6=B7=BB=E5=8A=A0=E7=9A=84=E6=88=90?= =?UTF-8?q?=E5=91=98=E6=94=AF=E6=8C=81=E9=82=AE=E7=AE=B1=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=B9=B6=E8=A1=A5=E5=85=85=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1034870 --user=宋昌昌 【项目管理】-用户组成员列表搜索,使用邮箱搜索结果错误 https://www.tapd.cn/55049933/s/1456716 --- .../metersphere/project/mapper/ExtProjectUserRoleMapper.xml | 4 +++- .../project/controller/ProjectUserRoleControllerTests.java | 4 ++++ .../java/io/metersphere/system/mapper/ExtUserRoleMapper.xml | 4 +++- .../controller/OrganizationUserRoleControllerTests.java | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml index 8441e6c090..7bf30b1ac6 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml @@ -29,7 +29,9 @@ where u.deleted = 0 and urr.source_id = #{request.projectId} and urr.role_id = #{request.userRoleId} - and u.name like concat('%', #{request.keyword}, '%') + and ( + u.name like concat('%', #{request.keyword}, '%') or u.email like concat('%', #{request.keyword}, '%') + ) diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java index aca30e150d..c74d83149b 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java @@ -304,6 +304,10 @@ public class ProjectUserRoleControllerTests extends BaseTest { Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword()) || StringUtils.contains(user.getId(), request.getKeyword())); } + + // email搜索 + request.setKeyword("admin@"); + this.requestPost(PROJECT_USER_ROLE_LIST_MEMBER, request).andExpect(status().isOk()); // 权限校验 request.setProjectId(DEFAULT_PROJECT_ID); requestPostPermissionTest(PermissionConstants.PROJECT_GROUP_READ, PROJECT_USER_ROLE_LIST_MEMBER, request); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserRoleMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserRoleMapper.xml index e34c59ed66..89b5d6d715 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserRoleMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserRoleMapper.xml @@ -19,7 +19,9 @@ where u.deleted = 0 and urr.source_id = #{request.organizationId} and urr.role_id = #{request.userRoleId} - and u.name like concat('%', #{request.keyword}, '%') + and ( + u.name like concat('%', #{request.keyword}, '%') or u.email like concat('%', #{request.keyword}, '%') + ) \ No newline at end of file diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationUserRoleControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationUserRoleControllerTests.java index 44db407bfe..802f7f46b6 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationUserRoleControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationUserRoleControllerTests.java @@ -266,6 +266,10 @@ public class OrganizationUserRoleControllerTests extends BaseTest { Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword()) || StringUtils.contains(user.getId(), request.getKeyword())); } + // email搜索 + request.setKeyword("admin@"); + this.requestPost(ORGANIZATION_USER_ROLE_LIST_MEMBER, request).andExpect(status().isOk()); + // 权限校验 request.setOrganizationId(getDefault().getId()); requestPostPermissionsTest(List.of(PermissionConstants.ORGANIZATION_USER_ROLE_READ, PermissionConstants.ORGANIZATION_MEMBER_READ), ORGANIZATION_USER_ROLE_LIST_MEMBER, request);