diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewMapper.xml
index 3fa461e03d..2a574c94e2 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewMapper.xml
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewMapper.xml
@@ -63,8 +63,8 @@
and (
- case_review.name like concat('%', #{request.keyword},'%')
- or case_review.num like concat('%', #{request.keyword},'%')
+ case_review.name like concat('%', #{request.condition.keyword},'%')
+ or case_review.num like concat('%', #{request.condition.keyword},'%')
)
diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.java b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.java
index 6231f5f0d0..14b840a355 100644
--- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.java
+++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.java
@@ -1,11 +1,12 @@
package io.metersphere.project.mapper;
import io.metersphere.project.dto.ProjectUserRoleDTO;
+import io.metersphere.project.request.ProjectMemberBatchDeleteRequest;
import io.metersphere.project.request.ProjectUserRoleMemberRequest;
import io.metersphere.project.request.ProjectUserRoleRequest;
-import io.metersphere.system.dto.sdk.OptionDTO;
import io.metersphere.system.domain.User;
import io.metersphere.system.domain.UserRoleRelation;
+import io.metersphere.system.dto.sdk.OptionDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -55,4 +56,6 @@ public interface ExtProjectUserRoleMapper {
* @return List
*/
List getProjectUserSelectList(@Param("projectId") String projectId, @Param("keyword") String keyword);
+
+ ListgetProjectRoleMemberIds(@Param("request") ProjectMemberBatchDeleteRequest request);
}
diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml
index 3e8b929abc..c561598bc6 100644
--- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml
+++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectUserRoleMapper.xml
@@ -63,4 +63,42 @@
order by u.update_time desc
limit 100
+
+
+
+
+
+ and (
+ u.name like concat('%', #{request.condition.keyword}, '%')
+ or u.email like concat('%', #{request.condition.keyword}, '%')
+ or u.phone like concat('%', #{request.condition.keyword}, '%')
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and urr.role_id in
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/request/ProjectMemberBatchDeleteRequest.java b/backend/services/project-management/src/main/java/io/metersphere/project/request/ProjectMemberBatchDeleteRequest.java
index 4619eaf49a..e2d9feca1f 100644
--- a/backend/services/project-management/src/main/java/io/metersphere/project/request/ProjectMemberBatchDeleteRequest.java
+++ b/backend/services/project-management/src/main/java/io/metersphere/project/request/ProjectMemberBatchDeleteRequest.java
@@ -1,26 +1,20 @@
package io.metersphere.project.request;
+import io.metersphere.system.dto.table.TableBatchProcessDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
-import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import lombok.EqualsAndHashCode;
-import java.io.Serializable;
-import java.util.List;
-
/**
* @author song-cc-rock
*/
@Data
@EqualsAndHashCode(callSuper = false)
-public class ProjectMemberBatchDeleteRequest implements Serializable {
+public class ProjectMemberBatchDeleteRequest extends TableBatchProcessDTO {
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{project.id.not_blank}")
private String projectId;
- @Schema(description = "用户ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotEmpty(message = "{user.id.not_blank}")
- private List userIds;
}
diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectMemberService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectMemberService.java
index f5ee0750a8..4e1e640955 100644
--- a/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectMemberService.java
+++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectMemberService.java
@@ -3,6 +3,7 @@ package io.metersphere.project.service;
import io.metersphere.project.domain.Project;
import io.metersphere.project.dto.ProjectUserDTO;
import io.metersphere.project.mapper.ExtProjectMemberMapper;
+import io.metersphere.project.mapper.ExtProjectUserRoleMapper;
import io.metersphere.project.mapper.ProjectMapper;
import io.metersphere.project.request.ProjectMemberAddRequest;
import io.metersphere.project.request.ProjectMemberBatchDeleteRequest;
@@ -56,6 +57,8 @@ public class ProjectMemberService {
private ExtProjectMemberMapper extProjectMemberMapper;
@Resource
private OperationLogService operationLogService;
+ @Resource
+ private ExtProjectUserRoleMapper extProjectUserRoleMapper;
/**
* 获取成员列表
@@ -325,13 +328,25 @@ public class ProjectMemberService {
List logs = new ArrayList<>();
// 项目不存在, 则不移除
checkProjectExist(request.getProjectId());
+ if (!request.isSelectAll() && CollectionUtils.isEmpty(request.getSelectIds())) {
+ throw new MSException(Translator.get("user.not.empty"));
+ }
// 批量移除成员, 则移除该成员在该项目下的所有用户组
+ ListuserIds;
+ if (request.isSelectAll()) {
+ userIds = extProjectUserRoleMapper.getProjectRoleMemberIds(request);
+ if (!CollectionUtils.isEmpty(request.getExcludeIds())) {
+ userIds.removeAll(request.getExcludeIds());
+ }
+ } else {
+ userIds = request.getSelectIds();
+ }
UserRoleRelationExample example = new UserRoleRelationExample();
example.createCriteria().andSourceIdEqualTo(request.getProjectId())
- .andUserIdIn(request.getUserIds());
+ .andUserIdIn(userIds);
userRoleRelationMapper.deleteByExample(example);
// 操作记录
- request.getUserIds().forEach(userId -> {
+ userIds.forEach(userId -> {
// 操作记录
setLog(request.getProjectId(), userId, currentUserId, OperationLogType.DELETE.name(), "/project/member/remove", HttpMethodConstants.GET.name(), null, null, logs);
});
diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectMemberControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectMemberControllerTests.java
index f2da1accd0..7402f0f95c 100644
--- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectMemberControllerTests.java
+++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectMemberControllerTests.java
@@ -227,7 +227,7 @@ public class ProjectMemberControllerTests extends BaseTest {
public void testBatchRemoveMemberSuccess() throws Exception {
ProjectMemberBatchDeleteRequest request = new ProjectMemberBatchDeleteRequest();
request.setProjectId("default-project-member-test");
- request.setUserIds(List.of("default-project-member-user-1", "default-project-member-user-2"));
+ request.setSelectIds(List.of("default-project-member-user-1", "default-project-member-user-2"));
this.requestPost(BATCH_REMOVE_MEMBER, request, status().isOk());
// 权限校验
request.setProjectId(DEFAULT_PROJECT_ID);
@@ -239,7 +239,7 @@ public class ProjectMemberControllerTests extends BaseTest {
public void testBatchRemoveMember() throws Exception {
ProjectMemberBatchDeleteRequest request = new ProjectMemberBatchDeleteRequest();
request.setProjectId("default-project-member-x");
- request.setUserIds(List.of("default-project-member-user-1", "default-project-member-user-2"));
+ request.setSelectIds(List.of("default-project-member-user-1", "default-project-member-user-2"));
this.requestPost(BATCH_REMOVE_MEMBER, request, status().is5xxServerError());
}