From 136f968a8f6578c31e17e57f52f48ddba8d74dc1 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 14 Mar 2022 10:49:36 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95)?= =?UTF-8?q?:=20=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../APIScenarioReportController.java | 15 +- .../api/dto/QueryAPIReportRequest.java | 3 - .../api/exec/api/ApiCaseExecuteService.java | 12 +- .../api/exec/api/ApiExecuteService.java | 7 - .../scenario/ApiScenarioExecuteService.java | 13 - .../ApiDefinitionExecResultService.java | 12 - .../api/service/ApiDefinitionService.java | 8 - .../api/service/ApiScenarioReportService.java | 178 +---------- .../api/service/ApiTestCaseService.java | 5 - .../ApiDefinitionScenarioRelevance.java | 11 - ...ApiDefinitionScenarioRelevanceExample.java | 270 ---------------- .../ApiDefinitionScenarioRelevanceMapper.java | 24 -- .../ApiDefinitionScenarioRelevanceMapper.xml | 133 -------- .../ext/ExtApiDefinitionExecResultMapper.java | 3 - .../ext/ExtApiDefinitionExecResultMapper.xml | 133 -------- .../ExtApiDefinitionExecResultProvider.java | 13 - .../ext/ExtApiScenarioReportMapper.java | 5 - .../mapper/ext/ExtApiScenarioReportMapper.xml | 294 ++++++------------ .../ext/ExtApiScenarioReportProvider.java | 17 - .../src/main/resources/generatorConfig.xml | 35 ++- 20 files changed, 130 insertions(+), 1061 deletions(-) delete mode 100644 backend/src/main/java/io/metersphere/base/domain/ApiDefinitionScenarioRelevance.java delete mode 100644 backend/src/main/java/io/metersphere/base/domain/ApiDefinitionScenarioRelevanceExample.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionScenarioRelevanceMapper.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionScenarioRelevanceMapper.xml diff --git a/backend/src/main/java/io/metersphere/api/controller/APIScenarioReportController.java b/backend/src/main/java/io/metersphere/api/controller/APIScenarioReportController.java index a286cfaf58..c86d7b48ed 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APIScenarioReportController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APIScenarioReportController.java @@ -9,8 +9,6 @@ import io.metersphere.api.dto.automation.APIScenarioReportResult; import io.metersphere.api.dto.automation.ExecuteType; import io.metersphere.api.service.ApiScenarioReportService; import io.metersphere.base.domain.ApiScenarioReport; -import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper; -import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper; import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.OperLogModule; @@ -29,10 +27,6 @@ public class APIScenarioReportController { @Resource private ApiScenarioReportService apiReportService; - @Resource - private ExtApiScenarioReportMapper extApiScenarioReportMapper; - @Resource - private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper; @GetMapping("/get/{reportId}") public APIScenarioReportResult get(@PathVariable String reportId) { @@ -41,12 +35,9 @@ public class APIScenarioReportController { @PostMapping("/list/{goPage}/{pageSize}") public Pager> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryAPIReportRequest request) { - Page page = new Page(goPage, pageSize*2, true); - long scenarioCount = extApiScenarioReportMapper.selectCountByRequest(request); - long definitionCount = extApiDefinitionExecResultMapper.selectCountByRequest(request); - long totalCount = scenarioCount + definitionCount; - page.setTotal(totalCount); - return PageUtils.setPageInfo(page, apiReportService.list(goPage,pageSize*2,request)); + Page page = PageHelper.startPage(goPage, pageSize, true); + request.setLimit("LIMIT " + (goPage - 1) * pageSize + "," + pageSize * 50); + return PageUtils.setPageInfo(page, apiReportService.list(request)); } @PostMapping("/update") diff --git a/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java b/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java index 78ad0e7041..39c9e80f35 100644 --- a/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java @@ -22,7 +22,4 @@ public class QueryAPIReportRequest { private Map combine; private String limit; - - private Integer goPage; - private Integer pageSize; } diff --git a/backend/src/main/java/io/metersphere/api/exec/api/ApiCaseExecuteService.java b/backend/src/main/java/io/metersphere/api/exec/api/ApiCaseExecuteService.java index 8b12894dd5..413cee6f5d 100644 --- a/backend/src/main/java/io/metersphere/api/exec/api/ApiCaseExecuteService.java +++ b/backend/src/main/java/io/metersphere/api/exec/api/ApiCaseExecuteService.java @@ -13,7 +13,10 @@ import io.metersphere.api.exec.scenario.ApiScenarioSerialService; import io.metersphere.api.exec.utils.ApiDefinitionExecResultUtil; import io.metersphere.api.service.*; import io.metersphere.base.domain.*; -import io.metersphere.base.mapper.*; +import io.metersphere.base.mapper.ApiScenarioReportMapper; +import io.metersphere.base.mapper.ApiTestCaseMapper; +import io.metersphere.base.mapper.TestPlanApiCaseMapper; +import io.metersphere.base.mapper.TestPlanMapper; import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper; import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; @@ -58,8 +61,6 @@ public class ApiCaseExecuteService { private ApiScenarioReportMapper apiScenarioReportMapper; @Resource ApiScenarioReportStructureService apiScenarioReportStructureService; - @Resource - private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper; /** * 测试计划case执行 @@ -221,10 +222,7 @@ public class ApiCaseExecuteService { request.getConfig().setAmassReport(serialReportId); report.setStatus(APITestStatus.Running.name()); apiScenarioReportMapper.insert(report); - //生成关系数据 - ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance(); - apiDefinitionScenarioRelevance.setReportId(report.getId()); - apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance); + apiScenarioReportStructureService.save(serialReportId, new ArrayList<>()); } diff --git a/backend/src/main/java/io/metersphere/api/exec/api/ApiExecuteService.java b/backend/src/main/java/io/metersphere/api/exec/api/ApiExecuteService.java index 51f30ecc28..6698103f0e 100644 --- a/backend/src/main/java/io/metersphere/api/exec/api/ApiExecuteService.java +++ b/backend/src/main/java/io/metersphere/api/exec/api/ApiExecuteService.java @@ -20,7 +20,6 @@ import io.metersphere.api.service.ApiTestEnvironmentService; import io.metersphere.api.service.TcpApiParamService; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.ApiDefinitionExecResultMapper; -import io.metersphere.base.mapper.ApiDefinitionScenarioRelevanceMapper; import io.metersphere.base.mapper.ApiTestCaseMapper; import io.metersphere.base.mapper.TestPlanApiCaseMapper; import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper; @@ -61,8 +60,6 @@ public class ApiExecuteService { private TcpApiParamService tcpApiParamService; @Resource private ExtApiTestCaseMapper extApiTestCaseMapper; - @Resource - private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper; public MsExecResponseDTO jenkinsRun(RunCaseRequest request) { ApiTestCaseWithBLOBs caseWithBLOBs = null; @@ -88,10 +85,6 @@ public class ApiExecuteService { report.setType(ApiRunMode.JENKINS.name()); report.setProjectId(caseWithBLOBs.getProjectId()); apiDefinitionExecResultMapper.insert(report); - //生成关系数据 - ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance(); - apiDefinitionScenarioRelevance.setReportId(report.getId()); - apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance); //更新接口案例的最后执行状态等信息 caseWithBLOBs.setLastResultId(report.getId()); caseWithBLOBs.setUpdateTime(System.currentTimeMillis()); diff --git a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioExecuteService.java b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioExecuteService.java index f4ff29cee6..9841e5c3e8 100644 --- a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioExecuteService.java +++ b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioExecuteService.java @@ -15,11 +15,9 @@ import io.metersphere.api.service.ApiExecutionQueueService; import io.metersphere.api.service.ApiScenarioReportService; import io.metersphere.api.service.ApiScenarioReportStructureService; import io.metersphere.api.service.TcpApiParamService; -import io.metersphere.base.domain.ApiDefinitionScenarioRelevance; import io.metersphere.base.domain.ApiScenarioExample; import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.base.domain.TestPlanApiScenario; -import io.metersphere.base.mapper.ApiDefinitionScenarioRelevanceMapper; import io.metersphere.base.mapper.ApiScenarioMapper; import io.metersphere.base.mapper.ApiScenarioReportMapper; import io.metersphere.base.mapper.TestPlanApiScenarioMapper; @@ -88,9 +86,6 @@ public class ApiScenarioExecuteService { private TcpApiParamService tcpApiParamService; @Resource private JMeterService jMeterService; - @Resource - private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper; - public List run(RunScenarioRequest request) { if (LoggerUtil.getLogger().isDebugEnabled()) { @@ -164,9 +159,6 @@ public class ApiScenarioExecuteService { request.getConfig().setAmassReport(serialReportId); report.setStatus(APITestStatus.Running.name()); apiScenarioReportMapper.insert(report); - ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance(); - apiDefinitionScenarioRelevance.setReportId(report.getId()); - apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance); responseDTOS.add(new MsExecResponseDTO(JSON.toJSONString(scenarioIds), serialReportId, request.getRunMode())); reportStructureService.save(apiScenarios, serialReportId, request.getConfig().getReportType()); @@ -369,11 +361,6 @@ public class ApiScenarioExecuteService { } } apiScenarioReportMapper.insert(report); - if(report.getExecuteType().equals(ExecuteType.Saved.name())){ - ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance(); - apiDefinitionScenarioRelevance.setReportId(report.getId()); - apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance); - } } String runMode = StringUtils.isEmpty(request.getRunMode()) ? ApiRunMode.SCENARIO.name() : request.getRunMode(); // 调用执行方法 diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java index 06a7e8e974..4e167b51c1 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java @@ -37,7 +37,6 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.*; -import java.util.stream.Collectors; @Service @Transactional(rollbackFor = Exception.class) @@ -70,8 +69,6 @@ public class ApiDefinitionExecResultService { private ProjectMapper projectMapper; @Resource private SqlSessionFactory sqlSessionFactory; - @Resource - private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper; public void saveApiResult(List requestResults, ResultDTO dto) { LoggerUtil.info("接收到API/CASE执行结果【 " + requestResults.size() + " 】"); @@ -353,8 +350,6 @@ public class ApiDefinitionExecResultService { public void deleteByResourceId(String resourceId) { ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample(); example.createCriteria().andResourceIdEqualTo(resourceId); - ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectMaxResultByResourceId(resourceId); - apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(result.getId()); apiDefinitionExecResultMapper.deleteByExample(example); } @@ -364,13 +359,6 @@ public class ApiDefinitionExecResultService { } ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample(); example.createCriteria().andResourceIdIn(ids); - List apiDefinitionExecResults = apiDefinitionExecResultMapper.selectByExample(example); - if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){ - List reportIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); - } apiDefinitionExecResultMapper.deleteByExample(example); } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index fa0795dce4..17b67b235e 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -127,8 +127,6 @@ public class ApiDefinitionService { private ExtProjectVersionMapper extProjectVersionMapper; @Resource private ProjectApplicationService projectApplicationService; - @Resource - private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper; private ThreadLocal currentApiOrder = new ThreadLocal<>(); private ThreadLocal currentApiCaseOrder = new ThreadLocal<>(); @@ -348,8 +346,6 @@ public class ApiDefinitionService { apiDefinitions.forEach(api -> { apiTestCaseService.deleteTestCase(api.getId()); deleteFileByTestId(api.getId()); - ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectMaxResultByResourceId(api.getId()); - apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(result.getId()); extApiDefinitionExecResultMapper.deleteByResourceId(api.getId()); apiDefinitionMapper.deleteByPrimaryKey(api.getId()); esbApiParamService.deleteByResourceId(api.getId()); @@ -1056,10 +1052,6 @@ public class ApiDefinitionService { result.setProjectId(request.getProjectId()); result.setTriggerMode(TriggerMode.MANUAL.name()); apiDefinitionExecResultMapper.insert(result); - //生成关系数据 - ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance(); - apiDefinitionScenarioRelevance.setReportId(result.getId()); - apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance); } return apiExecuteService.debug(request, bodyFiles); } 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 343f1a9f57..074bfea331 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -14,7 +14,9 @@ import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper; import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.utils.*; +import io.metersphere.commons.utils.DateUtils; +import io.metersphere.commons.utils.ServiceUtils; +import io.metersphere.commons.utils.SessionUtils; import io.metersphere.constants.RunModeConstants; import io.metersphere.dto.*; import io.metersphere.i18n.Translator; @@ -76,9 +78,6 @@ public class ApiScenarioReportService { private ApiScenarioReportStructureMapper apiScenarioReportStructureMapper; @Resource private ApiDefinitionExecResultMapper definitionExecResultMapper; - @Resource - private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper; - public void saveResult(List requestResults, ResultDTO dto) { // 报告详情内容 @@ -133,97 +132,18 @@ public class ApiScenarioReportService { return reportResult; } - public List list(int goPage,int pageSize,QueryAPIReportRequest request) { + public List list(QueryAPIReportRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); - request.setGoPage((goPage - 1) * pageSize/2); - request.setPageSize(pageSize); List list = extApiScenarioReportMapper.list(request); - List collect = new ArrayList<>(); - Comparator comparing = null; - if(request.getOrders().size()==0){ - collect = list; - } else if(request.getOrders().size()==1){ - String name = request.getOrders().get(0).getName(); - String type = request.getOrders().get(0).getType(); - if(StringUtils.equals(name,"name")){ - comparing = Comparator.comparing(APIScenarioReportResult::getName); - if(StringUtils.equals(type,"DESC")){ - Comparator.comparing(APIScenarioReportResult::getName,Comparator.reverseOrder()); - } - collect = getApiScenarioReportResults(pageSize,list,comparing); - } - if(StringUtils.equals(name,"create_time")){ - comparing =Comparator.comparing(APIScenarioReportResult::getCreateTime); - if(StringUtils.equals(type,"DESC")){ - comparing = Comparator.comparing(APIScenarioReportResult::getCreateTime,Comparator.reverseOrder()); - } - collect = getApiScenarioReportResults(pageSize,list,comparing); - } - if(StringUtils.equals(name,"update_time")){ - if(StringUtils.equals(type,"DESC")){ - comparing = Comparator.comparing(APIScenarioReportResult::getUpdateTime,Comparator.reverseOrder()); - }else { - comparing =Comparator.comparing(APIScenarioReportResult::getUpdateTime); - } - collect = getApiScenarioReportResults(pageSize,list,comparing); - } - if(StringUtils.equals(name,"end_time")){ - comparing =Comparator.comparing(APIScenarioReportResult::getEndTime); - if(StringUtils.equals(type,"DESC")){ - comparing = Comparator.comparing(APIScenarioReportResult::getEndTime,Comparator.reverseOrder()); - } - collect = getApiScenarioReportResults(pageSize,list,comparing); - } - }else if(request.getOrders().size()>1){ - for (int i = 1; i < request.getOrders().size(); i++) { - String name1 = request.getOrders().get(i).getName(); - String type1 = request.getOrders().get(i).getType(); - if(StringUtils.equals(name1,"name")){ - if(StringUtils.equals(type1,"DESC")){ - comparing.thenComparing(APIScenarioReportResult::getName,Comparator.reverseOrder()); - }else{ - comparing.thenComparing(APIScenarioReportResult::getName); - } - } - if(StringUtils.equals(name1,"update_time")){ - if(StringUtils.equals(type1,"DESC")){ - comparing.thenComparing(APIScenarioReportResult::getUpdateTime,Comparator.reverseOrder()); - }else{ - comparing.thenComparing(APIScenarioReportResult::getUpdateTime); - } - } - if(StringUtils.equals(name1,"create_time")){ - if(StringUtils.equals(type1,"DESC")){ - comparing.thenComparing(APIScenarioReportResult::getCreateTime,Comparator.reverseOrder()); - }else{ - comparing.thenComparing(APIScenarioReportResult::getCreateTime); - } - } - if(StringUtils.equals(name1,"end_time")){ - if(StringUtils.equals(type1,"DESC")){ - comparing.thenComparing(APIScenarioReportResult::getEndTime,Comparator.reverseOrder()); - }else{ - comparing.thenComparing(APIScenarioReportResult::getEndTime); - } - } - } - collect = getApiScenarioReportResults(pageSize,list,comparing); - } - - List userIds = collect.stream().map(APIScenarioReportResult::getUserId) + List userIds = list.stream().map(APIScenarioReportResult::getUserId) .collect(Collectors.toList()); Map userMap = ServiceUtils.getUserMap(userIds); - collect.forEach(item -> { + list.forEach(item -> { User user = userMap.get(item.getUserId()); if (user != null) item.setUserName(user.getName()); }); - - return collect; - } - - private List getApiScenarioReportResults(int pageSize,List list, Comparator comparing) { - return list.stream().sorted(comparing).limit(pageSize/2).collect(Collectors.toList()); + return list; } public List idList(QueryAPIReportRequest request) { @@ -263,9 +183,6 @@ public class ApiScenarioReportService { report.setTriggerMode(TriggerMode.MANUAL.name()); } apiScenarioReportMapper.insert(report); - ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance(); - apiDefinitionScenarioRelevance.setReportId(report.getId()); - apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance); return report; } @@ -559,13 +476,6 @@ public class ApiScenarioReportService { apiScenarioReportDetailMapper.deleteByPrimaryKey(request.getId()); ApiScenarioReportResultExample example = new ApiScenarioReportResultExample(); example.createCriteria().andReportIdEqualTo(request.getId()); - List apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(example); - if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){ - List reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); - } apiScenarioReportResultMapper.deleteByExample(example); ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample(); @@ -574,18 +484,10 @@ public class ApiScenarioReportService { ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample(); definitionExecResultExample.createCriteria().andIdEqualTo(request.getId()); - apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(request.getId()); definitionExecResultMapper.deleteByExample(definitionExecResultExample); ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample(); execResultExample.createCriteria().andIntegratedReportIdEqualTo(request.getId()); - List apiDefinitionExecResults = definitionExecResultMapper.selectByExample(execResultExample); - if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){ - List reportIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); - } definitionExecResultMapper.deleteByExample(execResultExample); // 补充逻辑,如果是集成报告则把零时报告全部删除 @@ -606,13 +508,6 @@ public class ApiScenarioReportService { apiScenarioReportMapper.deleteByPrimaryKey(id); ApiScenarioReportResultExample example = new ApiScenarioReportResultExample(); example.createCriteria().andReportIdEqualTo(id); - List apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(example); - if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){ - List reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); - } apiScenarioReportResultMapper.deleteByExample(example); ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample(); @@ -622,17 +517,9 @@ public class ApiScenarioReportService { ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample(); definitionExecResultExample.createCriteria().andIdEqualTo(id); definitionExecResultMapper.deleteByExample(definitionExecResultExample); - apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(id); ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample(); execResultExample.createCriteria().andIntegratedReportIdEqualTo(id); - List apiDefinitionExecResults = definitionExecResultMapper.selectByExample(execResultExample); - if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){ - List ids = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(ids); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); - } definitionExecResultMapper.deleteByExample(execResultExample); } @@ -648,13 +535,6 @@ public class ApiScenarioReportService { ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample(); reportResultExample.createCriteria().andReportIdIn(ids); - List apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(reportResultExample); - if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){ - List reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); - } apiScenarioReportResultMapper.deleteByExample(reportResultExample); ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample(); @@ -663,20 +543,10 @@ public class ApiScenarioReportService { ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample(); definitionExecResultExample.createCriteria().andIdIn(ids); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(ids); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); definitionExecResultMapper.deleteByExample(definitionExecResultExample); ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample(); execResultExample.createCriteria().andIntegratedReportIdIn(ids); - List apiDefinitionExecResultList = definitionExecResultMapper.selectByExample(execResultExample); - if(apiDefinitionExecResultList!=null&&apiDefinitionExecResultList.size()!=0){ - List reportIds = apiDefinitionExecResultList.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample asexample = new ApiDefinitionScenarioRelevanceExample(); - asexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(asexample); - } definitionExecResultMapper.deleteByExample(execResultExample); } } @@ -726,13 +596,6 @@ public class ApiScenarioReportService { ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample(); reportResultExample.createCriteria().andReportIdIn(handleIdList); - List apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(reportResultExample); - if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){ - List reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); - } apiScenarioReportResultMapper.deleteByExample(reportResultExample); ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample(); @@ -741,20 +604,10 @@ public class ApiScenarioReportService { ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample(); definitionExecResultExample.createCriteria().andIdIn(handleIdList); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(handleIdList); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); definitionExecResultMapper.deleteByExample(definitionExecResultExample); ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample(); execResultExample.createCriteria().andIntegratedReportIdIn(handleIdList); - List apiDefinitionExecResults = definitionExecResultMapper.selectByExample(execResultExample); - if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){ - List reportIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample asexample = new ApiDefinitionScenarioRelevanceExample(); - asexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(asexample); - } definitionExecResultMapper.deleteByExample(execResultExample); //转存剩余的数据 @@ -772,13 +625,6 @@ public class ApiScenarioReportService { ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample(); reportResultExample.createCriteria().andReportIdIn(ids); - List apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(reportResultExample); - if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){ - List reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); - } apiScenarioReportResultMapper.deleteByExample(reportResultExample); ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample(); @@ -787,20 +633,10 @@ public class ApiScenarioReportService { ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample(); definitionExecResultExample.createCriteria().andIdIn(ids); - ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample(); - sexample.createCriteria().andReportIdIn(ids); - apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample); definitionExecResultMapper.deleteByExample(definitionExecResultExample); ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample(); execResultExample.createCriteria().andIntegratedReportIdIn(ids); - List apiDefinitionExecResults = definitionExecResultMapper.selectByExample(execResultExample); - if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){ - List reportIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList()); - ApiDefinitionScenarioRelevanceExample asexample = new ApiDefinitionScenarioRelevanceExample(); - asexample.createCriteria().andReportIdIn(reportIds); - apiDefinitionScenarioRelevanceMapper.deleteByExample(asexample); - } definitionExecResultMapper.deleteByExample(execResultExample); } } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index 12ed0b96b4..022a6b0a44 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -102,9 +102,6 @@ public class ApiTestCaseService { private ExtProjectVersionMapper extProjectVersionMapper; @Resource private TcpApiParamService tcpApiParamService; - @Resource - private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper; - private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR; @@ -260,8 +257,6 @@ public class ApiTestCaseService { public void delete(String testId) { extTestPlanTestCaseMapper.deleteByTestCaseID(testId); deleteFileByTestId(testId); - ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectMaxResultByResourceId(testId); - apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(result.getId()); extApiDefinitionExecResultMapper.deleteByResourceId(testId); apiTestCaseMapper.deleteByPrimaryKey(testId); esbApiParamService.deleteByResourceId(testId); diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionScenarioRelevance.java b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionScenarioRelevance.java deleted file mode 100644 index 4445a07762..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionScenarioRelevance.java +++ /dev/null @@ -1,11 +0,0 @@ -package io.metersphere.base.domain; - -import java.io.Serializable; -import lombok.Data; - -@Data -public class ApiDefinitionScenarioRelevance implements Serializable { - private String reportId; - - private static final long serialVersionUID = 1L; -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionScenarioRelevanceExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionScenarioRelevanceExample.java deleted file mode 100644 index dc3cfea1d4..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionScenarioRelevanceExample.java +++ /dev/null @@ -1,270 +0,0 @@ -package io.metersphere.base.domain; - -import java.util.ArrayList; -import java.util.List; - -public class ApiDefinitionScenarioRelevanceExample { - protected String orderByClause; - - protected boolean distinct; - - protected List oredCriteria; - - public ApiDefinitionScenarioRelevanceExample() { - oredCriteria = new ArrayList(); - } - - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - public String getOrderByClause() { - return orderByClause; - } - - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - public boolean isDistinct() { - return distinct; - } - - public List getOredCriteria() { - return oredCriteria; - } - - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andReportIdIsNull() { - addCriterion("report_id is null"); - return (Criteria) this; - } - - public Criteria andReportIdIsNotNull() { - addCriterion("report_id is not null"); - return (Criteria) this; - } - - public Criteria andReportIdEqualTo(String value) { - addCriterion("report_id =", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdNotEqualTo(String value) { - addCriterion("report_id <>", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdGreaterThan(String value) { - addCriterion("report_id >", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdGreaterThanOrEqualTo(String value) { - addCriterion("report_id >=", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdLessThan(String value) { - addCriterion("report_id <", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdLessThanOrEqualTo(String value) { - addCriterion("report_id <=", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdLike(String value) { - addCriterion("report_id like", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdNotLike(String value) { - addCriterion("report_id not like", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdIn(List values) { - addCriterion("report_id in", values, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdNotIn(List values) { - addCriterion("report_id not in", values, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdBetween(String value1, String value2) { - addCriterion("report_id between", value1, value2, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdNotBetween(String value1, String value2) { - addCriterion("report_id not between", value1, value2, "reportId"); - return (Criteria) this; - } - } - - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionScenarioRelevanceMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionScenarioRelevanceMapper.java deleted file mode 100644 index 0cafeb6c50..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionScenarioRelevanceMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.metersphere.base.mapper; - -import io.metersphere.base.domain.ApiDefinitionScenarioRelevance; -import io.metersphere.base.domain.ApiDefinitionScenarioRelevanceExample; -import java.util.List; -import org.apache.ibatis.annotations.Param; - -public interface ApiDefinitionScenarioRelevanceMapper { - long countByExample(ApiDefinitionScenarioRelevanceExample example); - - int deleteByExample(ApiDefinitionScenarioRelevanceExample example); - - int deleteByPrimaryKey(String reportId); - - int insert(ApiDefinitionScenarioRelevance record); - - int insertSelective(ApiDefinitionScenarioRelevance record); - - List selectByExample(ApiDefinitionScenarioRelevanceExample example); - - int updateByExampleSelective(@Param("record") ApiDefinitionScenarioRelevance record, @Param("example") ApiDefinitionScenarioRelevanceExample example); - - int updateByExample(@Param("record") ApiDefinitionScenarioRelevance record, @Param("example") ApiDefinitionScenarioRelevanceExample example); -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionScenarioRelevanceMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionScenarioRelevanceMapper.xml deleted file mode 100644 index 0f640b20e9..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionScenarioRelevanceMapper.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - report_id - - - - delete from api_definition_scenario_relevance - where report_id = #{reportId,jdbcType=VARCHAR} - - - delete from api_definition_scenario_relevance - - - - - - insert into api_definition_scenario_relevance (report_id) - values (#{reportId,jdbcType=VARCHAR}) - - - insert into api_definition_scenario_relevance - - - report_id, - - - - - #{reportId,jdbcType=VARCHAR}, - - - - - - update api_definition_scenario_relevance - - - report_id = #{record.reportId,jdbcType=VARCHAR}, - - - - - - - - update api_definition_scenario_relevance - set report_id = #{record.reportId,jdbcType=VARCHAR} - - - - - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.java index d810108870..bb9f9f8401 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.java @@ -1,6 +1,5 @@ package io.metersphere.base.mapper.ext; -import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult; import io.metersphere.base.domain.ApiDefinitionExecResult; import io.metersphere.track.dto.PlanReportCaseDTO; @@ -33,8 +32,6 @@ public interface ExtApiDefinitionExecResultMapper { List selectApiResultByProjectId(String projectId); - long selectCountByRequest(@Param("request") QueryAPIReportRequest request); - List selectForPlanReport(@Param("ids") List apiReportIds); void update(@Param("ids") List ids); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml index 9f16c19c43..841e60bd89 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml @@ -122,139 +122,6 @@ - - - - - - like CONCAT('%', #{${object}.value},'%') - - - not like CONCAT('%', #{${object}.value},'%') - - - in - - #{v} - - - - not in - - #{v} - - - - between #{${object}.value[0]} and #{${object}.value[1]} - - - > #{${object}.value} - - - < #{${object}.value} - - - >= #{${object}.value} - - - <= #{${object}.value} - - - = '${@io.metersphere.commons.utils.SessionUtils@getUserId()}' - - - = #{${object}.value} - - - - - - - and `name` - - - - - - and `name` - - - - - - and create_time - - - - - - and status - - - - - - and trigger_mode - - - - - - and user_id - - - - - - update api_definition_exec_result set status="STOP" where id in diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultProvider.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultProvider.java index 55e5508c5a..e37299eb46 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultProvider.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultProvider.java @@ -6,21 +6,11 @@ import java.util.List; public class ExtApiDefinitionExecResultProvider { public String insertListSql(List list) { - StringBuffer rsqlList = new StringBuffer(); - rsqlList.append(";").append("insert into api_definition_scenario_relevance ( report_id ) values "); StringBuffer sqlList = new StringBuffer(); sqlList.append("insert into api_definition_exec_result (id, `name`, resource_id, `status`, user_id, start_time, end_time," + " create_time, `type`, actuator, trigger_mode, version_id, error_code,project_id,integrated_report_id, content) values "); for (int i = 0; i < list.size(); i++) { ApiDefinitionExecResult result = list.get(i); - rsqlList.append(" (") - .append("'") - .append(result.getId()) - .append("'") - .append(")"); - if (i < list.size() - 1) { - rsqlList.append(","); - } sqlList.append(" (") .append("'") .append(result.getId()) @@ -60,9 +50,6 @@ public class ExtApiDefinitionExecResultProvider { sqlList.append(","); } } - rsqlList.append(";"); - sqlList.append(";"); - sqlList.append(rsqlList); return sqlList.toString(); } } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java index 2508e73806..33e6b77189 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java @@ -3,13 +3,11 @@ package io.metersphere.base.mapper.ext; import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.automation.APIScenarioReportResult; import io.metersphere.api.dto.datacount.ApiDataCountResult; -import io.metersphere.base.domain.ApiDefinitionExecResult; import io.metersphere.base.domain.ApiScenarioReport; import io.metersphere.dto.ApiReportCountDTO; import io.metersphere.track.dto.PlanReportCaseDTO; import org.apache.ibatis.annotations.InsertProvider; import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.SelectProvider; import java.util.Collection; import java.util.List; @@ -43,10 +41,7 @@ public interface ExtApiScenarioReportMapper { void update(@Param("ids") List ids); - long selectCountByRequest(@Param("request") QueryAPIReportRequest request); - @InsertProvider(type = ExtApiScenarioReportProvider.class, method = "insertListSql") void sqlInsert(List list); - } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml index 20626a72e3..5d5c1e4501 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml @@ -138,29 +138,20 @@ - update api_scenario_report set status="STOP" where id in diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportProvider.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportProvider.java index 2c2ef8b36f..762bbfdbef 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportProvider.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportProvider.java @@ -1,27 +1,16 @@ package io.metersphere.base.mapper.ext; -import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.automation.APIScenarioReportResult; import java.util.List; public class ExtApiScenarioReportProvider { public String insertListSql(List list) { - StringBuffer rsqlList = new StringBuffer(); - rsqlList.append(";").append("insert into api_definition_scenario_relevance ( report_id ) values "); StringBuffer sqlList = new StringBuffer(); sqlList.append("INSERT INTO api_scenario_report (id, project_id, `name`, create_time, update_time, `status`, user_id, trigger_mode," + " execute_type, scenario_name, scenario_id, create_user, actuator, end_time, report_version, version_id, description,report_type) VALUES "); for (int i = 0; i < list.size(); i++) { APIScenarioReportResult result = list.get(i); - rsqlList.append(" (") - .append("'") - .append(result.getId()) - .append("'") - .append(")"); - if (i < list.size() - 1) { - rsqlList.append(","); - } sqlList.append(" (") .append("'") .append(result.getId()) @@ -65,12 +54,6 @@ public class ExtApiScenarioReportProvider { sqlList.append(","); } } - rsqlList.append(";"); - sqlList.append(";"); - sqlList.append(rsqlList); return sqlList.toString(); } - - - } diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 09597561ef..3bea2f7187 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -64,28 +64,31 @@ - + - + + + + + + + + + + + + + + + +
+ +