fix(测试计划): 测试计划搜索问题

--bug=1045573 --user=王旭 【测试测试】功能用例列表-按执行人筛选后-全选所有页-批量修改执行人报500 https://www.tapd.cn/55049933/s/1577066
This commit is contained in:
WangXu10 2024-09-11 18:25:36 +08:00 committed by Craftsman
parent beb9298dd9
commit f1c07a1872
7 changed files with 28 additions and 22 deletions

View File

@ -30,4 +30,7 @@ public class BasePlanCaseBatchRequest extends TableBatchProcessDTO implements Se
@Schema(description = "项目Id")
private String projectId;
@Schema(description = "是否包含空执行人")
private boolean nullExecutorKey;
}

View File

@ -685,8 +685,9 @@
<if test="request.collectionId != null and request.collectionId != ''">
and t.test_plan_collection_id = #{request.collectionId}
</if>
<include refid="filters">
<include refid="apiCaseFilters">
<property name="filter" value="request.condition.filter"/>
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
</include>
</sql>

View File

@ -499,6 +499,7 @@
</if>
<include refid="filters">
<property name="filter" value="request.condition.filter"/>
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
</include>
<if test="request.condition.combine != null and request.condition.combine != ''">
<include refid="combine">

View File

@ -204,6 +204,7 @@
</if>
<include refid="filters">
<property name="filter" value="request.condition.filter"/>
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
</include>
<choose>
<when test='request.condition.searchMode == "AND"'>

View File

@ -245,7 +245,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
* @return
*/
public List<TestPlanApiCasePageResponse> hasRelateApiCaseList(TestPlanApiCaseRequest request, boolean deleted, String currentProjectId) {
filterCaseRequest(request);
request.setNullExecutorKey(filterCaseRequest(request.getFilter()));
if (CollectionUtils.isEmpty(request.getProtocols())) {
return new ArrayList<>();
}
@ -356,7 +356,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
if (CollectionUtils.isEmpty(request.getProtocols())) {
return Collections.emptyMap();
}
filterCaseRequest(request);
request.setNullExecutorKey(filterCaseRequest(request.getFilter()));
switch (request.getTreeType()) {
case TreeTypeEnums.MODULE:
return getModuleCount(request);
@ -545,6 +545,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
public List<String> doSelectIds(TestPlanApiCaseBatchRequest request) {
if (request.isSelectAll()) {
request.setNullExecutorKey(filterCaseRequest(request.getCondition().getFilter()));
List<String> ids = extTestPlanApiCaseMapper.getIds(request, false);
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
ids.removeAll(request.getExcludeIds());
@ -919,17 +920,16 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
/**
* 处理执行人为空过滤参数
*
* @param request 请求参数
* @param filter 请求参数
*/
protected void filterCaseRequest(TestPlanApiCaseRequest request) {
Map<String, List<String>> filter = request.getFilter();
protected boolean filterCaseRequest(Map<String, List<String>> filter) {
if (filter != null && filter.containsKey(EXECUTOR)) {
List<String> filterExecutorIds = filter.get(EXECUTOR);
if (CollectionUtils.isNotEmpty(filterExecutorIds)) {
boolean containNullKey = filterExecutorIds.removeIf(id -> StringUtils.equals(id, "-"));
request.setNullExecutorKey(containNullKey);
return filterExecutorIds.contains("-");
}
}
return false;
}
public void batchAssociateBug(TestPlanApiCaseBatchAddBugRequest request, String bugId, String userId) {

View File

@ -387,7 +387,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
* @return
*/
public List<TestPlanApiScenarioPageResponse> hasRelateApiScenarioList(TestPlanApiScenarioRequest request, boolean deleted, String currentProjectId) {
filterCaseRequest(request);
request.setNullExecutorKey(filterCaseRequest(request.getFilter()));
List<TestPlanApiScenarioPageResponse> list = extTestPlanApiScenarioMapper.relateApiScenarioList(request, deleted);
buildApiScenarioResponse(list, request.getTestPlanId(), currentProjectId);
return list;
@ -505,7 +505,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
}
public Map<String, Long> moduleCount(TestPlanApiScenarioModuleRequest request) {
filterCaseRequest(request);
request.setNullExecutorKey(filterCaseRequest(request.getFilter()));
switch (request.getTreeType()) {
case TreeTypeEnums.MODULE:
return getModuleCount(request);
@ -682,6 +682,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
public List<String> doSelectIds(BasePlanCaseBatchRequest request) {
if (request.isSelectAll()) {
request.setNullExecutorKey(filterCaseRequest(request.getCondition().getFilter()));
List<String> ids = extTestPlanApiScenarioMapper.getIds(request, false);
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
ids.removeAll(request.getExcludeIds());
@ -774,17 +775,16 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
/**
* 处理执行人为空过滤参数
*
* @param request 请求参数
* @param filter 请求参数
*/
protected void filterCaseRequest(TestPlanApiScenarioRequest request) {
Map<String, List<String>> filter = request.getFilter();
protected boolean filterCaseRequest(Map<String, List<String>> filter) {
if (filter != null && filter.containsKey(EXECUTOR)) {
List<String> filterExecutorIds = filter.get(EXECUTOR);
if (CollectionUtils.isNotEmpty(filterExecutorIds)) {
boolean containNullKey = filterExecutorIds.removeIf(id -> StringUtils.equals(id, "-"));
request.setNullExecutorKey(containNullKey);
return filterExecutorIds.contains("-");
}
}
return false;
}
public void batchAssociateBug(TestPlanScenarioBatchAddBugRequest request, String bugId, String userId) {

View File

@ -243,7 +243,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
public List<TestPlanCasePageResponse> getFunctionalCasePage(TestPlanCaseRequest request, boolean deleted, String projectId) {
filterCaseRequest(request);
request.setNullExecutorKey(filterCaseRequest(request.getFilter()));
List<TestPlanCasePageResponse> functionalCaseLists = extTestPlanFunctionalCaseMapper.getCasePage(request, deleted, request.getSortString());
if (CollectionUtils.isEmpty(functionalCaseLists)) {
return new ArrayList<>();
@ -369,7 +369,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
public Map<String, Long> moduleCount(TestPlanCaseModuleRequest request) {
filterCaseRequest(request);
request.setNullExecutorKey(filterCaseRequest(request.getFilter()));
switch (request.getTreeType()) {
case TreeTypeEnums.MODULE:
return getModuleCount(request);
@ -464,6 +464,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
public List<String> doSelectIds(BasePlanCaseBatchRequest request) {
if (request.isSelectAll()) {
request.setNullExecutorKey(filterCaseRequest(request.getCondition().getFilter()));
List<String> ids = extTestPlanFunctionalCaseMapper.getIds(request, false);
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
ids.removeAll(request.getExcludeIds());
@ -932,17 +933,16 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
/**
* 处理执行人为空过滤参数
*
* @param request 请求参数
* @param filter 请求参数
*/
protected void filterCaseRequest(TestPlanCaseRequest request) {
Map<String, List<String>> filter = request.getFilter();
protected boolean filterCaseRequest(Map<String, List<String>> filter) {
if (filter != null && filter.containsKey(EXECUTOR)) {
List<String> filterExecutorIds = filter.get(EXECUTOR);
if (CollectionUtils.isNotEmpty(filterExecutorIds)) {
boolean containNullKey = filterExecutorIds.removeIf(id -> StringUtils.equals(id, "-"));
request.setNullExecutorKey(containNullKey);
return filterExecutorIds.contains("-");
}
}
return false;
}
public void batchAssociateBug(TestPlanCaseBatchAddBugRequest request, String bugId, String userId) {