fix(项目管理): 用户组添加的成员支持邮箱搜索并补充用例

--bug=1034870 --user=宋昌昌 【项目管理】-用户组成员列表搜索,使用邮箱搜索结果错误 https://www.tapd.cn/55049933/s/1456716
This commit is contained in:
song-cc-rock 2024-01-31 10:43:26 +08:00 committed by 刘瑞斌
parent 992c1d8f41
commit ce9537644d
4 changed files with 14 additions and 2 deletions

View File

@ -29,7 +29,9 @@
where u.deleted = 0 and urr.source_id = #{request.projectId}
and urr.role_id = #{request.userRoleId}
<if test="request.keyword != null and request.keyword != ''">
and u.name like concat('%', #{request.keyword}, '%')
and (
u.name like concat('%', #{request.keyword}, '%') or u.email like concat('%', #{request.keyword}, '%')
)
</if>
</select>

View File

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

View File

@ -19,7 +19,9 @@
where u.deleted = 0 and urr.source_id = #{request.organizationId}
and urr.role_id = #{request.userRoleId}
<if test="request.keyword != null and request.keyword != ''">
and u.name like concat('%', #{request.keyword}, '%')
and (
u.name like concat('%', #{request.keyword}, '%') or u.email like concat('%', #{request.keyword}, '%')
)
</if>
</select>
</mapper>

View File

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