diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index f30550e488..0fcf3f2735 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -343,13 +343,41 @@ public class ApiScenarioReportService { ids = allIds.stream().filter(id -> !reportRequest.getUnSelectIds().contains(id)).collect(Collectors.toList()); } - ApiScenarioReportDetailExample detailExample = new ApiScenarioReportDetailExample(); - detailExample.createCriteria().andReportIdIn(ids); - apiScenarioReportDetailMapper.deleteByExample(detailExample); + //为预防数量太多,调用删除方法时引起SQL过长的Bug,此处采取分批执行的方式。 + //每次处理的数据数量 + int handleCount = 7000; + //每次处理的集合 + List handleIdList = new ArrayList<>(handleCount); + while (ids.size() > handleCount){ + handleIdList = new ArrayList<>(handleCount); + List otherIdList = new ArrayList<>(); + for (int index = 0;index < ids.size();index++){ + if(index and (api_definition.name like CONCAT('%', #{request.name},'%') - or api_definition.tags like CONCAT('%', #{request.name},'%')) + or api_definition.tags like CONCAT('%', #{request.name},'%') + or api_definition.num like CONCAT('%', #{request.name},'%')) AND api_definition.protocol = #{request.protocol} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index 1f391c031a..415d22029b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -143,7 +143,9 @@ - and (api_scenario.name like CONCAT('%', #{request.name},'%') or api_scenario.tags like CONCAT('%', #{request.name},'%')) + and (api_scenario.name like CONCAT('%', #{request.name},'%') + or api_scenario.tags like CONCAT('%', #{request.name},'%') + or api_scenario.num like CONCAT('%', #{request.name},'%')) AND project.workspace_id = #{request.workspaceId} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml index dadfca7047..6d0445ee17 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml @@ -284,7 +284,9 @@ - and (t1.name like CONCAT('%', #{request.name},'%') or t1.tags like CONCAT('%', #{request.name},'%')) + and (t1.name like CONCAT('%', #{request.name},'%') + or t1.tags like CONCAT('%', #{request.name},'%') + or t1.num like CONCAT('%', #{request.name},'%')) and t1.create_time >= #{request.createTime} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index 9b56ef1f8d..fabf6ce1da 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -122,7 +122,7 @@