fix(系统设置): 用户组成员列表删除用户过滤

--bug=1029699 --user=宋昌昌 系统设置-组织-用户组-成员列表删除用户未过滤 https://www.tapd.cn/55049933/s/1409625
This commit is contained in:
song-cc-rock 2023-08-29 16:35:33 +08:00 committed by f2c-ci-robot[bot]
parent 0ba8e85b45
commit d0ba1c4c1e
3 changed files with 6 additions and 9 deletions

View File

@ -16,10 +16,10 @@
<select id="listOrganizationRoleMember" resultType="io.metersphere.system.domain.User">
select u.*
from user_role_relation urr left join user u on urr.user_id = u.id
where urr.source_id = #{request.organizationId}
where u.deleted = 0 and urr.source_id = #{request.organizationId}
and urr.role_id = #{request.userRoleId}
<if test="request.userKeyWord != null and request.userKeyWord != ''">
and u.name like concat('%', #{request.userKeyWord}, '%')
<if test="request.keyword != null and request.keyword != ''">
and u.name like concat('%', #{request.keyword}, '%')
</if>
</select>
</mapper>

View File

@ -20,7 +20,4 @@ public class OrganizationUserRoleMemberRequest extends BasePageRequest {
@NotBlank(message = "{organization.id.not_blank}")
@Size(min = 1, max = 50, message = "{organization.id.length_range}")
private String organizationId;
@Schema(description = "搜索关键字")
private String userKeyWord;
}

View File

@ -242,7 +242,7 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
OrganizationUserRoleMemberRequest request = new OrganizationUserRoleMemberRequest();
request.setOrganizationId("default-organization-2");
request.setUserRoleId("default-org-role-id-3");
request.setUserKeyWord("admin");
request.setKeyword("admin");
request.setCurrent(1);
request.setPageSize(10);
MvcResult mvcResult = this.responsePost(ORGANIZATION_USER_ROLE_LIST_MEMBER, request);
@ -262,8 +262,8 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class);
if(CollectionUtils.isNotEmpty(userList)) {
User user = userList.get(0);
Assertions.assertTrue(StringUtils.contains(user.getName(), request.getUserKeyWord())
|| StringUtils.contains(user.getId(), request.getUserKeyWord()));
Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword())
|| StringUtils.contains(user.getId(), request.getKeyword()));
}
// 权限校验
request.setOrganizationId(getDefault().getId());