提交 e5ba2eba 编写于 作者: F fit2-zhao
......@@ -15,6 +15,7 @@ import io.metersphere.api.service.*;
import io.metersphere.base.domain.ApiTest;
import io.metersphere.base.domain.Schedule;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.utils.CronUtils;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
......@@ -28,15 +29,13 @@ import io.metersphere.service.ScheduleService;
import org.apache.jorphan.collections.HashTree;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.python.core.AstList;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
......@@ -345,8 +344,11 @@ public class APITestController {
@GetMapping("/runningTask/{projectID}")
public List<TaskInfoResult> runningTask(@PathVariable String projectID) {
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByProjectID(projectID);
List<String> typeFilter = Arrays.asList( // 首页显示的运行中定时任务,只要这3种,不需要 性能测试、api_test(旧版)
ScheduleGroup.API_SCENARIO_TEST.name(),
ScheduleGroup.SWAGGER_IMPORT.name(),
ScheduleGroup.TEST_PLAN_TEST.name());
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByProjectID(projectID, typeFilter);
int dataIndex = 1;
for (TaskInfoResult taskInfo :
resultList) {
......
......@@ -144,6 +144,11 @@ public class ApiAutomationController {
apiAutomationService.relevance(request);
}
@PostMapping("/relevance/review")
public void testCaseReviewRelevance(@RequestBody ApiCaseRelevanceRequest request){
apiAutomationService.relevanceReview(request);
}
@PostMapping(value = "/schedule/update")
public void updateSchedule(@RequestBody Schedule request) {
apiAutomationService.updateSchedule(request);
......
......@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.net.MalformedURLException;
import java.util.Date;
import java.util.List;
......@@ -58,6 +59,12 @@ public class ApiDefinitionController {
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
return PageUtils.setPageInfo(page, apiDefinitionService.listRelevance(request));
}
@PostMapping("/list/relevance/review/{goPage}/{pageSize}")
public Pager<List<ApiDefinitionResult>> listRelevanceReview(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
return PageUtils.setPageInfo(page, apiDefinitionService.listRelevanceReview(request));
}
@PostMapping("/list/all")
public List<ApiDefinitionResult> list(@RequestBody ApiDefinitionRequest request) {
......@@ -157,7 +164,7 @@ public class ApiDefinitionController {
//定时任务创建
@PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody ScheduleRequest request) {
public void createSchedule(@RequestBody ScheduleRequest request) throws MalformedURLException {
apiDefinitionService.createSchedule(request);
}
@PostMapping(value = "/schedule/update")
......@@ -217,6 +224,10 @@ public class ApiDefinitionController {
public void testPlanRelevance(@RequestBody ApiCaseRelevanceRequest request) {
apiDefinitionService.testPlanRelevance(request);
}
@PostMapping("/relevance/review")
public void testCaseReviewRelevance(@RequestBody ApiCaseRelevanceRequest request){
apiDefinitionService.testCaseReviewRelevance(request);
}
@PostMapping("/preview")
public String preview(@RequestBody String jsonSchema) {
......
......@@ -120,6 +120,10 @@ public class ApiTestCaseController {
public void testPlanRelevance(@RequestBody ApiCaseRelevanceRequest request) {
apiTestCaseService.relevanceByCase(request);
}
@PostMapping("/relevance/review")
public void testCaseReviewRelevance(@RequestBody ApiCaseRelevanceRequest request){
apiTestCaseService.relevanceByApiByReview(request);
}
@PostMapping(value = "/jenkins/run")
public String jenkinsRun(@RequestBody RunCaseRequest request) {
......
......@@ -22,4 +22,5 @@ public class ApiScenarioRequest extends BaseQueryRequest {
private long createTime = 0;
private String executeStatus;
private boolean notInTestPlan;
private String reviewId;
}
......@@ -25,4 +25,5 @@ public class TestPlanScenarioRequest {
private Map<String, List<String>> filters;
private Map<String, Object> combine;
private List<String> ids;
private String reviewId;
}
......@@ -29,5 +29,7 @@ public class TaskInfoResult {
private Long updateTime;
//定时任务类型 情景定时任务/范围计划任务
private String taskType;
//定时任务组别 swagger/scenario/testPlan 等
private String taskGroup;
}
......@@ -20,4 +20,5 @@ public class ApiDefinitionRequest extends BaseQueryRequest {
private long createTime = 0;
private String status;
private String apiCaseCoverage;
private String reviewId;
}
......@@ -27,4 +27,5 @@ public class ApiTestCaseRequest {
private Map<String, Object> combine;
private boolean isSelectThisWeedData;
private long createTime = 0;
private String reviewId;
}
......@@ -339,6 +339,8 @@ public class APITestService {
schedule.setJob(ApiTestJob.class.getName());
schedule.setGroup(ScheduleGroup.API_TEST.name());
schedule.setType(ScheduleType.CRON.name());
schedule.setProjectId(request.getProjectId());
schedule.setName(request.getName());
return schedule;
}
......
......@@ -23,11 +23,9 @@ import io.metersphere.api.parse.ApiImportParser;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.ApiScenarioReportMapper;
import io.metersphere.base.mapper.TestCaseReviewScenarioMapper;
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
......@@ -63,6 +61,8 @@ import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiAutomationService {
@Resource
private ExtScheduleMapper extScheduleMapper;
@Resource
private ApiScenarioMapper apiScenarioMapper;
@Resource
......@@ -72,6 +72,8 @@ public class ApiAutomationService {
@Resource
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
@Resource
private TestCaseReviewScenarioMapper testCaseReviewScenarioMapper;
@Resource
private JMeterService jMeterService;
@Resource
private ApiTestEnvironmentService environmentService;
......@@ -95,7 +97,12 @@ public class ApiAutomationService {
setApiScenarioProjectIds(list);
return list;
}
public List<ApiScenarioDTO> listReview(ApiScenarioRequest request) {
request = this.initRequest(request, true, true);
List<ApiScenarioDTO> list = extApiScenarioMapper.listReview(request);
setApiScenarioProjectIds(list);
return list;
}
private void setApiScenarioProjectIds(List<ApiScenarioDTO> list) {
// 如果场景步骤涉及多项目,则把涉及到的项目ID保存在projectIds属性
list.forEach(data -> {
......@@ -196,6 +203,7 @@ public class ApiAutomationService {
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
apiScenarioMapper.updateByPrimaryKeySelective(scenario);
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name,同步到修改首页定时任务
}
public ApiScenarioWithBLOBs buildSaveScenario(SaveApiScenarioRequest request) {
......@@ -705,7 +713,32 @@ public class ApiAutomationService {
testPlanApiScenarioMapper.insert(testPlanApiScenario);
});
}
public void relevanceReview(ApiCaseRelevanceRequest request){
Map<String, List<String>> mapping = request.getMapping();
Map<String, String> envMap = request.getEnvMap();
Set<String> set = mapping.keySet();
if (set.isEmpty()) {
return;
}
set.forEach(id->{
Map<String, String> newEnvMap = new HashMap<>(16);
if (envMap != null && !envMap.isEmpty()) {
List<String> list = mapping.get(id);
list.forEach(l -> {
newEnvMap.put(l, envMap.get(l));
});
}
TestCaseReviewScenario testCaseReviewScenario=new TestCaseReviewScenario();
testCaseReviewScenario.setId(UUID.randomUUID().toString());
testCaseReviewScenario.setApiScenarioId(id);
testCaseReviewScenario.setTestCaseReviewId(request.getReviewId());
testCaseReviewScenario.setCreateTime(System.currentTimeMillis());
testCaseReviewScenario.setUpdateTime(System.currentTimeMillis());
testCaseReviewScenario.setEnvironment(JSON.toJSONString(newEnvMap));
testCaseReviewScenarioMapper.insert(testCaseReviewScenario);
});
}
public List<ApiScenario> selectByIds(List<String> ids) {
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(ids);
......@@ -720,6 +753,9 @@ public class ApiAutomationService {
public void createSchedule(ScheduleRequest request) {
Schedule schedule = scheduleService.buildApiTestSchedule(request);
ApiScenarioWithBLOBs apiScene = apiScenarioMapper.selectByPrimaryKey(request.getResourceId());
schedule.setName(apiScene.getName()); // add场景定时任务时,设置新增的数据库表字段的值
schedule.setProjectId(apiScene.getProjectId());
schedule.setJob(ApiScenarioTestJob.class.getName());
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());
schedule.setType(ScheduleType.CRON.name());
......
......@@ -15,6 +15,7 @@ import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
import io.metersphere.track.service.TestCaseReviewApiCaseService;
import io.metersphere.track.service.TestPlanApiCaseService;
import io.metersphere.track.service.TestPlanService;
import org.apache.commons.collections4.CollectionUtils;
......@@ -41,6 +42,8 @@ public class ApiDefinitionExecResultService {
private TestPlanService testPlanService;
@Resource
private ApiTestCaseMapper apiTestCaseMapper;
@Resource
private TestCaseReviewApiCaseService testCaseReviewApiCaseService;
@Resource
SqlSessionFactory sqlSessionFactory;
......@@ -67,6 +70,8 @@ public class ApiDefinitionExecResultService {
saveResult.setStatus(status);
if (StringUtils.equals(type, ApiRunMode.API_PLAN.name())) {
testPlanApiCaseService.setExecResult(item.getName(), status);
testCaseReviewApiCaseService.setExecResult(item.getName(), status);
}
// 更新用例最后执行结果
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = new ApiTestCaseWithBLOBs();
......@@ -118,6 +123,7 @@ public class ApiDefinitionExecResultService {
} else {
userID = Objects.requireNonNull(SessionUtils.getUser()).getId();
testPlanApiCaseService.setExecResult(item.getName(), status);
testCaseReviewApiCaseService.setExecResult(item.getName(), status);
}
saveResult.setUserId(userID);
......
......@@ -49,6 +49,7 @@ import sun.security.util.Cache;
import javax.annotation.Resource;
import java.io.File;
import java.net.MalformedURLException;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -589,6 +590,10 @@ public class ApiDefinitionService {
apiTestCaseService.relevanceByApi(request);
}
public void testCaseReviewRelevance(ApiCaseRelevanceRequest request) {
apiTestCaseService.relevanceByApiByReview(request);
}
/**
* 数据统计-接口类型
*
......@@ -673,6 +678,12 @@ public class ApiDefinitionService {
calculateResult(resList);
return resList;
}
public List<ApiDefinitionResult> listRelevanceReview(ApiDefinitionRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<ApiDefinitionResult> resList = extApiDefinitionMapper.listRelevanceReview(request);
calculateResult(resList);
return resList;
}
public void calculateResult(List<ApiDefinitionResult> resList) {
if (!resList.isEmpty()) {
......@@ -702,7 +713,7 @@ public class ApiDefinitionService {
}
/*swagger定时导入*/
public void createSchedule(ScheduleRequest request) {
public void createSchedule(ScheduleRequest request) throws MalformedURLException {
/*保存swaggerUrl*/
SwaggerUrlProject swaggerUrlProject = new SwaggerUrlProject();
swaggerUrlProject.setId(UUID.randomUUID().toString());
......@@ -714,6 +725,9 @@ public class ApiDefinitionService {
scheduleService.addSwaggerUrlSchedule(swaggerUrlProject);
request.setResourceId(swaggerUrlProject.getId());
Schedule schedule = scheduleService.buildApiTestSchedule(request);
schedule.setProjectId(swaggerUrlProject.getProjectId());
java.net.URL swaggerUrl = new java.net.URL(swaggerUrlProject.getSwaggerUrl());
schedule.setName(swaggerUrl.getHost()); // swagger 定时任务的 name 设置为 swaggerURL 的域名
schedule.setJob(SwaggerUrlImportJob.class.getName());
schedule.setGroup(ScheduleGroup.SWAGGER_IMPORT.name());
schedule.setType(ScheduleType.CRON.name());
......
......@@ -112,7 +112,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
apiModuleDTO.setName(name);
apiModuleDTO.setLabel(name);
apiModuleDTO.setChildren(nodeList);
if (!org.springframework.util.CollectionUtils.isEmpty(nodeList)) {
list.add(apiModuleDTO);
}
});
return list;
}
......
......@@ -100,7 +100,9 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
scenarioModuleDTO.setName(name);
scenarioModuleDTO.setLabel(name);
scenarioModuleDTO.setChildren(nodeList);
if (!org.springframework.util.CollectionUtils.isEmpty(nodeList)) {
list.add(scenarioModuleDTO);
}
});
return list;
}
......
......@@ -18,10 +18,7 @@ import io.metersphere.api.dto.scenario.request.RequestType;
import io.metersphere.api.jmeter.JMeterService;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
......@@ -53,6 +50,8 @@ public class ApiTestCaseService {
@Resource
TestPlanMapper testPlanMapper;
@Resource
TestCaseReviewMapper testCaseReviewMapper;
@Resource
private ApiTestCaseMapper apiTestCaseMapper;
@Resource
private SqlSessionFactory sqlSessionFactory;
......@@ -313,7 +312,16 @@ public class ApiTestCaseService {
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
relevance(apiTestCases, request);
}
public void relevanceByApiByReview(ApiCaseRelevanceRequest request){
List<String> ids = request.getSelectIds();
if (CollectionUtils.isEmpty(ids)) {
return;
}
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andIdIn(ids);
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
relevanceByReview(apiTestCases, request);
}
public void relevanceByCase(ApiCaseRelevanceRequest request) {
List<String> ids = request.getSelectIds();
if (CollectionUtils.isEmpty(ids)) {
......@@ -350,9 +358,33 @@ public class ApiTestCaseService {
sqlSession.flushStatements();
}
private void relevanceByReview(List<ApiTestCase> apiTestCases, ApiCaseRelevanceRequest request) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ExtTestCaseReviewApiCaseMapper batchMapper = sqlSession.getMapper(ExtTestCaseReviewApiCaseMapper.class);
apiTestCases.forEach(apiTestCase -> {
TestCaseReviewApiCase TestCaseReviewApiCase = new TestCaseReviewApiCase();
TestCaseReviewApiCase.setId(UUID.randomUUID().toString());
TestCaseReviewApiCase.setApiCaseId(apiTestCase.getId());
TestCaseReviewApiCase.setTestCaseReviewId(request.getReviewId());
TestCaseReviewApiCase.setEnvironmentId(request.getEnvironmentId());
TestCaseReviewApiCase.setCreateTime(System.currentTimeMillis());
TestCaseReviewApiCase.setUpdateTime(System.currentTimeMillis());
batchMapper.insertIfNotExists(TestCaseReviewApiCase);
});
TestCaseReview testCaseReview=testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
if (StringUtils.equals(testCaseReview.getStatus(), TestPlanStatus.Prepare.name())
|| StringUtils.equals(testCaseReview.getStatus(), TestPlanStatus.Completed.name())) {
testCaseReview.setStatus(TestPlanStatus.Underway.name());
testCaseReviewMapper.updateByPrimaryKey(testCaseReview);
}
sqlSession.flushStatements();
}
public List<String> selectIdsNotExistsInPlan(String projectId, String planId) {
return extApiTestCaseMapper.selectIdsNotExistsInPlan(projectId, planId);
}
public List<String> selectIdsNotExistsInReview(String projectId,String reviewId){
return extApiTestCaseMapper.selectIdsNotExistsInReview(projectId,reviewId);
}
public List<ApiDataCountResult> countProtocolByProjectID(String projectId) {
return extApiTestCaseMapper.countProtocolByProjectID(projectId);
......
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class Schedule implements Serializable {
......@@ -30,7 +29,9 @@ public class Schedule implements Serializable {
private Long updateTime;
private String customData;
private String projectId;
private String name;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -913,6 +913,146 @@ public class ScheduleExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
......@@ -244,6 +244,76 @@ public class TestCaseExample {
return (Criteria) this;
}
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andNodePathIsNull() {
addCriterion("node_path is null");
return (Criteria) this;
......@@ -924,76 +994,6 @@ public class TestCaseExample {
return (Criteria) this;
}
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
......
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestCaseReviewApiCase implements Serializable {
private String id;
private String testCaseReviewId;
private String apiCaseId;
private String status;
private String environmentId;
private Long createTime;
private Long updateTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestCaseReviewLoad implements Serializable {
private String id;
private String testCaseReviewId;
private String loadCaseId;
private String status;
private Long createTime;
private Long updateTime;
private String loadReportId;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestCaseReviewScenario implements Serializable {
private String id;
private String testCaseReviewId;
private String apiScenarioId;
private String status;
private String environment;
private Long createTime;
private Long updateTime;
private String passRate;
private String lastResult;
private String reportId;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -16,21 +16,15 @@ public interface ScheduleMapper {
int insertSelective(Schedule record);
List<Schedule> selectByExampleWithBLOBs(ScheduleExample example);
List<Schedule> selectByExample(ScheduleExample example);
Schedule selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") Schedule record, @Param("example") ScheduleExample example);
int updateByExampleWithBLOBs(@Param("record") Schedule record, @Param("example") ScheduleExample example);
int updateByExample(@Param("record") Schedule record, @Param("example") ScheduleExample example);
int updateByPrimaryKeySelective(Schedule record);
int updateByPrimaryKeyWithBLOBs(Schedule record);
int updateByPrimaryKey(Schedule record);
}
\ No newline at end of file
......@@ -14,9 +14,8 @@
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.Schedule">
<result column="custom_data" jdbcType="LONGVARCHAR" property="customData" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
......@@ -78,27 +77,8 @@
</sql>
<sql id="Base_Column_List">
id, `key`, `type`, `value`, `group`, job, `enable`, resource_id, user_id, workspace_id,
create_time, update_time
</sql>
<sql id="Blob_Column_List">
custom_data
create_time, update_time, project_id, `name`
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ScheduleExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from schedule
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ScheduleExample" resultMap="BaseResultMap">
select
<if test="distinct">
......@@ -113,11 +93,9 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from schedule
where id = #{id,jdbcType=VARCHAR}
</select>
......@@ -136,12 +114,12 @@
`value`, `group`, job,
`enable`, resource_id, user_id,
workspace_id, create_time, update_time,
custom_data)
project_id, `name`)
values (#{id,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{value,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR},
#{enable,jdbcType=BIT}, #{resourceId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{workspaceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{customData,jdbcType=LONGVARCHAR})
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Schedule">
insert into schedule
......@@ -182,8 +160,11 @@
<if test="updateTime != null">
update_time,
</if>
<if test="customData != null">
custom_data,
<if test="projectId != null">
project_id,
</if>
<if test="name != null">
`name`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -223,8 +204,11 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="customData != null">
#{customData,jdbcType=LONGVARCHAR},
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
</trim>
</insert>
......@@ -273,29 +257,13 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.customData != null">
custom_data = #{record.customData,jdbcType=LONGVARCHAR},
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update schedule
set id = #{record.id,jdbcType=VARCHAR},
`key` = #{record.key,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`value` = #{record.value,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
job = #{record.job,jdbcType=VARCHAR},
`enable` = #{record.enable,jdbcType=BIT},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
custom_data = #{record.customData,jdbcType=LONGVARCHAR}
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -313,7 +281,9 @@
user_id = #{record.userId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
update_time = #{record.updateTime,jdbcType=BIGINT},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -354,28 +324,15 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="customData != null">
custom_data = #{customData,jdbcType=LONGVARCHAR},
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.Schedule">
update schedule
set `key` = #{key,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
`value` = #{value,jdbcType=VARCHAR},
`group` = #{group,jdbcType=VARCHAR},
job = #{job,jdbcType=VARCHAR},
`enable` = #{enable,jdbcType=BIT},
resource_id = #{resourceId,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
custom_data = #{customData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Schedule">
update schedule
set `key` = #{key,jdbcType=VARCHAR},
......@@ -388,7 +345,9 @@
user_id = #{userId,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
update_time = #{updateTime,jdbcType=BIGINT},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
package io.metersphere.base.mapper;
import io.metersphere.base.domain.TestCaseReviewApiCase;
import io.metersphere.base.domain.TestCaseReviewApiCaseExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestCaseReviewApiCaseMapper {
long countByExample(TestCaseReviewApiCaseExample example);
int deleteByExample(TestCaseReviewApiCaseExample example);
int deleteByPrimaryKey(String id);
int insert(TestCaseReviewApiCase record);
int insertSelective(TestCaseReviewApiCase record);
List<TestCaseReviewApiCase> selectByExample(TestCaseReviewApiCaseExample example);
TestCaseReviewApiCase selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestCaseReviewApiCase record, @Param("example") TestCaseReviewApiCaseExample example);
int updateByExample(@Param("record") TestCaseReviewApiCase record, @Param("example") TestCaseReviewApiCaseExample example);
int updateByPrimaryKeySelective(TestCaseReviewApiCase record);
int updateByPrimaryKey(TestCaseReviewApiCase record);
}
\ No newline at end of file
<?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.TestCaseReviewApiCaseMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseReviewApiCase">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="test_case_review_id" jdbcType="VARCHAR" property="testCaseReviewId" />
<result column="api_case_id" jdbcType="VARCHAR" property="apiCaseId" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</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">
id, test_case_review_id, api_case_id, `status`, environment_id, create_time, update_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseReviewApiCaseExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from test_case_review_api_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from test_case_review_api_case
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from test_case_review_api_case
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseReviewApiCaseExample">
delete from test_case_review_api_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReviewApiCase">
insert into test_case_review_api_case (id, test_case_review_id, api_case_id,
`status`, environment_id, create_time,
update_time)
values (#{id,jdbcType=VARCHAR}, #{testCaseReviewId,jdbcType=VARCHAR}, #{apiCaseId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReviewApiCase">
insert into test_case_review_api_case
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="testCaseReviewId != null">
test_case_review_id,
</if>
<if test="apiCaseId != null">
api_case_id,
</if>
<if test="status != null">
`status`,
</if>
<if test="environmentId != null">
environment_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="testCaseReviewId != null">
#{testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="apiCaseId != null">
#{apiCaseId,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="environmentId != null">
#{environmentId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseReviewApiCaseExample" resultType="java.lang.Long">
select count(*) from test_case_review_api_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_case_review_api_case
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.testCaseReviewId != null">
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="record.apiCaseId != null">
api_case_id = #{record.apiCaseId,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.environmentId != null">
environment_id = #{record.environmentId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_case_review_api_case
set id = #{record.id,jdbcType=VARCHAR},
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
api_case_id = #{record.apiCaseId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseReviewApiCase">
update test_case_review_api_case
<set>
<if test="testCaseReviewId != null">
test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="apiCaseId != null">
api_case_id = #{apiCaseId,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="environmentId != null">
environment_id = #{environmentId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReviewApiCase">
update test_case_review_api_case
set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
api_case_id = #{apiCaseId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
package io.metersphere.base.mapper;
import io.metersphere.base.domain.TestCaseReviewLoad;
import io.metersphere.base.domain.TestCaseReviewLoadExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestCaseReviewLoadMapper {
long countByExample(TestCaseReviewLoadExample example);
int deleteByExample(TestCaseReviewLoadExample example);
int deleteByPrimaryKey(String id);
int insert(TestCaseReviewLoad record);
int insertSelective(TestCaseReviewLoad record);
List<TestCaseReviewLoad> selectByExample(TestCaseReviewLoadExample example);
TestCaseReviewLoad selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestCaseReviewLoad record, @Param("example") TestCaseReviewLoadExample example);
int updateByExample(@Param("record") TestCaseReviewLoad record, @Param("example") TestCaseReviewLoadExample example);
int updateByPrimaryKeySelective(TestCaseReviewLoad record);
int updateByPrimaryKey(TestCaseReviewLoad record);
}
\ No newline at end of file
<?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.TestCaseReviewLoadMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseReviewLoad">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="test_case_review_id" jdbcType="VARCHAR" property="testCaseReviewId" />
<result column="load_case_id" jdbcType="VARCHAR" property="loadCaseId" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="load_report_id" jdbcType="VARCHAR" property="loadReportId" />
</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">
id, test_case_review_id, load_case_id, `status`, create_time, update_time, load_report_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseReviewLoadExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from test_case_review_load
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from test_case_review_load
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from test_case_review_load
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseReviewLoadExample">
delete from test_case_review_load
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReviewLoad">
insert into test_case_review_load (id, test_case_review_id, load_case_id,
`status`, create_time, update_time,
load_report_id)
values (#{id,jdbcType=VARCHAR}, #{testCaseReviewId,jdbcType=VARCHAR}, #{loadCaseId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{loadReportId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReviewLoad">
insert into test_case_review_load
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="testCaseReviewId != null">
test_case_review_id,
</if>
<if test="loadCaseId != null">
load_case_id,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="loadReportId != null">
load_report_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="testCaseReviewId != null">
#{testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="loadCaseId != null">
#{loadCaseId,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="loadReportId != null">
#{loadReportId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseReviewLoadExample" resultType="java.lang.Long">
select count(*) from test_case_review_load
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_case_review_load
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.testCaseReviewId != null">
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="record.loadCaseId != null">
load_case_id = #{record.loadCaseId,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.loadReportId != null">
load_report_id = #{record.loadReportId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_case_review_load
set id = #{record.id,jdbcType=VARCHAR},
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
load_case_id = #{record.loadCaseId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
load_report_id = #{record.loadReportId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseReviewLoad">
update test_case_review_load
<set>
<if test="testCaseReviewId != null">
test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="loadCaseId != null">
load_case_id = #{loadCaseId,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="loadReportId != null">
load_report_id = #{loadReportId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReviewLoad">
update test_case_review_load
set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
load_case_id = #{loadCaseId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
load_report_id = #{loadReportId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
package io.metersphere.base.mapper;
import io.metersphere.base.domain.TestCaseReviewScenario;
import io.metersphere.base.domain.TestCaseReviewScenarioExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestCaseReviewScenarioMapper {
long countByExample(TestCaseReviewScenarioExample example);
int deleteByExample(TestCaseReviewScenarioExample example);
int deleteByPrimaryKey(String id);
int insert(TestCaseReviewScenario record);
int insertSelective(TestCaseReviewScenario record);
List<TestCaseReviewScenario> selectByExample(TestCaseReviewScenarioExample example);
TestCaseReviewScenario selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestCaseReviewScenario record, @Param("example") TestCaseReviewScenarioExample example);
int updateByExample(@Param("record") TestCaseReviewScenario record, @Param("example") TestCaseReviewScenarioExample example);
int updateByPrimaryKeySelective(TestCaseReviewScenario record);
int updateByPrimaryKey(TestCaseReviewScenario record);
}
\ No newline at end of file
<?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.TestCaseReviewScenarioMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseReviewScenario">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="test_case_review_id" jdbcType="VARCHAR" property="testCaseReviewId" />
<result column="api_scenario_id" jdbcType="VARCHAR" property="apiScenarioId" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="environment" jdbcType="VARCHAR" property="environment" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="pass_rate" jdbcType="VARCHAR" property="passRate" />
<result column="last_result" jdbcType="VARCHAR" property="lastResult" />
<result 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">
id, test_case_review_id, api_scenario_id, `status`, environment, create_time, update_time,
pass_rate, last_result, report_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseReviewScenarioExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from test_case_review_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from test_case_review_scenario
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from test_case_review_scenario
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseReviewScenarioExample">
delete from test_case_review_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReviewScenario">
insert into test_case_review_scenario (id, test_case_review_id, api_scenario_id,
`status`, environment, create_time,
update_time, pass_rate, last_result,
report_id)
values (#{id,jdbcType=VARCHAR}, #{testCaseReviewId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{environment,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR},
#{reportId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReviewScenario">
insert into test_case_review_scenario
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="testCaseReviewId != null">
test_case_review_id,
</if>
<if test="apiScenarioId != null">
api_scenario_id,
</if>
<if test="status != null">
`status`,
</if>
<if test="environment != null">
environment,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="passRate != null">
pass_rate,
</if>
<if test="lastResult != null">
last_result,
</if>
<if test="reportId != null">
report_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="testCaseReviewId != null">
#{testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="apiScenarioId != null">
#{apiScenarioId,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="environment != null">
#{environment,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="passRate != null">
#{passRate,jdbcType=VARCHAR},
</if>
<if test="lastResult != null">
#{lastResult,jdbcType=VARCHAR},
</if>
<if test="reportId != null">
#{reportId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseReviewScenarioExample" resultType="java.lang.Long">
select count(*) from test_case_review_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_case_review_scenario
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.testCaseReviewId != null">
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="record.apiScenarioId != null">
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.environment != null">
environment = #{record.environment,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.passRate != null">
pass_rate = #{record.passRate,jdbcType=VARCHAR},
</if>
<if test="record.lastResult != null">
last_result = #{record.lastResult,jdbcType=VARCHAR},
</if>
<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 test_case_review_scenario
set id = #{record.id,jdbcType=VARCHAR},
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
environment = #{record.environment,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseReviewScenario">
update test_case_review_scenario
<set>
<if test="testCaseReviewId != null">
test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
</if>
<if test="apiScenarioId != null">
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="environment != null">
environment = #{environment,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="passRate != null">
pass_rate = #{passRate,jdbcType=VARCHAR},
</if>
<if test="lastResult != null">
last_result = #{lastResult,jdbcType=VARCHAR},
</if>
<if test="reportId != null">
report_id = #{reportId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReviewScenario">
update test_case_review_scenario
set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
environment = #{environment,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
......@@ -36,6 +36,6 @@ public interface ExtApiDefinitionMapper {
ApiDefinition getNextNum(@Param("projectId") String projectId);
List<ApiDefinitionResult> listRelevance(@Param("request")ApiDefinitionRequest request);
List<ApiDefinitionResult> listRelevanceReview(@Param("request")ApiDefinitionRequest request);
List<String> selectIds(@Param("request") BaseQueryRequest query);
}
\ No newline at end of file
......@@ -363,6 +363,86 @@
</foreach>
</if>
</select>
<select id="listRelevanceReview" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
select
<include refid="io.metersphere.base.mapper.ApiDefinitionMapper.Base_Column_List"/>
from api_definition
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
<if test="request.name != null">
and api_definition.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.protocol != null">
AND api_definition.protocol = #{request.protocol}
</if>
<if test="request.id != null">
AND api_definition.id = #{request.id}
</if>
<if test="request.moduleId != null">
AND api_definition.module_id = #{request.moduleId}
</if>
<if test="request.projectId != null">
AND api_definition.project_id = #{request.projectId}
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
AND api_definition.module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</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 api_definition.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='method'">
and api_definition.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='user_id'">
and api_definition.user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
and exists (
select id
from api_test_case c
where c.api_definition_id = api_definition.id
and not exists (
select id
from test_case_review_api_case t
where t.api_case_id = c.id
and t.test_case_review_id = #{request.reviewId}
)
)
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
api_definition.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="selectScheduleList" resultType="io.metersphere.api.dto.definition.ApiSwaggerUrlDTO">
SELECT apiScene.id AS scenarioId,
apiScene.`name` AS `name`,
......
......@@ -13,7 +13,7 @@ import java.util.List;
public interface ExtApiScenarioMapper {
List<ApiScenarioDTO> list(@Param("request") ApiScenarioRequest request);
List<ApiScenarioDTO> listReview(@Param("request") ApiScenarioRequest request);
List<ApiScenarioWithBLOBs> selectByTagId(@Param("id") String id);
List<ApiScenarioWithBLOBs> selectIds(@Param("ids") List<String> ids);
......
......@@ -337,5 +337,118 @@
<include refid="queryWhereCondition"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
<select id="listReview" resultMap="BaseResultMap">
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
api_scenario.scenario_definition,
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people,
api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id,
api_scenario.schedule, api_scenario.description, api_scenario.create_time, api_scenario.update_time,
project.name as project_name, user.name as user_name
from api_scenario
left join project on api_scenario.project_id = project.id
left join user on api_scenario.user_id = user.id
<include refid="queryWhereConditionReview"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
<sql id="queryWhereConditionReview">
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
<if test="request.name != null">
and (api_scenario.name like CONCAT('%', #{request.name},'%')
or api_scenario.tags like CONCAT('%', #{request.name},'%')
or api_scenario.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId}
</if>
<if test="request.projectId != null">
AND project.id = #{request.projectId}
</if>
<if test="request.id != null">
AND api_scenario.id = #{request.id}
</if>
<if test="request.userId != null">
AND api_scenario.user_id = #{request.userId}
</if>
<if test="request.moduleId != null">
AND api_scenario.api_scenario_module_id = #{request.moduleId}
</if>
<if test="request.projectId != null">
AND api_scenario.project_id = #{request.projectId}
</if>
<if test="request.createTime >0 ">
AND api_scenario.create_time >= #{request.createTime}
</if>
<if test="request.ids != null and request.ids.size() > 0">
AND api_scenario.id in
<foreach collection="request.ids" item="itemId" separator="," open="(" close=")">
#{itemId}
</foreach>
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
AND api_scenario.api_scenario_module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</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 api_scenario.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='user_id'">
and api_scenario.user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='level'">
and api_scenario.level in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='last_result'">
and api_scenario.last_result in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
<if test="request.executeStatus == 'unExecute'">
and api_scenario.last_result IS NULL
</if>
<if test="request.executeStatus == 'executeFailed'">
and api_scenario.last_result = 'Fail'
</if>
<if test="request.executeStatus == 'executePass'">
and api_scenario.last_result = 'Success'
</if>
<if test="request.notInTestPlan == true ">
and api_scenario.id not in (
select pc.api_scenario_id
from test_case_review_scenario pc
where pc.test_case_review_id = #{request.reviewId}
)
</if>
</where>
</sql>
</mapper>
\ No newline at end of file
......@@ -20,6 +20,8 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCaseDTO> listSimple(@Param("request") ApiTestCaseRequest request);
List<String> selectIdsNotExistsInPlan(@Param("projectId") String projectId, @Param("planId") String planId);
List<String> selectIdsNotExistsInReview(@Param("projectId") String projectId, @Param("reviewId") String reviewId);
List<ApiDataCountResult> countProtocolByProjectID(String projectId);
......
......@@ -337,6 +337,15 @@
where pc.test_plan_id = #{planId}
)
</select>
<select id="selectIdsNotExistsInReview" resultType="java.lang.String">
select c.id
from api_test_case c
where c.project_id = #{projectId} and c.id not in (
select pc.api_case_id
from test_case_review_api_case pc
where pc.test_case_review_id = #{reviewId}
)
</select>
<select id="countProtocolByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
SELECT apiDef.protocol AS groupField,COUNT(testCase.id) AS countNumber FROM api_test_case testCase
......
......@@ -15,10 +15,12 @@ public interface ExtScheduleMapper {
long countTaskByProjectIdAndCreateTimeRange(@Param("projectId")String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime);
List<TaskInfoResult> findRunningTaskInfoByProjectID(String workspaceID);
List<TaskInfoResult> findRunningTaskInfoByProjectID(@Param("projectId") String workspaceID, @Param("types") List<String> typeFilter);
void insert(@Param("apiSwaggerUrlDTO") ApiSwaggerUrlDTO apiSwaggerUrlDTO);
ApiSwaggerUrlDTO select(String id);
int updateNameByResourceID(@Param("resourceId") String resourceId, @Param("name") String name);
}
\ No newline at end of file
......@@ -61,35 +61,33 @@
AND create_time BETWEEN #{startTime} and #{endTime}
</select>
<select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.api.dto.datacount.response.TaskInfoResult">
SELECT apiScene.id AS scenarioId,
apiScene.`name` AS `name`,
sch.id AS taskID,
SELECT sch.id AS taskID,
sch.`name` AS `name`,
sch.`value` AS rule,
sch.`enable` AS `taskStatus`,
u.`name` AS creator,
sch.update_time AS updateTime,
'scenario' AS taskType
FROM api_scenario apiScene
INNER JOIN `schedule` sch ON apiScene.id = sch.resource_id
INNER JOIN `user` u ON u.id = sch.user_id
WHERE sch.`enable` = true
AND apiScene.project_id = #{0,jdbcType=VARCHAR}
UNION
SELECT testPlan.id AS scenarioId,
testPlan.`name` AS `name`,
sch.id AS taskID,
sch.`value` AS rule,
sch.`enable` AS `taskStatus`,
u.`name` AS creator,
u.name AS creator,
sch.update_time AS updateTime,
'testPlan' AS taskType
FROM test_plan testPlan
INNER JOIN `schedule` sch ON testPlan.id = sch.resource_id
INNER JOIN `user` u ON u.id = sch.user_id
sch.type AS taskType,
sch.group AS taskGroup
FROM (
schedule sch left join user u
ON sch.user_id = u.id
)
WHERE sch.`enable` = true
AND testPlan.project_id = #{0,jdbcType=VARCHAR}
AND sch.project_id = #{projectId,jdbcType=VARCHAR}
and sch.group in
<foreach collection="types" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<select id="select" resultType="io.metersphere.api.dto.definition.ApiSwaggerUrlDTO">
select * from swagger_url_project where id=#{id}
</select>
<update id="updateNameByResourceID">
update schedule set name = #{name} where resource_id = #{resourceId}
</update>
</mapper>
\ No newline at end of file
......@@ -306,6 +306,9 @@
or test_case.num like CONCAT('%', #{request.name},'%')
or test_case.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.createTime >0">
AND test_case.create_time >= #{request.createTime}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
......@@ -316,6 +319,12 @@
and test_case.project_id = #{request.projectId}
</if>
<include refid="filters"/>
<if test="request.caseCoverage == 'uncoverage' ">
and test_case.test_id is null and test_case.type != 'functional'
</if>
<if test="request.caseCoverage == 'coverage' ">
and test_case.test_id is not null and test_case.type != 'functional'
</if>
</where>
</sql>
......
package io.metersphere.base.mapper.ext;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
import io.metersphere.base.domain.TestCaseReviewApiCase;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtTestCaseReviewApiCaseMapper {
void insertIfNotExists(@Param("request")TestCaseReviewApiCase testCaseReviewApiCase);
List<TestPlanApiCaseDTO> list(@Param("request") ApiTestCaseRequest request);
List<String> getExecResultByReviewId(String reviewId);
List<String> getIdsByReviewId(String reviewId);
List<String> getNotRelevanceCaseIds(@Param("reviewId")String reviewId, @Param("relevanceProjectIds")List<String> relevanceProjectIds);
List<String> getStatusByTestReviewId(String id);
}
<?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.ext.ExtTestCaseReviewApiCaseMapper">
<insert id="insertIfNotExists" parameterType="io.metersphere.base.domain.TestCaseReviewApiCase">
-- 查询没有数据再插入
INSERT INTO test_case_review_api_case(id, test_case_review_id, api_case_id, environment_id, create_time, update_time)
SELECT #{request.id}, #{request.testCaseReviewId}, #{request.apiCaseId}, #{request.environmentId}, #{request.createTime}, #{request.updateTime}
FROM DUAL
WHERE NOT EXISTS(
SELECT id FROM
test_case_review_api_case
WHERE test_case_review_id = #{request.testCaseReviewId} and api_case_id = #{request.apiCaseId}
)
</insert>
<select id="list" resultType="io.metersphere.api.dto.definition.TestPlanApiCaseDTO">
select
t.id, t.environment_id, t.create_time, t.update_time,
c.id as case_id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id, c.update_user_id, c.num, c.tags,
a.module_id, a.path, a.protocol, t.status execResult
from
test_case_review_api_case t
inner join
api_test_case c
on t.api_case_id = c.id
<if test="request.reviewId != null and request.planId!=''">
and t.test_case_review_id = #{request.reviewId}
</if>
inner join
api_definition a
on
c.api_definition_id = a.id
<if test="request.protocol != null and request.protocol!=''">
and a.protocol = #{request.protocol}
</if>
<choose>
<when test="request.status == 'Trash'">
and a.status = 'Trash'
</when>
<when test="request.status == null">
and a.status != 'Trash'
</when>
<when test="request.status == ''">
and a.status != 'Trash'
</when>
<when test="request.status == 'running'">
and t.status IS NULL
</when>
<otherwise>
and t.status = #{request.status}
</otherwise>
</choose>
where 1
<if test="request.ids != null and request.ids.size() > 0">
<if test="request.projectId != null and request.projectId!=''">
and
</if>
t.id in
<foreach collection="request.ids" item="caseId" separator="," open="(" close=")">
#{caseId}
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and (c.name like CONCAT('%', #{request.name},'%') or c.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
and a.module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</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 == 'priority'">
and c.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key == 'user_id'">
and c.create_user_id 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">
<choose>
<when test="order.name == 'update_time'">
t.${order.name} ${order.type}
</when>
<when test="order.name == 'create_user'">
create_user_id ${order.type}
</when>
<otherwise>
${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="getExecResultByReviewId" resultType="java.lang.String">
select status
from
test_case_review_api_case
where test_case_review_id= #{reviewId}
</select>
<select id="getIdsByReviewId" resultType="java.lang.String">
select id
from test_case_review_api_case
where id = #{reviewId}
</select>
<select id="getNotRelevanceCaseIds" resultType="java.lang.String">
select t.id
from test_case_review_api_case t
inner join api_test_case c
on c.id = t.api_case_id
<if test="relevanceProjectIds != null and relevanceProjectIds.size() > 0">
and c.project_id not in
<foreach collection="relevanceProjectIds" item="projectId" separator="," open="(" close=")">
#{projectId}
</foreach>
</if>
where t.test_case_review_id = #{reviewId}
</select>
<select id="getStatusByTestReviewId" resultType="java.lang.String">
SELECT `status` FROM test_case_review_api_case WHERE test_case_review_id = #{0}
</select>
</mapper>
\ No newline at end of file
package io.metersphere.base.mapper.ext;
import io.metersphere.dto.TestReviewLoadCaseDTO;
import io.metersphere.track.request.testplan.LoadCaseRequest;
import io.metersphere.track.request.testreview.TestReviewRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtTestCaseReviewLoadMapper {
List<String> selectIdsNotInPlan(@Param("projectId") String projectId, @Param("reviewId") String reviewId);
List<TestReviewLoadCaseDTO> selectTestReviewLoadCaseList(@Param("request") TestReviewRequest request);
void updateCaseStatus(@Param("reportId") String reportId, @Param("status") String status);
List<String> getStatusByreviewId(@Param("reviewId") String reviewId);
}
<?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.ext.ExtTestCaseReviewLoadMapper">
<update id="updateCaseStatus">
update test_case_review_load tplc
set status = #{status}
where tplc.load_report_id = #{reportId}
</update>
<select id="selectIdsNotInPlan" resultType="java.lang.String">
select load_test.id
from load_test
where load_test.project_id = #{projectId}
and load_test.id not in (
select tplc.load_case_id from test_case_review_load tplc where tplc.test_case_review_id = #{reviewId}
)
</select>
<select id="selectTestReviewLoadCaseList" resultType="io.metersphere.dto.TestReviewLoadCaseDTO">
select tplc.id,
u.name as userName,
tplc.create_time,
tplc.update_time,
tplc.test_case_review_id,
tplc.load_case_id,
lt.status,
lt.num,
tplc.status as caseStatus,
lt.name as caseName,
tplc.load_report_id,
p.name as projectName
from test_case_review_load tplc
inner join load_test lt on tplc.load_case_id = lt.id
inner join user u on lt.user_id = u.id
inner join project p on lt.project_id = p.id
<where>
tplc.test_case_review_id = #{request.testCaseReviewId}
<if test="request.projectId != null and request.projectId != ''">
and lt.project_id = #{request.projectId}
</if>
<if test="request.name != null">
and (lt.name like CONCAT('%', #{request.name},'%') or lt.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.status != null">
and tplc.status like CONCAT('%', #{request.status},'%')
</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 lt.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
tplc.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="getStatusByreviewId" resultType="java.lang.String">
select status from test_case_review_load tplc where tplc.test_case_review_id = #{reviewId}
</select>
</mapper>
\ No newline at end of file
package io.metersphere.base.mapper.ext;
import io.metersphere.api.dto.automation.ApiScenarioDTO;
import io.metersphere.api.dto.automation.TestPlanScenarioRequest;
import io.metersphere.base.domain.TestCaseReviewScenario;
import io.metersphere.base.domain.TestPlanApiScenario;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtTestCaseReviewScenarioCaseMapper {
void insertIfNotExists(@Param("request") TestCaseReviewScenario request);
List<ApiScenarioDTO> list(@Param("request") TestPlanScenarioRequest request);
List<String> getExecResultByReviewId(String reviewId);
List<String> getIdsByReviewId(String reviewId);
List<String> getNotRelevanceCaseIds(String planId, List<String> relevanceProjectIds);
}
<?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.ext.ExtTestCaseReviewScenarioCaseMapper">
<insert id="insertIfNotExists" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
-- 查询没有数据再插入
INSERT INTO test_case_review_scenario(id, test_case_review_id, api_scenario_id, create_time, update_time, environment)
SELECT #{request.id}, #{request.reviewId}, #{request.apiScenarioId}, #{request.createTime}, #{request.updateTime}, #{request.environment}
FROM DUAL
WHERE NOT EXISTS(
SELECT id FROM
test_case_review_scenario
WHERE test_case_review_id = #{request.reviewId} and api_scenario_id = #{request.apiScenarioId}
)
</insert>
<select id="list" resultType="io.metersphere.api.dto.automation.ApiScenarioDTO">
select
t.id, t.environment, t.create_time, t.update_time, t.last_result, t.pass_rate, t.report_id, c.scenario_definition,
c.id as case_id, c.project_id, c.user_id,c.api_scenario_module_id, c.module_path, c.name, c.level,
c.status, c.principal, c.step_total, c.follow_people, c.schedule, c.description, c.tags, c.num,
p.name as project_name, p.id as project_id, u.name as user_name
from
test_case_review_scenario t
inner join
api_scenario c
on t.api_scenario_id = c.id and c.status != 'Trash'
<if test="request.reviewId != null and request.reviewId!=''">
and t.test_case_review_id = #{request.reviewId}
</if>
left join project p
on c.project_id = p.id
left join user u
on c.user_id = u.id
where 1
<if test="request.ids != null and request.ids.size() > 0">
<if test="request.projectId != null and request.projectId!=''">
and
</if>
t.id in
<foreach collection="request.ids" item="caseId" separator="," open="(" close=")">
#{caseId}
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and (c.name like CONCAT('%', #{request.name},'%')
or c.num like CONCAT('%', #{request.name},'%')
or c.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.status != null and request.status!=''">
and t.last_result like CONCAT('%', #{request.status},'%')
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
and c.api_scenario_module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</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 == 'priority'">
and c.priority 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">
<choose>
<when test="order.name == 'update_time'">
t.${order.name} ${order.type}
</when>
<otherwise>
${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="getExecResultByReviewId" resultType="java.lang.String">
select last_result
from
test_case_review_scenario
where test_case_review_id = #{reviewId}
</select>
<select id="getIdsByReviewId" resultType="java.lang.String">
select id
from test_case_review_scenario
where test_case_review_id = #{reviewId}
</select>
<select id="getNotRelevanceCaseIds" resultType="java.lang.String">
select t.id
from test_case_review_scenario t
inner join api_scenario c
on c.id = t.api_scenario_id
<if test="relevanceProjectIds != null and relevanceProjectIds.size() > 0">
and c.project_id not in
<foreach collection="relevanceProjectIds" item="projectId" separator="," open="(" close=")">
#{projectId}
</foreach>
</if>
where t.test_case_review_id = #{reviewId}
</select>
</mapper>
\ No newline at end of file
......@@ -45,4 +45,6 @@ public interface ExtTestPlanTestCaseMapper {
void deleteByTestCaseID(String id);
List<String> getExecResultByPlanId(String planId);
List<TestPlanCaseDTO> listForMinder(@Param("planId") String planId);
}
......@@ -405,6 +405,23 @@
</where>
</select>
<select id="listForMinder" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select pc.id as id,
pc.executor, pc.status,
pc.update_time,
pc.plan_id as planId,
t.name, t.priority,
t.type, t.node_id,
t.steps, t.prerequisite,
t.remark,
t.node_path, t.method, t.num
from test_plan_test_case pc
inner join test_case t on pc.case_id = t.id
<where>
pc.plan_id = #{planId}
</where>
</select>
<update id="updateTestCaseStates" parameterType="java.lang.String">
update test_plan_test_case
<set>
......
......@@ -97,10 +97,13 @@
</sql>
<select id="list" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select test_case_review_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority,
test_case.type, test_case.node_path, test_case.method, test_case.num, test_case_review_test_case.reviewer,
test_case.review_status, test_case_review_test_case.update_time, test_case_node.name as model,
project.name as projectName, test_case_review_test_case.review_id as reviewId,test_case.test_id as testId
select test_case_review_test_case.id as id, test_case_review_test_case.reviewer,
test_case_review_test_case.update_time, test_case_review_test_case.review_id as reviewId,
test_case.id as caseId, test_case.name, test_case.priority, test_case.test_id as testId,
test_case.type, test_case.node_path, test_case.method, test_case.num, test_case.review_status,
test_case.remark as remark, test_case.steps as steps, test_case.node_id as nodeId,
test_case_node.name as model,
project.name as projectName
from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id
......
package io.metersphere.dto;
import io.metersphere.base.domain.TestCaseReviewLoad;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class TestReviewLoadCaseDTO extends TestCaseReviewLoad {
private String userName;
private String caseName;
private String projectName;
private String caseStatus;
private String num;
}
......@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSON;
import io.metersphere.api.dto.datacount.response.TaskInfoResult;
import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ScheduleMapper;
import io.metersphere.base.mapper.SwaggerUrlProjectMapper;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtScheduleMapper;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.constants.ScheduleType;
......@@ -38,6 +36,10 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = Exception.class)
public class ScheduleService {
@Resource
private TestPlanMapper testPlanMapper;
@Resource
private ApiScenarioMapper apiScenarioMapper;
@Resource
private ScheduleMapper scheduleMapper;
@Resource
......@@ -214,8 +216,8 @@ public class ScheduleService {
}
}
public List<TaskInfoResult> findRunningTaskInfoByProjectID(String projectID) {
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByProjectID(projectID);
public List<TaskInfoResult> findRunningTaskInfoByProjectID(String projectID, List<String> typeFilter) {
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByProjectID(projectID, typeFilter);
return runningTaskInfoList;
}
......@@ -227,13 +229,19 @@ public class ScheduleService {
TriggerKey triggerKey = null;
Class clazz = null;
if("testPlan".equals(request.getScheduleFrom())){
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getResourceId());
schedule.setName(testPlan.getName());
schedule.setProjectId(testPlan.getProjectId());
schedule.setGroup(ScheduleGroup.TEST_PLAN_TEST.name());
schedule.setType(ScheduleType.CRON.name());
jobKey = TestPlanTestJob.getJobKey(request.getResourceId());
triggerKey = TestPlanTestJob.getTriggerKey(request.getResourceId());
clazz = TestPlanTestJob.class;
}else {
}else { // 实际上在场景中添加定时任务并不会执行到这里?
//默认为情景
ApiScenarioWithBLOBs apiScene = apiScenarioMapper.selectByPrimaryKey(request.getResourceId());
schedule.setName(apiScene.getName());
schedule.setProjectId(apiScene.getProjectId());
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());
schedule.setType(ScheduleType.CRON.name());
jobKey = ApiScenarioTestJob.getJobKey(request.getResourceId());
......
......@@ -18,6 +18,7 @@ import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testcase.EditTestCaseRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
import io.metersphere.track.request.testcase.TestCaseMinderEditRequest;
import io.metersphere.track.request.testplan.FileOperationRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.service.TestCaseService;
......@@ -59,6 +60,12 @@ public class TestCaseController {
return testCaseService.listTestCase(request);
}
@GetMapping("/list/detail/{projectId}")
public List<TestCaseWithBLOBs> listDetail(@PathVariable String projectId) {
checkPermissionService.checkProjectOwner(projectId);
return testCaseService.listTestCaseDetail(projectId);
}
/*jenkins项目下所有接口和性能测试用例*/
@GetMapping("/list/method/{projectId}")
public List<TestCaseDTO> listByMethod(@PathVariable String projectId) {
......@@ -195,4 +202,11 @@ public class TestCaseController {
return testCaseService.addTestCase(testCaseWithBLOBs);
}
@PostMapping("/minder/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void minderEdit(@RequestBody TestCaseMinderEditRequest request) {
testCaseService.minderEdit(request);
}
}
......@@ -37,9 +37,9 @@ public class TestCaseIssuesController {
issuesService.closeLocalIssue(id);
}
@GetMapping("/delete/{id}")
public void deleteIssue(@PathVariable String id) {
issuesService.deleteIssue(id);
@PostMapping("/delete")
public void deleteIssue(@RequestBody IssuesRequest request) {
issuesService.deleteIssue(request);
}
@GetMapping("/tapd/user/{caseId}")
......
package io.metersphere.track.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
import io.metersphere.track.request.testreview.TestReviewApiCaseBatchRequest;
import io.metersphere.track.service.TestCaseReviewApiCaseService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/test/case/review/api/case")
public class TestCaseReviewApiCaseController {
@Resource
private TestCaseReviewApiCaseService testCaseReviewApiCaseService;
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<TestPlanApiCaseDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testCaseReviewApiCaseService.list(request));
}
@PostMapping("/relevance/list/{goPage}/{pageSize}")
public Pager<List<ApiTestCaseDTO>> relevanceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
return PageUtils.setPageInfo(page, testCaseReviewApiCaseService.relevanceList(request));
}
@GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public int deleteTestCase(@PathVariable String id) {
return testCaseReviewApiCaseService.delete(id);
}
@PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void deleteApiCaseBath(@RequestBody TestReviewApiCaseBatchRequest request) {
testCaseReviewApiCaseService.deleteApiCaseBath(request);
}
@PostMapping("/batch/update/env")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void batchUpdateEnv(@RequestBody TestPlanApiCaseBatchRequest request) {
testCaseReviewApiCaseService.batchUpdateEnv(request);
}
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册