mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 12:09:13 +08:00
Revert (接口测试): 接口测试报告查询
This commit is contained in:
parent
6e3c2ec11d
commit
136f968a8f
@ -9,8 +9,6 @@ import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
|||||||
import io.metersphere.api.dto.automation.ExecuteType;
|
import io.metersphere.api.dto.automation.ExecuteType;
|
||||||
import io.metersphere.api.service.ApiScenarioReportService;
|
import io.metersphere.api.service.ApiScenarioReportService;
|
||||||
import io.metersphere.base.domain.ApiScenarioReport;
|
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.NoticeConstants;
|
||||||
import io.metersphere.commons.constants.OperLogConstants;
|
import io.metersphere.commons.constants.OperLogConstants;
|
||||||
import io.metersphere.commons.constants.OperLogModule;
|
import io.metersphere.commons.constants.OperLogModule;
|
||||||
@ -29,10 +27,6 @@ public class APIScenarioReportController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ApiScenarioReportService apiReportService;
|
private ApiScenarioReportService apiReportService;
|
||||||
@Resource
|
|
||||||
private ExtApiScenarioReportMapper extApiScenarioReportMapper;
|
|
||||||
@Resource
|
|
||||||
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
|
|
||||||
|
|
||||||
@GetMapping("/get/{reportId}")
|
@GetMapping("/get/{reportId}")
|
||||||
public APIScenarioReportResult get(@PathVariable String reportId) {
|
public APIScenarioReportResult get(@PathVariable String reportId) {
|
||||||
@ -41,12 +35,9 @@ public class APIScenarioReportController {
|
|||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
public Pager<List<APIScenarioReportResult>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryAPIReportRequest request) {
|
public Pager<List<APIScenarioReportResult>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryAPIReportRequest request) {
|
||||||
Page<Object> page = new Page(goPage, pageSize*2, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
long scenarioCount = extApiScenarioReportMapper.selectCountByRequest(request);
|
request.setLimit("LIMIT " + (goPage - 1) * pageSize + "," + pageSize * 50);
|
||||||
long definitionCount = extApiDefinitionExecResultMapper.selectCountByRequest(request);
|
return PageUtils.setPageInfo(page, apiReportService.list(request));
|
||||||
long totalCount = scenarioCount + definitionCount;
|
|
||||||
page.setTotal(totalCount);
|
|
||||||
return PageUtils.setPageInfo(page, apiReportService.list(goPage,pageSize*2,request));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
|
@ -22,7 +22,4 @@ public class QueryAPIReportRequest {
|
|||||||
private Map<String, Object> combine;
|
private Map<String, Object> combine;
|
||||||
|
|
||||||
private String limit;
|
private String limit;
|
||||||
|
|
||||||
private Integer goPage;
|
|
||||||
private Integer pageSize;
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,10 @@ import io.metersphere.api.exec.scenario.ApiScenarioSerialService;
|
|||||||
import io.metersphere.api.exec.utils.ApiDefinitionExecResultUtil;
|
import io.metersphere.api.exec.utils.ApiDefinitionExecResultUtil;
|
||||||
import io.metersphere.api.service.*;
|
import io.metersphere.api.service.*;
|
||||||
import io.metersphere.base.domain.*;
|
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.base.mapper.ext.ExtApiTestCaseMapper;
|
||||||
import io.metersphere.commons.constants.*;
|
import io.metersphere.commons.constants.*;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
@ -58,8 +61,6 @@ public class ApiCaseExecuteService {
|
|||||||
private ApiScenarioReportMapper apiScenarioReportMapper;
|
private ApiScenarioReportMapper apiScenarioReportMapper;
|
||||||
@Resource
|
@Resource
|
||||||
ApiScenarioReportStructureService apiScenarioReportStructureService;
|
ApiScenarioReportStructureService apiScenarioReportStructureService;
|
||||||
@Resource
|
|
||||||
private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试计划case执行
|
* 测试计划case执行
|
||||||
@ -221,10 +222,7 @@ public class ApiCaseExecuteService {
|
|||||||
request.getConfig().setAmassReport(serialReportId);
|
request.getConfig().setAmassReport(serialReportId);
|
||||||
report.setStatus(APITestStatus.Running.name());
|
report.setStatus(APITestStatus.Running.name());
|
||||||
apiScenarioReportMapper.insert(report);
|
apiScenarioReportMapper.insert(report);
|
||||||
//生成关系数据
|
|
||||||
ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance();
|
|
||||||
apiDefinitionScenarioRelevance.setReportId(report.getId());
|
|
||||||
apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance);
|
|
||||||
apiScenarioReportStructureService.save(serialReportId, new ArrayList<>());
|
apiScenarioReportStructureService.save(serialReportId, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import io.metersphere.api.service.ApiTestEnvironmentService;
|
|||||||
import io.metersphere.api.service.TcpApiParamService;
|
import io.metersphere.api.service.TcpApiParamService;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
|
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
|
||||||
import io.metersphere.base.mapper.ApiDefinitionScenarioRelevanceMapper;
|
|
||||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||||
import io.metersphere.base.mapper.TestPlanApiCaseMapper;
|
import io.metersphere.base.mapper.TestPlanApiCaseMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
|
||||||
@ -61,8 +60,6 @@ public class ApiExecuteService {
|
|||||||
private TcpApiParamService tcpApiParamService;
|
private TcpApiParamService tcpApiParamService;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtApiTestCaseMapper extApiTestCaseMapper;
|
private ExtApiTestCaseMapper extApiTestCaseMapper;
|
||||||
@Resource
|
|
||||||
private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper;
|
|
||||||
|
|
||||||
public MsExecResponseDTO jenkinsRun(RunCaseRequest request) {
|
public MsExecResponseDTO jenkinsRun(RunCaseRequest request) {
|
||||||
ApiTestCaseWithBLOBs caseWithBLOBs = null;
|
ApiTestCaseWithBLOBs caseWithBLOBs = null;
|
||||||
@ -88,10 +85,6 @@ public class ApiExecuteService {
|
|||||||
report.setType(ApiRunMode.JENKINS.name());
|
report.setType(ApiRunMode.JENKINS.name());
|
||||||
report.setProjectId(caseWithBLOBs.getProjectId());
|
report.setProjectId(caseWithBLOBs.getProjectId());
|
||||||
apiDefinitionExecResultMapper.insert(report);
|
apiDefinitionExecResultMapper.insert(report);
|
||||||
//生成关系数据
|
|
||||||
ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance();
|
|
||||||
apiDefinitionScenarioRelevance.setReportId(report.getId());
|
|
||||||
apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance);
|
|
||||||
//更新接口案例的最后执行状态等信息
|
//更新接口案例的最后执行状态等信息
|
||||||
caseWithBLOBs.setLastResultId(report.getId());
|
caseWithBLOBs.setLastResultId(report.getId());
|
||||||
caseWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
caseWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||||
|
@ -15,11 +15,9 @@ import io.metersphere.api.service.ApiExecutionQueueService;
|
|||||||
import io.metersphere.api.service.ApiScenarioReportService;
|
import io.metersphere.api.service.ApiScenarioReportService;
|
||||||
import io.metersphere.api.service.ApiScenarioReportStructureService;
|
import io.metersphere.api.service.ApiScenarioReportStructureService;
|
||||||
import io.metersphere.api.service.TcpApiParamService;
|
import io.metersphere.api.service.TcpApiParamService;
|
||||||
import io.metersphere.base.domain.ApiDefinitionScenarioRelevance;
|
|
||||||
import io.metersphere.base.domain.ApiScenarioExample;
|
import io.metersphere.base.domain.ApiScenarioExample;
|
||||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||||
import io.metersphere.base.domain.TestPlanApiScenario;
|
import io.metersphere.base.domain.TestPlanApiScenario;
|
||||||
import io.metersphere.base.mapper.ApiDefinitionScenarioRelevanceMapper;
|
|
||||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||||
import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
||||||
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
||||||
@ -88,9 +86,6 @@ public class ApiScenarioExecuteService {
|
|||||||
private TcpApiParamService tcpApiParamService;
|
private TcpApiParamService tcpApiParamService;
|
||||||
@Resource
|
@Resource
|
||||||
private JMeterService jMeterService;
|
private JMeterService jMeterService;
|
||||||
@Resource
|
|
||||||
private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper;
|
|
||||||
|
|
||||||
|
|
||||||
public List<MsExecResponseDTO> run(RunScenarioRequest request) {
|
public List<MsExecResponseDTO> run(RunScenarioRequest request) {
|
||||||
if (LoggerUtil.getLogger().isDebugEnabled()) {
|
if (LoggerUtil.getLogger().isDebugEnabled()) {
|
||||||
@ -164,9 +159,6 @@ public class ApiScenarioExecuteService {
|
|||||||
request.getConfig().setAmassReport(serialReportId);
|
request.getConfig().setAmassReport(serialReportId);
|
||||||
report.setStatus(APITestStatus.Running.name());
|
report.setStatus(APITestStatus.Running.name());
|
||||||
apiScenarioReportMapper.insert(report);
|
apiScenarioReportMapper.insert(report);
|
||||||
ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance();
|
|
||||||
apiDefinitionScenarioRelevance.setReportId(report.getId());
|
|
||||||
apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance);
|
|
||||||
|
|
||||||
responseDTOS.add(new MsExecResponseDTO(JSON.toJSONString(scenarioIds), serialReportId, request.getRunMode()));
|
responseDTOS.add(new MsExecResponseDTO(JSON.toJSONString(scenarioIds), serialReportId, request.getRunMode()));
|
||||||
reportStructureService.save(apiScenarios, serialReportId, request.getConfig().getReportType());
|
reportStructureService.save(apiScenarios, serialReportId, request.getConfig().getReportType());
|
||||||
@ -369,11 +361,6 @@ public class ApiScenarioExecuteService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
apiScenarioReportMapper.insert(report);
|
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();
|
String runMode = StringUtils.isEmpty(request.getRunMode()) ? ApiRunMode.SCENARIO.name() : request.getRunMode();
|
||||||
// 调用执行方法
|
// 调用执行方法
|
||||||
|
@ -37,7 +37,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ -70,8 +69,6 @@ public class ApiDefinitionExecResultService {
|
|||||||
private ProjectMapper projectMapper;
|
private ProjectMapper projectMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private SqlSessionFactory sqlSessionFactory;
|
private SqlSessionFactory sqlSessionFactory;
|
||||||
@Resource
|
|
||||||
private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper;
|
|
||||||
|
|
||||||
public void saveApiResult(List<RequestResult> requestResults, ResultDTO dto) {
|
public void saveApiResult(List<RequestResult> requestResults, ResultDTO dto) {
|
||||||
LoggerUtil.info("接收到API/CASE执行结果【 " + requestResults.size() + " 】");
|
LoggerUtil.info("接收到API/CASE执行结果【 " + requestResults.size() + " 】");
|
||||||
@ -353,8 +350,6 @@ public class ApiDefinitionExecResultService {
|
|||||||
public void deleteByResourceId(String resourceId) {
|
public void deleteByResourceId(String resourceId) {
|
||||||
ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample();
|
||||||
example.createCriteria().andResourceIdEqualTo(resourceId);
|
example.createCriteria().andResourceIdEqualTo(resourceId);
|
||||||
ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectMaxResultByResourceId(resourceId);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(result.getId());
|
|
||||||
apiDefinitionExecResultMapper.deleteByExample(example);
|
apiDefinitionExecResultMapper.deleteByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,13 +359,6 @@ public class ApiDefinitionExecResultService {
|
|||||||
}
|
}
|
||||||
ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample();
|
||||||
example.createCriteria().andResourceIdIn(ids);
|
example.createCriteria().andResourceIdIn(ids);
|
||||||
List<ApiDefinitionExecResult> apiDefinitionExecResults = apiDefinitionExecResultMapper.selectByExample(example);
|
|
||||||
if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){
|
|
||||||
List<String> reportIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
}
|
|
||||||
apiDefinitionExecResultMapper.deleteByExample(example);
|
apiDefinitionExecResultMapper.deleteByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,8 +127,6 @@ public class ApiDefinitionService {
|
|||||||
private ExtProjectVersionMapper extProjectVersionMapper;
|
private ExtProjectVersionMapper extProjectVersionMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectApplicationService projectApplicationService;
|
private ProjectApplicationService projectApplicationService;
|
||||||
@Resource
|
|
||||||
private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper;
|
|
||||||
|
|
||||||
private ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
|
private ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
|
||||||
private ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
|
private ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
|
||||||
@ -348,8 +346,6 @@ public class ApiDefinitionService {
|
|||||||
apiDefinitions.forEach(api -> {
|
apiDefinitions.forEach(api -> {
|
||||||
apiTestCaseService.deleteTestCase(api.getId());
|
apiTestCaseService.deleteTestCase(api.getId());
|
||||||
deleteFileByTestId(api.getId());
|
deleteFileByTestId(api.getId());
|
||||||
ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectMaxResultByResourceId(api.getId());
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(result.getId());
|
|
||||||
extApiDefinitionExecResultMapper.deleteByResourceId(api.getId());
|
extApiDefinitionExecResultMapper.deleteByResourceId(api.getId());
|
||||||
apiDefinitionMapper.deleteByPrimaryKey(api.getId());
|
apiDefinitionMapper.deleteByPrimaryKey(api.getId());
|
||||||
esbApiParamService.deleteByResourceId(api.getId());
|
esbApiParamService.deleteByResourceId(api.getId());
|
||||||
@ -1056,10 +1052,6 @@ public class ApiDefinitionService {
|
|||||||
result.setProjectId(request.getProjectId());
|
result.setProjectId(request.getProjectId());
|
||||||
result.setTriggerMode(TriggerMode.MANUAL.name());
|
result.setTriggerMode(TriggerMode.MANUAL.name());
|
||||||
apiDefinitionExecResultMapper.insert(result);
|
apiDefinitionExecResultMapper.insert(result);
|
||||||
//生成关系数据
|
|
||||||
ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance();
|
|
||||||
apiDefinitionScenarioRelevance.setReportId(result.getId());
|
|
||||||
apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance);
|
|
||||||
}
|
}
|
||||||
return apiExecuteService.debug(request, bodyFiles);
|
return apiExecuteService.debug(request, bodyFiles);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,9 @@ import io.metersphere.base.mapper.*;
|
|||||||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
||||||
import io.metersphere.commons.constants.*;
|
import io.metersphere.commons.constants.*;
|
||||||
import io.metersphere.commons.exception.MSException;
|
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.constants.RunModeConstants;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
@ -76,9 +78,6 @@ public class ApiScenarioReportService {
|
|||||||
private ApiScenarioReportStructureMapper apiScenarioReportStructureMapper;
|
private ApiScenarioReportStructureMapper apiScenarioReportStructureMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ApiDefinitionExecResultMapper definitionExecResultMapper;
|
private ApiDefinitionExecResultMapper definitionExecResultMapper;
|
||||||
@Resource
|
|
||||||
private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper;
|
|
||||||
|
|
||||||
|
|
||||||
public void saveResult(List<RequestResult> requestResults, ResultDTO dto) {
|
public void saveResult(List<RequestResult> requestResults, ResultDTO dto) {
|
||||||
// 报告详情内容
|
// 报告详情内容
|
||||||
@ -133,97 +132,18 @@ public class ApiScenarioReportService {
|
|||||||
return reportResult;
|
return reportResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<APIScenarioReportResult> list(int goPage,int pageSize,QueryAPIReportRequest request) {
|
public List<APIScenarioReportResult> list(QueryAPIReportRequest request) {
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
request.setGoPage((goPage - 1) * pageSize/2);
|
|
||||||
request.setPageSize(pageSize);
|
|
||||||
List<APIScenarioReportResult> list = extApiScenarioReportMapper.list(request);
|
List<APIScenarioReportResult> list = extApiScenarioReportMapper.list(request);
|
||||||
List<APIScenarioReportResult> collect = new ArrayList<>();
|
List<String> userIds = list.stream().map(APIScenarioReportResult::getUserId)
|
||||||
Comparator<APIScenarioReportResult> 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<String> userIds = collect.stream().map(APIScenarioReportResult::getUserId)
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
Map<String, User> userMap = ServiceUtils.getUserMap(userIds);
|
Map<String, User> userMap = ServiceUtils.getUserMap(userIds);
|
||||||
collect.forEach(item -> {
|
list.forEach(item -> {
|
||||||
User user = userMap.get(item.getUserId());
|
User user = userMap.get(item.getUserId());
|
||||||
if (user != null)
|
if (user != null)
|
||||||
item.setUserName(user.getName());
|
item.setUserName(user.getName());
|
||||||
});
|
});
|
||||||
|
return list;
|
||||||
return collect;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<APIScenarioReportResult> getApiScenarioReportResults(int pageSize,List<APIScenarioReportResult> list, Comparator<APIScenarioReportResult> comparing) {
|
|
||||||
return list.stream().sorted(comparing).limit(pageSize/2).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> idList(QueryAPIReportRequest request) {
|
public List<String> idList(QueryAPIReportRequest request) {
|
||||||
@ -263,9 +183,6 @@ public class ApiScenarioReportService {
|
|||||||
report.setTriggerMode(TriggerMode.MANUAL.name());
|
report.setTriggerMode(TriggerMode.MANUAL.name());
|
||||||
}
|
}
|
||||||
apiScenarioReportMapper.insert(report);
|
apiScenarioReportMapper.insert(report);
|
||||||
ApiDefinitionScenarioRelevance apiDefinitionScenarioRelevance = new ApiDefinitionScenarioRelevance();
|
|
||||||
apiDefinitionScenarioRelevance.setReportId(report.getId());
|
|
||||||
apiDefinitionScenarioRelevanceMapper.insert(apiDefinitionScenarioRelevance);
|
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,13 +476,6 @@ public class ApiScenarioReportService {
|
|||||||
apiScenarioReportDetailMapper.deleteByPrimaryKey(request.getId());
|
apiScenarioReportDetailMapper.deleteByPrimaryKey(request.getId());
|
||||||
ApiScenarioReportResultExample example = new ApiScenarioReportResultExample();
|
ApiScenarioReportResultExample example = new ApiScenarioReportResultExample();
|
||||||
example.createCriteria().andReportIdEqualTo(request.getId());
|
example.createCriteria().andReportIdEqualTo(request.getId());
|
||||||
List<ApiScenarioReportResult> apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(example);
|
|
||||||
if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){
|
|
||||||
List<String> reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
}
|
|
||||||
apiScenarioReportResultMapper.deleteByExample(example);
|
apiScenarioReportResultMapper.deleteByExample(example);
|
||||||
|
|
||||||
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
||||||
@ -574,18 +484,10 @@ public class ApiScenarioReportService {
|
|||||||
|
|
||||||
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
||||||
definitionExecResultExample.createCriteria().andIdEqualTo(request.getId());
|
definitionExecResultExample.createCriteria().andIdEqualTo(request.getId());
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(request.getId());
|
|
||||||
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
||||||
|
|
||||||
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
||||||
execResultExample.createCriteria().andIntegratedReportIdEqualTo(request.getId());
|
execResultExample.createCriteria().andIntegratedReportIdEqualTo(request.getId());
|
||||||
List<ApiDefinitionExecResult> apiDefinitionExecResults = definitionExecResultMapper.selectByExample(execResultExample);
|
|
||||||
if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){
|
|
||||||
List<String> reportIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
}
|
|
||||||
definitionExecResultMapper.deleteByExample(execResultExample);
|
definitionExecResultMapper.deleteByExample(execResultExample);
|
||||||
|
|
||||||
// 补充逻辑,如果是集成报告则把零时报告全部删除
|
// 补充逻辑,如果是集成报告则把零时报告全部删除
|
||||||
@ -606,13 +508,6 @@ public class ApiScenarioReportService {
|
|||||||
apiScenarioReportMapper.deleteByPrimaryKey(id);
|
apiScenarioReportMapper.deleteByPrimaryKey(id);
|
||||||
ApiScenarioReportResultExample example = new ApiScenarioReportResultExample();
|
ApiScenarioReportResultExample example = new ApiScenarioReportResultExample();
|
||||||
example.createCriteria().andReportIdEqualTo(id);
|
example.createCriteria().andReportIdEqualTo(id);
|
||||||
List<ApiScenarioReportResult> apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(example);
|
|
||||||
if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){
|
|
||||||
List<String> reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
}
|
|
||||||
apiScenarioReportResultMapper.deleteByExample(example);
|
apiScenarioReportResultMapper.deleteByExample(example);
|
||||||
|
|
||||||
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
||||||
@ -622,17 +517,9 @@ public class ApiScenarioReportService {
|
|||||||
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
||||||
definitionExecResultExample.createCriteria().andIdEqualTo(id);
|
definitionExecResultExample.createCriteria().andIdEqualTo(id);
|
||||||
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(id);
|
|
||||||
|
|
||||||
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
||||||
execResultExample.createCriteria().andIntegratedReportIdEqualTo(id);
|
execResultExample.createCriteria().andIntegratedReportIdEqualTo(id);
|
||||||
List<ApiDefinitionExecResult> apiDefinitionExecResults = definitionExecResultMapper.selectByExample(execResultExample);
|
|
||||||
if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){
|
|
||||||
List<String> ids = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(ids);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
}
|
|
||||||
definitionExecResultMapper.deleteByExample(execResultExample);
|
definitionExecResultMapper.deleteByExample(execResultExample);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -648,13 +535,6 @@ public class ApiScenarioReportService {
|
|||||||
|
|
||||||
ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample();
|
ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample();
|
||||||
reportResultExample.createCriteria().andReportIdIn(ids);
|
reportResultExample.createCriteria().andReportIdIn(ids);
|
||||||
List<ApiScenarioReportResult> apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(reportResultExample);
|
|
||||||
if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){
|
|
||||||
List<String> reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
}
|
|
||||||
apiScenarioReportResultMapper.deleteByExample(reportResultExample);
|
apiScenarioReportResultMapper.deleteByExample(reportResultExample);
|
||||||
|
|
||||||
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
||||||
@ -663,20 +543,10 @@ public class ApiScenarioReportService {
|
|||||||
|
|
||||||
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
||||||
definitionExecResultExample.createCriteria().andIdIn(ids);
|
definitionExecResultExample.createCriteria().andIdIn(ids);
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(ids);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
||||||
|
|
||||||
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
||||||
execResultExample.createCriteria().andIntegratedReportIdIn(ids);
|
execResultExample.createCriteria().andIntegratedReportIdIn(ids);
|
||||||
List<ApiDefinitionExecResult> apiDefinitionExecResultList = definitionExecResultMapper.selectByExample(execResultExample);
|
|
||||||
if(apiDefinitionExecResultList!=null&&apiDefinitionExecResultList.size()!=0){
|
|
||||||
List<String> reportIds = apiDefinitionExecResultList.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample asexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
asexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(asexample);
|
|
||||||
}
|
|
||||||
definitionExecResultMapper.deleteByExample(execResultExample);
|
definitionExecResultMapper.deleteByExample(execResultExample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -726,13 +596,6 @@ public class ApiScenarioReportService {
|
|||||||
|
|
||||||
ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample();
|
ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample();
|
||||||
reportResultExample.createCriteria().andReportIdIn(handleIdList);
|
reportResultExample.createCriteria().andReportIdIn(handleIdList);
|
||||||
List<ApiScenarioReportResult> apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(reportResultExample);
|
|
||||||
if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){
|
|
||||||
List<String> reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
}
|
|
||||||
apiScenarioReportResultMapper.deleteByExample(reportResultExample);
|
apiScenarioReportResultMapper.deleteByExample(reportResultExample);
|
||||||
|
|
||||||
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
||||||
@ -741,20 +604,10 @@ public class ApiScenarioReportService {
|
|||||||
|
|
||||||
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
||||||
definitionExecResultExample.createCriteria().andIdIn(handleIdList);
|
definitionExecResultExample.createCriteria().andIdIn(handleIdList);
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(handleIdList);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
||||||
|
|
||||||
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
||||||
execResultExample.createCriteria().andIntegratedReportIdIn(handleIdList);
|
execResultExample.createCriteria().andIntegratedReportIdIn(handleIdList);
|
||||||
List<ApiDefinitionExecResult> apiDefinitionExecResults = definitionExecResultMapper.selectByExample(execResultExample);
|
|
||||||
if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){
|
|
||||||
List<String> reportIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample asexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
asexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(asexample);
|
|
||||||
}
|
|
||||||
definitionExecResultMapper.deleteByExample(execResultExample);
|
definitionExecResultMapper.deleteByExample(execResultExample);
|
||||||
|
|
||||||
//转存剩余的数据
|
//转存剩余的数据
|
||||||
@ -772,13 +625,6 @@ public class ApiScenarioReportService {
|
|||||||
|
|
||||||
ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample();
|
ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample();
|
||||||
reportResultExample.createCriteria().andReportIdIn(ids);
|
reportResultExample.createCriteria().andReportIdIn(ids);
|
||||||
List<ApiScenarioReportResult> apiScenarioReportResults = apiScenarioReportResultMapper.selectByExample(reportResultExample);
|
|
||||||
if(apiScenarioReportResults!=null&&apiScenarioReportResults.size()!=0){
|
|
||||||
List<String> reportIds = apiScenarioReportResults.stream().map(ApiScenarioReportResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
}
|
|
||||||
apiScenarioReportResultMapper.deleteByExample(reportResultExample);
|
apiScenarioReportResultMapper.deleteByExample(reportResultExample);
|
||||||
|
|
||||||
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
|
||||||
@ -787,20 +633,10 @@ public class ApiScenarioReportService {
|
|||||||
|
|
||||||
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample definitionExecResultExample = new ApiDefinitionExecResultExample();
|
||||||
definitionExecResultExample.createCriteria().andIdIn(ids);
|
definitionExecResultExample.createCriteria().andIdIn(ids);
|
||||||
ApiDefinitionScenarioRelevanceExample sexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
sexample.createCriteria().andReportIdIn(ids);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(sexample);
|
|
||||||
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
definitionExecResultMapper.deleteByExample(definitionExecResultExample);
|
||||||
|
|
||||||
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
||||||
execResultExample.createCriteria().andIntegratedReportIdIn(ids);
|
execResultExample.createCriteria().andIntegratedReportIdIn(ids);
|
||||||
List<ApiDefinitionExecResult> apiDefinitionExecResults = definitionExecResultMapper.selectByExample(execResultExample);
|
|
||||||
if(apiDefinitionExecResults!=null&&apiDefinitionExecResults.size()!=0){
|
|
||||||
List<String> reportIds = apiDefinitionExecResults.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList());
|
|
||||||
ApiDefinitionScenarioRelevanceExample asexample = new ApiDefinitionScenarioRelevanceExample();
|
|
||||||
asexample.createCriteria().andReportIdIn(reportIds);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByExample(asexample);
|
|
||||||
}
|
|
||||||
definitionExecResultMapper.deleteByExample(execResultExample);
|
definitionExecResultMapper.deleteByExample(execResultExample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,9 +102,6 @@ public class ApiTestCaseService {
|
|||||||
private ExtProjectVersionMapper extProjectVersionMapper;
|
private ExtProjectVersionMapper extProjectVersionMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TcpApiParamService tcpApiParamService;
|
private TcpApiParamService tcpApiParamService;
|
||||||
@Resource
|
|
||||||
private ApiDefinitionScenarioRelevanceMapper apiDefinitionScenarioRelevanceMapper;
|
|
||||||
|
|
||||||
|
|
||||||
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
||||||
|
|
||||||
@ -260,8 +257,6 @@ public class ApiTestCaseService {
|
|||||||
public void delete(String testId) {
|
public void delete(String testId) {
|
||||||
extTestPlanTestCaseMapper.deleteByTestCaseID(testId);
|
extTestPlanTestCaseMapper.deleteByTestCaseID(testId);
|
||||||
deleteFileByTestId(testId);
|
deleteFileByTestId(testId);
|
||||||
ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectMaxResultByResourceId(testId);
|
|
||||||
apiDefinitionScenarioRelevanceMapper.deleteByPrimaryKey(result.getId());
|
|
||||||
extApiDefinitionExecResultMapper.deleteByResourceId(testId);
|
extApiDefinitionExecResultMapper.deleteByResourceId(testId);
|
||||||
apiTestCaseMapper.deleteByPrimaryKey(testId);
|
apiTestCaseMapper.deleteByPrimaryKey(testId);
|
||||||
esbApiParamService.deleteByResourceId(testId);
|
esbApiParamService.deleteByResourceId(testId);
|
||||||
|
@ -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;
|
|
||||||
}
|
|
@ -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<Criteria> oredCriteria;
|
|
||||||
|
|
||||||
public ApiDefinitionScenarioRelevanceExample() {
|
|
||||||
oredCriteria = new ArrayList<Criteria>();
|
|
||||||
}
|
|
||||||
|
|
||||||
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<Criteria> 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<Criterion> criteria;
|
|
||||||
|
|
||||||
protected GeneratedCriteria() {
|
|
||||||
super();
|
|
||||||
criteria = new ArrayList<Criterion>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid() {
|
|
||||||
return criteria.size() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criterion> getAllCriteria() {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criterion> 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<String> values) {
|
|
||||||
addCriterion("report_id in", values, "reportId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andReportIdNotIn(List<String> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<ApiDefinitionScenarioRelevance> selectByExample(ApiDefinitionScenarioRelevanceExample example);
|
|
||||||
|
|
||||||
int updateByExampleSelective(@Param("record") ApiDefinitionScenarioRelevance record, @Param("example") ApiDefinitionScenarioRelevanceExample example);
|
|
||||||
|
|
||||||
int updateByExample(@Param("record") ApiDefinitionScenarioRelevance record, @Param("example") ApiDefinitionScenarioRelevanceExample example);
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="io.metersphere.base.mapper.ApiDefinitionScenarioRelevanceMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiDefinitionScenarioRelevance">
|
|
||||||
<id column="report_id" jdbcType="VARCHAR" property="reportId" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Example_Where_Clause">
|
|
||||||
<where>
|
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
||||||
<if test="criteria.valid">
|
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
|
||||||
<choose>
|
|
||||||
<when test="criterion.noValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.singleValue">
|
|
||||||
and ${criterion.condition} #{criterion.value}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.betweenValue">
|
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.listValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
||||||
#{listItem}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
<sql id="Update_By_Example_Where_Clause">
|
|
||||||
<where>
|
|
||||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
||||||
<if test="criteria.valid">
|
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
|
||||||
<choose>
|
|
||||||
<when test="criterion.noValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.singleValue">
|
|
||||||
and ${criterion.condition} #{criterion.value}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.betweenValue">
|
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.listValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
||||||
#{listItem}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
report_id
|
|
||||||
</sql>
|
|
||||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiDefinitionScenarioRelevanceExample" resultMap="BaseResultMap">
|
|
||||||
select
|
|
||||||
<if test="distinct">
|
|
||||||
distinct
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from api_definition_scenario_relevance
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
<if test="orderByClause != null">
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
||||||
delete from api_definition_scenario_relevance
|
|
||||||
where report_id = #{reportId,jdbcType=VARCHAR}
|
|
||||||
</delete>
|
|
||||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiDefinitionScenarioRelevanceExample">
|
|
||||||
delete from api_definition_scenario_relevance
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</delete>
|
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionScenarioRelevance">
|
|
||||||
insert into api_definition_scenario_relevance (report_id)
|
|
||||||
values (#{reportId,jdbcType=VARCHAR})
|
|
||||||
</insert>
|
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionScenarioRelevance">
|
|
||||||
insert into api_definition_scenario_relevance
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="reportId != null">
|
|
||||||
report_id,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="reportId != null">
|
|
||||||
#{reportId,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiDefinitionScenarioRelevanceExample" resultType="java.lang.Long">
|
|
||||||
select count(*) from api_definition_scenario_relevance
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<update id="updateByExampleSelective" parameterType="map">
|
|
||||||
update api_definition_scenario_relevance
|
|
||||||
<set>
|
|
||||||
<if test="record.reportId != null">
|
|
||||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</update>
|
|
||||||
<update id="updateByExample" parameterType="map">
|
|
||||||
update api_definition_scenario_relevance
|
|
||||||
set report_id = #{record.reportId,jdbcType=VARCHAR}
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</update>
|
|
||||||
</mapper>
|
|
@ -1,6 +1,5 @@
|
|||||||
package io.metersphere.base.mapper.ext;
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
|
||||||
import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult;
|
import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult;
|
||||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||||
import io.metersphere.track.dto.PlanReportCaseDTO;
|
import io.metersphere.track.dto.PlanReportCaseDTO;
|
||||||
@ -33,8 +32,6 @@ public interface ExtApiDefinitionExecResultMapper {
|
|||||||
|
|
||||||
List<ApiDefinitionExecResult> selectApiResultByProjectId(String projectId);
|
List<ApiDefinitionExecResult> selectApiResultByProjectId(String projectId);
|
||||||
|
|
||||||
long selectCountByRequest(@Param("request") QueryAPIReportRequest request);
|
|
||||||
|
|
||||||
List<PlanReportCaseDTO> selectForPlanReport(@Param("ids") List<String> apiReportIds);
|
List<PlanReportCaseDTO> selectForPlanReport(@Param("ids") List<String> apiReportIds);
|
||||||
|
|
||||||
void update(@Param("ids") List<String> ids);
|
void update(@Param("ids") List<String> ids);
|
||||||
|
@ -122,139 +122,6 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCountByRequest" resultType="java.lang.Long">
|
|
||||||
select
|
|
||||||
count(*)
|
|
||||||
from api_definition_exec_result a_r
|
|
||||||
FORCE INDEX(PRIMARY)
|
|
||||||
where (a_r.integrated_report_id is null or a_r.integrated_report_id = 'null')
|
|
||||||
<if test="request.combine != null">
|
|
||||||
<include refid="listCombine">
|
|
||||||
<property name="condition" value="request.combine"/>
|
|
||||||
<property name="name" value="request.name"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="request.name != null">
|
|
||||||
and a_r.name like CONCAT('%', #{request.name},'%')
|
|
||||||
</if>
|
|
||||||
<if test="request.userId != null">
|
|
||||||
AND a_r.user_id = #{request.userId,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
<if test="request.projectId != null">
|
|
||||||
AND a_r.project_id = #{request.projectId}
|
|
||||||
</if>
|
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
|
||||||
<if test="values != null and values.size() > 0">
|
|
||||||
<choose>
|
|
||||||
<when test="key=='status'">
|
|
||||||
and a_r.status in
|
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
|
||||||
#{value}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
<when test="key=='trigger_mode'">
|
|
||||||
and a_r.trigger_mode in
|
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
|
||||||
#{value}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
<if test="request.orders != null and request.orders.size() > 0">
|
|
||||||
order by
|
|
||||||
<foreach collection="request.orders" separator="," item="order">
|
|
||||||
${order.name} ${order.type}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<sql id="condition">
|
|
||||||
<choose>
|
|
||||||
<when test='${object}.operator == "like"'>
|
|
||||||
like CONCAT('%', #{${object}.value},'%')
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "not like"'>
|
|
||||||
not like CONCAT('%', #{${object}.value},'%')
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "in"'>
|
|
||||||
in
|
|
||||||
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
|
|
||||||
#{v}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "not in"'>
|
|
||||||
not in
|
|
||||||
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
|
|
||||||
#{v}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "between"'>
|
|
||||||
between #{${object}.value[0]} and #{${object}.value[1]}
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "gt"'>
|
|
||||||
> #{${object}.value}
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "lt"'>
|
|
||||||
< #{${object}.value}
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "ge"'>
|
|
||||||
>= #{${object}.value}
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "le"'>
|
|
||||||
<= #{${object}.value}
|
|
||||||
</when>
|
|
||||||
<when test='${object}.operator == "current user"'>
|
|
||||||
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
= #{${object}.value}
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<sql id="listCombine">
|
|
||||||
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
|
|
||||||
and `name`
|
|
||||||
<include refid="condition">
|
|
||||||
<property name="object" value="${condition}.name"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<if test="${condition}.testName != null">
|
|
||||||
and `name`
|
|
||||||
<include refid="condition">
|
|
||||||
<property name="object" value="${condition}.testName"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<if test="${condition}.createTime != null">
|
|
||||||
and create_time
|
|
||||||
<include refid="condition">
|
|
||||||
<property name="object" value="${condition}.createTime"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<if test="${condition}.status != null">
|
|
||||||
and status
|
|
||||||
<include refid="condition">
|
|
||||||
<property name="object" value="${condition}.status"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<if test="${condition}.triggerMode != null">
|
|
||||||
and trigger_mode
|
|
||||||
<include refid="condition">
|
|
||||||
<property name="object" value="${condition}.triggerMode"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<if test="${condition}.creator != null">
|
|
||||||
and user_id
|
|
||||||
<include refid="condition">
|
|
||||||
<property name="object" value="${condition}.creator"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<update id="update" parameterType="java.util.List">
|
<update id="update" parameterType="java.util.List">
|
||||||
update api_definition_exec_result set status="STOP" where id in
|
update api_definition_exec_result set status="STOP" where id in
|
||||||
<foreach collection="ids" item="value" separator="," open="(" close=")">
|
<foreach collection="ids" item="value" separator="," open="(" close=")">
|
||||||
|
@ -6,21 +6,11 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ExtApiDefinitionExecResultProvider {
|
public class ExtApiDefinitionExecResultProvider {
|
||||||
public String insertListSql(List<ApiDefinitionExecResult> list) {
|
public String insertListSql(List<ApiDefinitionExecResult> list) {
|
||||||
StringBuffer rsqlList = new StringBuffer();
|
|
||||||
rsqlList.append(";").append("insert into api_definition_scenario_relevance ( report_id ) values ");
|
|
||||||
StringBuffer sqlList = new StringBuffer();
|
StringBuffer sqlList = new StringBuffer();
|
||||||
sqlList.append("insert into api_definition_exec_result (id, `name`, resource_id, `status`, user_id, start_time, end_time," +
|
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 ");
|
" 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++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
ApiDefinitionExecResult result = list.get(i);
|
ApiDefinitionExecResult result = list.get(i);
|
||||||
rsqlList.append(" (")
|
|
||||||
.append("'")
|
|
||||||
.append(result.getId())
|
|
||||||
.append("'")
|
|
||||||
.append(")");
|
|
||||||
if (i < list.size() - 1) {
|
|
||||||
rsqlList.append(",");
|
|
||||||
}
|
|
||||||
sqlList.append(" (")
|
sqlList.append(" (")
|
||||||
.append("'")
|
.append("'")
|
||||||
.append(result.getId())
|
.append(result.getId())
|
||||||
@ -60,9 +50,6 @@ public class ExtApiDefinitionExecResultProvider {
|
|||||||
sqlList.append(",");
|
sqlList.append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rsqlList.append(";");
|
|
||||||
sqlList.append(";");
|
|
||||||
sqlList.append(rsqlList);
|
|
||||||
return sqlList.toString();
|
return sqlList.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,11 @@ package io.metersphere.base.mapper.ext;
|
|||||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
|
||||||
import io.metersphere.base.domain.ApiScenarioReport;
|
import io.metersphere.base.domain.ApiScenarioReport;
|
||||||
import io.metersphere.dto.ApiReportCountDTO;
|
import io.metersphere.dto.ApiReportCountDTO;
|
||||||
import io.metersphere.track.dto.PlanReportCaseDTO;
|
import io.metersphere.track.dto.PlanReportCaseDTO;
|
||||||
import org.apache.ibatis.annotations.InsertProvider;
|
import org.apache.ibatis.annotations.InsertProvider;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.SelectProvider;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -43,10 +41,7 @@ public interface ExtApiScenarioReportMapper {
|
|||||||
|
|
||||||
void update(@Param("ids") List<String> ids);
|
void update(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
long selectCountByRequest(@Param("request") QueryAPIReportRequest request);
|
|
||||||
|
|
||||||
@InsertProvider(type = ExtApiScenarioReportProvider.class, method = "insertListSql")
|
@InsertProvider(type = ExtApiScenarioReportProvider.class, method = "insertListSql")
|
||||||
void sqlInsert(List<APIScenarioReportResult> list);
|
void sqlInsert(List<APIScenarioReportResult> list);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -138,29 +138,20 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="list" resultMap="BaseResultMap">
|
<select id="list" resultMap="BaseResultMap">
|
||||||
select if(a_s_r.id is null, a_d_r.id,a_s_r.id) as id ,if(a_s_r.id is null, a_d_r.name,a_s_r.name) as name ,if(a_s_r.id is null, a_d_r.end_time,a_s_r.end_time) as end_time ,
|
select * from (
|
||||||
if(a_s_r.id is null, a_d_r.user_id,a_s_r.user_id) as user_id ,
|
SELECT s_r.name AS test_name,
|
||||||
if(a_s_r.id is null, a_d_r.project_id,a_s_r.project_id) as project_id ,
|
s_r.end_time,
|
||||||
if(a_s_r.id is null, a_d_r.create_time,a_s_r.create_time) as create_time ,
|
s_r.user_id,
|
||||||
if(a_s_r.id is null, a_d_r.update_time,a_s_r.update_time) as update_time ,
|
s_r.name,
|
||||||
if(a_s_r.id is null, a_d_r.status,a_s_r.status) as status ,
|
s_r.id,
|
||||||
if(a_s_r.id is null, a_d_r.trigger_mode,a_s_r.trigger_mode) as trigger_mode ,
|
s_r.project_id,
|
||||||
if(a_s_r.id is null, a_d_r.execute_type,a_s_r.execute_type) as execute_type ,
|
s_r.create_time,
|
||||||
if(a_s_r.id is null, a_d_r.report_type,a_s_r.report_type) as report_type from api_definition_scenario_relevance d_s_r
|
s_r.update_time,
|
||||||
left join (
|
s_r.status,
|
||||||
SELECT
|
s_r.trigger_mode,
|
||||||
s_r.end_time,
|
s_r.execute_type,
|
||||||
s_r.user_id,
|
s_r.report_type
|
||||||
s_r.name,
|
FROM api_scenario_report s_r
|
||||||
s_r.id,
|
|
||||||
s_r.project_id,
|
|
||||||
s_r.create_time,
|
|
||||||
s_r.update_time,
|
|
||||||
s_r.status,
|
|
||||||
s_r.trigger_mode,
|
|
||||||
s_r.execute_type,
|
|
||||||
s_r.report_type
|
|
||||||
FROM api_scenario_report s_r
|
|
||||||
<where>
|
<where>
|
||||||
<if test="request.combine != null">
|
<if test="request.combine != null">
|
||||||
<include refid="listCombine">
|
<include refid="listCombine">
|
||||||
@ -205,15 +196,9 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
AND s_r.execute_type = 'Saved'
|
AND s_r.execute_type = 'Saved'
|
||||||
<if test="request.orders != null and request.orders.size() > 0">
|
</where>
|
||||||
order by
|
union all
|
||||||
<foreach collection="request.orders" separator="," item="order">
|
select a_r.name as test_name,
|
||||||
s_r.${order.name} ${order.type}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</where>) a_s_r on d_s_r.report_id = a_s_r.id
|
|
||||||
left join
|
|
||||||
( select
|
|
||||||
a_r.end_time,
|
a_r.end_time,
|
||||||
a_r.user_id,
|
a_r.user_id,
|
||||||
a_r.name,
|
a_r.name,
|
||||||
@ -263,87 +248,47 @@
|
|||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
) r
|
||||||
|
where 1 = 1
|
||||||
|
<if test="request.filters != null and request.filters.size() > 0">
|
||||||
|
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||||
|
<if test="values != null and values.size() > 0">
|
||||||
|
<choose>
|
||||||
|
<when test="key=='report_type'">
|
||||||
|
and r.report_type in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="request.orders != null and request.orders.size() > 0">
|
<if test="request.orders != null and request.orders.size() > 0">
|
||||||
order by
|
order by
|
||||||
<foreach collection="request.orders" separator="," item="order">
|
<foreach collection="request.orders" separator="," item="order">
|
||||||
${order.name} ${order.type}
|
r.${order.name} ${order.type}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
) a_d_r on d_s_r.report_id = a_d_r.id
|
|
||||||
<if test="request.goPage != null and request.pageSize != null">
|
|
||||||
limit #{request.goPage},#{request.pageSize}
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="idList" resultType="java.lang.String">
|
<select id="idList" resultType="java.lang.String">
|
||||||
select if(s_r.id is null, a_r.id,s_r.id) as id from api_definition_scenario_relevance d_s_r
|
select r.id from (
|
||||||
left join (
|
SELECT s_r.name AS test_name,
|
||||||
SELECT
|
s_r.end_time,
|
||||||
s_r.end_time,
|
s_r.user_id,
|
||||||
s_r.user_id,
|
s_r.name,
|
||||||
s_r.name,
|
s_r.id,
|
||||||
s_r.id,
|
s_r.project_id,
|
||||||
s_r.project_id,
|
s_r.create_time,
|
||||||
s_r.create_time,
|
s_r.update_time,
|
||||||
s_r.update_time,
|
s_r.status,
|
||||||
s_r.status,
|
s_r.trigger_mode,
|
||||||
s_r.trigger_mode,
|
s_r.execute_type,
|
||||||
s_r.execute_type,
|
s_r.report_type
|
||||||
s_r.report_type
|
|
||||||
FROM api_scenario_report s_r
|
FROM api_scenario_report s_r
|
||||||
<where>
|
union all
|
||||||
<if test="request.combine != null">
|
select a_r.name as test_name,
|
||||||
<include refid="listCombine">
|
|
||||||
<property name="condition" value="request.combine"/>
|
|
||||||
<property name="name" value="request.name"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="request.name != null">
|
|
||||||
and s_r.name like CONCAT('%', #{request.name},'%')
|
|
||||||
</if>
|
|
||||||
<if test="request.userId != null">
|
|
||||||
AND s_r.user_id = #{request.userId,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
<if test="request.projectId != null">
|
|
||||||
AND s_r.project_id = #{request.projectId}
|
|
||||||
</if>
|
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
|
||||||
<if test="values != null and values.size() > 0">
|
|
||||||
<choose>
|
|
||||||
<when test="key=='status'">
|
|
||||||
and s_r.status in
|
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
|
||||||
#{value}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
<when test="key=='report_type'">
|
|
||||||
and s_r.report_type in
|
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
|
||||||
#{value}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
and s_r.trigger_mode in
|
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
|
||||||
#{value}
|
|
||||||
</foreach>
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
AND s_r.execute_type = 'Saved'
|
|
||||||
<if test="request.orders != null and request.orders.size() > 0">
|
|
||||||
order by
|
|
||||||
<foreach collection="request.orders" separator="," item="order">
|
|
||||||
s_r.${order.name} ${order.type}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</where>) s_r on d_s_r.report_id = s_r.id
|
|
||||||
left join(
|
|
||||||
select
|
|
||||||
a_r.end_time,
|
a_r.end_time,
|
||||||
a_r.user_id,
|
a_r.user_id,
|
||||||
a_r.name,
|
a_r.name,
|
||||||
@ -356,50 +301,59 @@
|
|||||||
'Saved' as execute_type,
|
'Saved' as execute_type,
|
||||||
'API_INDEPENDENT' as report_type
|
'API_INDEPENDENT' as report_type
|
||||||
from api_definition_exec_result a_r
|
from api_definition_exec_result a_r
|
||||||
where (a_r.integrated_report_id is null or a_r.integrated_report_id = 'null')
|
where a_r.integrated_report_id is null or a_r.integrated_report_id = 'null'
|
||||||
<if test="request.combine != null">
|
) r
|
||||||
<include refid="listCombine">
|
<where>
|
||||||
<property name="condition" value="request.combine"/>
|
<if test="request.combine != null">
|
||||||
<property name="name" value="request.name"/>
|
<include refid="combine">
|
||||||
</include>
|
<property name="condition" value="request.combine"/>
|
||||||
</if>
|
<property name="name" value="request.name"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="request.name != null">
|
<if test="request.name != null">
|
||||||
and a_r.name like CONCAT('%', #{request.name},'%')
|
and r.name like CONCAT('%', #{request.name},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="request.userId != null">
|
<if test="request.userId != null">
|
||||||
AND a_r.user_id = #{request.userId,jdbcType=VARCHAR}
|
AND r.user_id = #{request.userId,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.projectId != null">
|
<if test="request.projectId != null">
|
||||||
AND a_r.project_id = #{request.projectId}
|
AND r.project_id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
<if test="request.filters != null and request.filters.size() > 0">
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||||
<if test="values != null and values.size() > 0">
|
<if test="values != null and values.size() > 0">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="key=='status'">
|
<when test="key=='status'">
|
||||||
and a_r.status in
|
and r.status in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</when>
|
</when>
|
||||||
<when test="key=='trigger_mode'">
|
<when test="key=='report_type'">
|
||||||
and a_r.trigger_mode in
|
and r.report_type in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
<otherwise>
|
||||||
</if>
|
and r.trigger_mode in
|
||||||
</foreach>
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
</if>
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
AND r.execute_type = 'Saved'
|
||||||
|
</where>
|
||||||
<if test="request.orders != null and request.orders.size() > 0">
|
<if test="request.orders != null and request.orders.size() > 0">
|
||||||
order by
|
order by
|
||||||
<foreach collection="request.orders" separator="," item="order">
|
<foreach collection="request.orders" separator="," item="order">
|
||||||
a_r.${order.name} ${order.type}
|
r.${order.name} ${order.type}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
) a_r on d_s_r.report_id = a_r.id
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="get" resultType="io.metersphere.api.dto.automation.APIScenarioReportResult">
|
<select id="get" resultType="io.metersphere.api.dto.automation.APIScenarioReportResult">
|
||||||
@ -517,62 +471,6 @@
|
|||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectCountByRequest" resultType="java.lang.Long">
|
|
||||||
SELECT
|
|
||||||
count(s_r.id)
|
|
||||||
FROM api_scenario_report s_r
|
|
||||||
<where>
|
|
||||||
<if test="request.combine != null">
|
|
||||||
<include refid="listCombine">
|
|
||||||
<property name="condition" value="request.combine"/>
|
|
||||||
<property name="name" value="request.name"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="request.name != null">
|
|
||||||
and s_r.name like CONCAT('%', #{request.name},'%')
|
|
||||||
</if>
|
|
||||||
<if test="request.userId != null">
|
|
||||||
AND s_r.user_id = #{request.userId,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
<if test="request.projectId != null">
|
|
||||||
AND s_r.project_id = #{request.projectId}
|
|
||||||
</if>
|
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
|
||||||
<if test="values != null and values.size() > 0">
|
|
||||||
<choose>
|
|
||||||
<when test="key=='status'">
|
|
||||||
and s_r.status in
|
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
|
||||||
#{value}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
<when test="key=='report_type'">
|
|
||||||
and s_r.report_type in
|
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
|
||||||
#{value}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
and s_r.trigger_mode in
|
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
|
||||||
#{value}
|
|
||||||
</foreach>
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
AND s_r.execute_type = 'Saved'
|
|
||||||
<if test="request.orders != null and request.orders.size() > 0">
|
|
||||||
order by
|
|
||||||
<foreach collection="request.orders" separator="," item="order">
|
|
||||||
s_r.${order.name} ${order.type}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<update id="update" parameterType="java.util.List">
|
<update id="update" parameterType="java.util.List">
|
||||||
update api_scenario_report set status="STOP" where id in
|
update api_scenario_report set status="STOP" where id in
|
||||||
|
@ -1,27 +1,16 @@
|
|||||||
package io.metersphere.base.mapper.ext;
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
|
||||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ExtApiScenarioReportProvider {
|
public class ExtApiScenarioReportProvider {
|
||||||
public String insertListSql(List<APIScenarioReportResult> list) {
|
public String insertListSql(List<APIScenarioReportResult> list) {
|
||||||
StringBuffer rsqlList = new StringBuffer();
|
|
||||||
rsqlList.append(";").append("insert into api_definition_scenario_relevance ( report_id ) values ");
|
|
||||||
StringBuffer sqlList = new StringBuffer();
|
StringBuffer sqlList = new StringBuffer();
|
||||||
sqlList.append("INSERT INTO api_scenario_report (id, project_id, `name`, create_time, update_time, `status`, user_id, trigger_mode," +
|
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 ");
|
" 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++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
APIScenarioReportResult result = list.get(i);
|
APIScenarioReportResult result = list.get(i);
|
||||||
rsqlList.append(" (")
|
|
||||||
.append("'")
|
|
||||||
.append(result.getId())
|
|
||||||
.append("'")
|
|
||||||
.append(")");
|
|
||||||
if (i < list.size() - 1) {
|
|
||||||
rsqlList.append(",");
|
|
||||||
}
|
|
||||||
sqlList.append(" (")
|
sqlList.append(" (")
|
||||||
.append("'")
|
.append("'")
|
||||||
.append(result.getId())
|
.append(result.getId())
|
||||||
@ -65,12 +54,6 @@ public class ExtApiScenarioReportProvider {
|
|||||||
sqlList.append(",");
|
sqlList.append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rsqlList.append(";");
|
|
||||||
sqlList.append(";");
|
|
||||||
sqlList.append(rsqlList);
|
|
||||||
return sqlList.toString();
|
return sqlList.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,28 +64,31 @@
|
|||||||
|
|
||||||
<!--要生成的数据库表 -->
|
<!--要生成的数据库表 -->
|
||||||
|
|
||||||
<table tableName="api_definition_scenario_relevance"/>
|
<!--<table tableName="test_plan_test_case"/>-->
|
||||||
<!--<table tableName="swagger_url_project"/>
|
<!--<table tableName="swagger_url_project"/>
|
||||||
<table tableName="user_header"/>-->
|
<table tableName="user_header"/>-->
|
||||||
<!--<table tableName="test_plan"/>-->
|
<!--<table tableName="test_plan"/>-->
|
||||||
<!--<table tableName="test_plan"/>-->
|
<!--<table tableName="test_plan"/>-->
|
||||||
<!--<table tableName="api_scenario_report"/>-->
|
<!--<table tableName="api_scenario_report"/>-->
|
||||||
<!--<table tableName="test_case_review"/>-->
|
<!--<table tableName="test_case_review"/>-->
|
||||||
<!--<table tableName="project">
|
<!-- <table tableName="project">-->
|
||||||
<ignoreColumn column="custom_num"/>
|
<!-- <ignoreColumn column="custom_num"/>-->
|
||||||
<ignoreColumn column="scenario_custom_num"/>
|
<!-- <ignoreColumn column="scenario_custom_num"/>-->
|
||||||
<ignoreColumn column="mock_tcp_port"/>
|
<!-- <ignoreColumn column="mock_tcp_port"/>-->
|
||||||
<ignoreColumn column="is_mock_tcp_open"/>
|
<!-- <ignoreColumn column="is_mock_tcp_open"/>-->
|
||||||
<ignoreColumn column="api_quick"/>
|
<!-- <ignoreColumn column="api_quick"/>-->
|
||||||
<ignoreColumn column="case_public"/>
|
<!-- <ignoreColumn column="case_public"/>-->
|
||||||
<ignoreColumn column="clean_track_report"/>
|
<!-- <ignoreColumn column="clean_track_report"/>-->
|
||||||
<ignoreColumn column="clean_track_report_expr"/>
|
<!-- <ignoreColumn column="clean_track_report_expr"/>-->
|
||||||
<ignoreColumn column="clean_api_report"/>
|
<!-- <ignoreColumn column="clean_api_report"/>-->
|
||||||
<ignoreColumn column="clean_api_report_expr"/>
|
<!-- <ignoreColumn column="clean_api_report_expr"/>-->
|
||||||
<ignoreColumn column="clean_load_report"/>
|
<!-- <ignoreColumn column="clean_load_report"/>-->
|
||||||
<ignoreColumn column="clean_load_report_expr"/>
|
<!-- <ignoreColumn column="clean_load_report_expr"/>-->
|
||||||
<ignoreColumn column="repeatable"/>
|
<!-- <ignoreColumn column="repeatable"/>-->
|
||||||
</table>-->
|
<!-- </table>-->
|
||||||
|
<table tableName="api_test_environment">
|
||||||
|
|
||||||
|
</table>
|
||||||
<!--<table tableName="enterprise_test_report_send_record"/>-->
|
<!--<table tableName="enterprise_test_report_send_record"/>-->
|
||||||
<!--<table tableName="test_case_review_api_case"/>
|
<!--<table tableName="test_case_review_api_case"/>
|
||||||
<table tableName="test_case_review_load"/>
|
<table tableName="test_case_review_load"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user