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);