refactor(系统设置): 组织日志-查询用户接口支持远程搜索
This commit is contained in:
parent
2b0800cf9c
commit
c6e6132651
|
@ -16,6 +16,7 @@ import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse;
|
|||
import io.metersphere.system.service.SystemProjectService;
|
||||
import io.metersphere.system.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -62,8 +63,10 @@ public class OrganizationLogController {
|
|||
@GetMapping("/user/list/{organizationId}")
|
||||
@Operation(summary = "系统设置-组织-日志-获取用户列表")
|
||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_LOG_READ)
|
||||
public List<User> getLogUserList(@PathVariable(value = "organizationId") String organizationId) {
|
||||
return userService.getUserListByOrgId(organizationId);
|
||||
public List<User> getLogUserList(@PathVariable(value = "organizationId") String organizationId,
|
||||
@Schema(description = "查询关键字,根据邮箱和用户名查询")
|
||||
@RequestParam(value = "keyword", required = false) String keyword) {
|
||||
return userService.getUserListByOrgId(organizationId,keyword);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ public interface ExtUserMapper {
|
|||
|
||||
List<UserExtend> getMemberOption(String sourceId);
|
||||
|
||||
List<User> getUserListByOrgId(@Param("sourceId") String sourceId);
|
||||
List<User> getUserListByOrgId(@Param("sourceId") String sourceId, @Param("keyword") String keyword);
|
||||
|
||||
List<User> selectUserList(@Param("keyword") String keyword);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
LEFT JOIN user_role_relation urr ON u.id = urr.user_id
|
||||
WHERE
|
||||
urr.source_id = #{sourceId} and u.deleted = false
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and (LOCATE(#{keyword},name)>0 or LOCATE(#{keyword},email)>0)
|
||||
</if>
|
||||
order by u.create_time desc
|
||||
limit 100
|
||||
</select>
|
||||
|
||||
<select id="selectUserList" resultType="io.metersphere.system.domain.User">
|
||||
|
|
|
@ -357,7 +357,7 @@ public class UserService {
|
|||
}
|
||||
|
||||
|
||||
public List<User> getUserListByOrgId(String organizationId) {
|
||||
return extUserMapper.getUserListByOrgId(organizationId);
|
||||
public List<User> getUserListByOrgId(String organizationId, String keyword) {
|
||||
return extUserMapper.getUserListByOrgId(organizationId, keyword);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ public class OrganizationLogControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(2)
|
||||
public void testOrganizationUserList() throws Exception {
|
||||
this.requestGetWithOkAndReturn(ORGANIZATION_USER_LIST + "/organization_id_001");
|
||||
String keyword = "o";
|
||||
this.requestGetWithOkAndReturn(ORGANIZATION_USER_LIST+ "/organization_id_001" + "?keyword=" + keyword);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue