From c6e6132651a6b64e9217c37cfb412697ca0a7b65 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Mon, 4 Sep 2023 16:33:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E7=BB=84=E7=BB=87=E6=97=A5=E5=BF=97-=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=A5=E5=8F=A3=E6=94=AF=E6=8C=81=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/OrganizationLogController.java | 7 +++++-- .../java/io/metersphere/system/mapper/ExtUserMapper.java | 2 +- .../java/io/metersphere/system/mapper/ExtUserMapper.xml | 5 +++++ .../java/io/metersphere/system/service/UserService.java | 4 ++-- .../system/controller/OrganizationLogControllerTests.java | 3 ++- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationLogController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationLogController.java index e010957670..bb9589d5f8 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationLogController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationLogController.java @@ -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 getLogUserList(@PathVariable(value = "organizationId") String organizationId) { - return userService.getUserListByOrgId(organizationId); + public List getLogUserList(@PathVariable(value = "organizationId") String organizationId, + @Schema(description = "查询关键字,根据邮箱和用户名查询") + @RequestParam(value = "keyword", required = false) String keyword) { + return userService.getUserListByOrgId(organizationId,keyword); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.java index 4f05cf1e54..cdb6ab9c88 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.java @@ -10,7 +10,7 @@ public interface ExtUserMapper { List getMemberOption(String sourceId); - List getUserListByOrgId(@Param("sourceId") String sourceId); + List getUserListByOrgId(@Param("sourceId") String sourceId, @Param("keyword") String keyword); List selectUserList(@Param("keyword") String keyword); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.xml index 2ceaf81510..ddc94b9ac5 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.xml @@ -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 + + and (LOCATE(#{keyword},name)>0 or LOCATE(#{keyword},email)>0) + + order by u.create_time desc + limit 100