diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemOrganizationController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemOrganizationController.java index 456c48d4ad..a1903b95cc 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemOrganizationController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemOrganizationController.java @@ -118,7 +118,9 @@ public class SystemOrganizationController { @Operation(summary = "系统设置-系统-组织与项目-获取成员下拉选项") @RequiresPermissions(value = {PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ}) @Parameter(name = "sourceId", description = "组织ID或项目ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) - public List getMemberOption(@PathVariable String sourceId) { - return userService.getMemberOption(sourceId); + public List getMemberOption(@PathVariable String sourceId, + @Schema(description = "查询关键字,根据邮箱和用户名查询") + @RequestParam(value = "keyword", required = false) String keyword) { + return userService.getMemberOption(sourceId, 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 cdb6ab9c88..db23176211 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 @@ -8,7 +8,7 @@ import java.util.List; public interface ExtUserMapper { - List getMemberOption(String sourceId); + List getMemberOption(@Param("sourceId") String sourceId, @Param("keyword") String keyword); List getUserListByOrgId(@Param("sourceId") String sourceId, @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 ddc94b9ac5..a2c4bab3f8 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 @@ -5,7 +5,11 @@ select distinct u.*, count(urr.id) > 0 as memberFlag from `user` u left join user_role_relation urr on urr.user_id = u.id and urr.source_id = #{sourceId} where u.deleted = 0 + + and (u.name like concat('%', #{keyword}, '%') or u.email like concat('%', #{keyword}, '%')) + group by u.id + limit 100