feat(测试跟踪、接口测试): 接口、场景以及功能用例保留执行记录,方便统计执行次数

接口、场景以及功能用例保留执行记录,方便统计执行次数
This commit is contained in:
song-tianyang 2022-06-29 14:48:38 +08:00 committed by TIanyang
parent c970a77d05
commit 3084e16062
38 changed files with 3442 additions and 166 deletions

View File

@ -146,6 +146,8 @@ public class ApiAutomationService {
private ProjectApplicationService projectApplicationService;
@Resource
private ExtApiTestCaseMapper extApiTestCaseMapper;
@Resource
private ScenarioExecutionInfoService scenarioExecutionInfoService;
private ThreadLocal<Long> currentScenarioOrder = new ThreadLocal<>();
@ -1646,6 +1648,7 @@ public class ApiAutomationService {
}
private void deleteScenarioByIds(List<String> scenarioIds) {
scenarioExecutionInfoService.deleteByScenarioIdList(scenarioIds);
ApiScenarioExample apiScenarioExample = new ApiScenarioExample();
apiScenarioExample.createCriteria().andIdIn(scenarioIds);
apiScenarioMapper.deleteByExample(apiScenarioExample);
@ -2051,6 +2054,10 @@ public class ApiAutomationService {
public void deleteApiScenarioByVersion(String refId, String version) {
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
List<ApiScenario> apiScenarios = apiScenarioMapper.selectByExample(example);
List<String> scenarioIds = apiScenarios.stream().map(ApiScenario::getId).collect(toList());
scenarioExecutionInfoService.deleteByScenarioIdList(scenarioIds);
apiScenarioMapper.deleteByExample(example);
scheduleService.deleteByResourceId(refId, ScheduleGroup.API_SCENARIO_TEST.name());
checkAndSetLatestVersion(refId);

View File

@ -15,6 +15,8 @@ import io.metersphere.dto.RequestResult;
import io.metersphere.dto.ResultDTO;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.ApiCaseExecutionInfoService;
import io.metersphere.service.ApiExecutionInfoService;
import io.metersphere.track.dto.PlanReportCaseDTO;
import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
@ -68,6 +70,10 @@ public class ApiDefinitionExecResultService {
private ProjectMapper projectMapper;
@Resource
private SqlSessionFactory sqlSessionFactory;
@Resource
private ApiExecutionInfoService apiExecutionInfoService;
@Resource
private ApiCaseExecutionInfoService apiCaseExecutionInfoService;
public void saveApiResult(ResultDTO dto) {
@ -80,6 +86,7 @@ public class ApiDefinitionExecResultService {
if (!StringUtils.startsWithAny(item.getName(), "PRE_PROCESSOR_ENV_", "POST_PROCESSOR_ENV_")) {
ApiDefinitionExecResult result = this.editResult(item, dto.getReportId(), dto.getConsole(), dto.getRunMode(), dto.getTestId(), null);
if (result != null) {
apiExecutionInfoService.insertExecutionInfo(result);
User user = null;
if (MapUtils.isNotEmpty(dto.getExtendedParameters())) {
if (dto.getExtendedParameters().containsKey("userId") && dto.getExtendedParameters().containsKey("userName")) {
@ -327,6 +334,7 @@ public class ApiDefinitionExecResultService {
if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
TestPlanApiCase apiCase = testPlanApiCaseMapper.selectByPrimaryKey(dto.getTestId());
if (apiCase != null) {
apiCaseExecutionInfoService.insertExecutionInfo(apiCase.getApiCaseId(), status);
apiCase.setStatus(status);
apiCase.setUpdateTime(System.currentTimeMillis());
testPlanApiCaseMapper.updateByPrimaryKeySelective(apiCase);

View File

@ -144,8 +144,10 @@ public class ApiDefinitionService {
private EsbApiParamsMapper esbApiParamsMapper;
@Resource
private ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
@Resource
private ApiExecutionInfoService apiExecutionInfoService;
@Resource
private ApiCaseExecutionInfoService apiCaseExecutionInfoService;
@Lazy
@Resource
private ApiModuleService apiModuleService;
@ -385,6 +387,7 @@ public class ApiDefinitionService {
deleteFileByTestId(api.getId());
extApiDefinitionExecResultMapper.deleteByResourceId(api.getId());
apiDefinitionMapper.deleteByPrimaryKey(api.getId());
apiExecutionInfoService.deleteByApiId(api.getId());
esbApiParamService.deleteByResourceId(api.getId());
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
mockConfigService.deleteMockConfigByApiId(api.getId());
@ -404,6 +407,7 @@ public class ApiDefinitionService {
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andIdIn(apiIds);
esbApiParamService.deleteByResourceIdIn(apiIds);
apiExecutionInfoService.deleteByApiIdList(apiIds);
apiDefinitionMapper.deleteByExample(example);
apiTestCaseService.deleteBatchByDefinitionId(apiIds);
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
@ -1623,6 +1627,7 @@ public class ApiDefinitionService {
if (CollectionUtils.isEmpty(ids)) {
return;
}
ids.forEach(id -> {
// 把所有版本的api移到回收站
ApiDefinitionWithBLOBs api = apiDefinitionMapper.selectByPrimaryKey(id);
@ -1632,10 +1637,11 @@ public class ApiDefinitionService {
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andRefIdEqualTo(api.getRefId());
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
List<String> apiIds = apiDefinitions.stream().map(ApiDefinition::getId).collect(toList());
//删除ApiApiCase中resourceID被删除了的执行记录
apiExecutionInfoService.deleteByApiIdList(apiIds);
apiCaseExecutionInfoService.deleteByApiDefeinitionIdList(apiIds);
apiTestCaseService.deleteBatchByDefinitionId(apiIds);
//
apiDefinitionMapper.deleteByExample(example);
});
}
@ -2253,13 +2259,15 @@ public class ApiDefinitionService {
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
List<String> ids = apiDefinitions.stream().map(ApiDefinition::getId).collect(toList());
//删除ApiApiCase中resourceID被删除了的执行记录
apiExecutionInfoService.deleteByApiIdList(ids);
apiCaseExecutionInfoService.deleteByApiDefeinitionIdList(ids);
ApiTestCaseExample apiTestCaseExample = new ApiTestCaseExample();
apiTestCaseExample.createCriteria().andApiDefinitionIdIn(ids);
apiTestCaseMapper.deleteByExample(apiTestCaseExample);
//
apiDefinitionMapper.deleteByExample(example);
checkAndSetLatestVersion(refId);
}

View File

@ -26,6 +26,7 @@ import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.api.ModuleReference;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.ScenarioExecutionInfoService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.PlanReportCaseDTO;
@ -88,6 +89,9 @@ public class ApiScenarioReportService {
@Resource
private ExtApiScenarioReportResultMapper extApiScenarioReportResultMapper;
@Resource
private ScenarioExecutionInfoService scenarioExecutionInfoService;
public void saveResult(ResultDTO dto) {
// 报告详情内容
apiScenarioReportResultService.save(dto.getReportId(), dto.getRequestResults());
@ -305,6 +309,9 @@ public class ApiScenarioReportService {
testPlanApiScenario.setUpdateTime(System.currentTimeMillis());
testPlanApiScenarioMapper.updateByPrimaryKeySelective(testPlanApiScenario);
//增加场景的运行记录
scenarioExecutionInfoService.insertExecutionInfo(testPlanApiScenario.getApiScenarioId(), status);
// 更新场景状态
ApiScenario scenario = apiScenarioMapper.selectByPrimaryKey(testPlanApiScenario.getApiScenarioId());
if (scenario != null) {
@ -426,6 +433,8 @@ public class ApiScenarioReportService {
report.setStatus(this.getIntegrationReportStatus(statusList));
// 更新报告
apiScenarioReportMapper.updateByPrimaryKey(report);
//场景集合报告按照集合报告的结果作为场景的最后执行结果
scenarioExecutionInfoService.insertExecutionInfoByScenarioIds(report.getScenarioId(), report.getStatus());
}
}

View File

@ -31,6 +31,7 @@ import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.api.DefinitionReference;
import io.metersphere.plugin.core.MsTestElement;
import io.metersphere.service.ApiCaseExecutionInfoService;
import io.metersphere.service.FileService;
import io.metersphere.service.UserService;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
@ -106,6 +107,8 @@ public class ApiTestCaseService {
private TcpApiParamService tcpApiParamService;
@Resource
private ObjectMapper mapper;
@Resource
private ApiCaseExecutionInfoService apiCaseExecutionInfoService;
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
@ -288,6 +291,7 @@ public class ApiTestCaseService {
extTestPlanTestCaseMapper.deleteByTestCaseID(testId);
deleteFileByTestId(testId);
extApiDefinitionExecResultMapper.deleteByResourceId(testId);
apiCaseExecutionInfoService.deleteByApiCaseId(testId);
apiTestCaseMapper.deleteByPrimaryKey(testId);
esbApiParamService.deleteByResourceId(testId);
deleteBodyFiles(testId);
@ -519,12 +523,14 @@ public class ApiTestCaseService {
extTestPlanTestCaseMapper.deleteByTestCaseID(testId);
deleteFollows(testId);
}
apiCaseExecutionInfoService.deleteByApiCaseIdList(ids);
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andIdIn(ids);
apiTestCaseMapper.deleteByExample(example);
}
public void deleteBatchByDefinitionId(List<String> definitionIds) {
apiCaseExecutionInfoService.deleteByApiDefeinitionIdList(definitionIds);
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andApiDefinitionIdIn(definitionIds);
apiTestCaseMapper.deleteByExample(example);
@ -763,7 +769,7 @@ public class ApiTestCaseService {
}
}
public void updateByApiDefinitionId(List<String> ids, String path, String method, String protocol,Boolean toBeUpdated) {
public void updateByApiDefinitionId(List<String> ids, String path, String method, String protocol, Boolean toBeUpdated) {
if ((StringUtils.isNotEmpty(method) || StringUtils.isNotEmpty(path) && RequestType.HTTP.equals(protocol))) {
ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample();
apiDefinitionExample.createCriteria().andApiDefinitionIdIn(ids);
@ -793,7 +799,7 @@ public class ApiTestCaseService {
}
String requestStr = JSON.toJSONString(req);
apiTestCase.setRequest(requestStr);
if(toBeUpdated!=null){
if (toBeUpdated != null) {
apiTestCase.setToBeUpdated(toBeUpdated);
}
batchMapper.updateByPrimaryKeySelective(apiTestCase);

View File

@ -19,6 +19,7 @@ import io.metersphere.dto.ResultDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.ScenarioExecutionInfoService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.track.request.testcase.TrackCount;
import io.metersphere.track.service.TestPlanApiCaseService;
@ -59,6 +60,8 @@ public class TestResultService {
private ApiEnvironmentRunningParamService apiEnvironmentRunningParamService;
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Resource
private ScenarioExecutionInfoService scenarioExecutionInfoService;
// 场景
private static final List<String> scenarioRunModes = new ArrayList<>() {{
@ -181,6 +184,7 @@ public class TestResultService {
} else {
ApiScenarioWithBLOBs apiScenario = apiScenarioMapper.selectByPrimaryKey(scenarioReport.getScenarioId());
if (apiScenario != null) {
scenarioExecutionInfoService.insertExecutionInfo(scenarioReport.getScenarioId(), scenarioReport.getStatus());
environment = apiScenarioReportService.getEnvironment(apiScenario);
userName = apiAutomationService.getUser(apiScenario.getUserId());
principal = apiAutomationService.getUser(apiScenario.getPrincipal());

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiCaseExecutionInfo implements Serializable {
private String id;
private String sourceId;
private String result;
private Long createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,470 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiCaseExecutionInfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiCaseExecutionInfoExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andSourceIdIsNull() {
addCriterion("source_id is null");
return (Criteria) this;
}
public Criteria andSourceIdIsNotNull() {
addCriterion("source_id is not null");
return (Criteria) this;
}
public Criteria andSourceIdEqualTo(String value) {
addCriterion("source_id =", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotEqualTo(String value) {
addCriterion("source_id <>", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThan(String value) {
addCriterion("source_id >", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThanOrEqualTo(String value) {
addCriterion("source_id >=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThan(String value) {
addCriterion("source_id <", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThanOrEqualTo(String value) {
addCriterion("source_id <=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLike(String value) {
addCriterion("source_id like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotLike(String value) {
addCriterion("source_id not like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdIn(List<String> values) {
addCriterion("source_id in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotIn(List<String> values) {
addCriterion("source_id not in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdBetween(String value1, String value2) {
addCriterion("source_id between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotBetween(String value1, String value2) {
addCriterion("source_id not between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andResultIsNull() {
addCriterion("`result` is null");
return (Criteria) this;
}
public Criteria andResultIsNotNull() {
addCriterion("`result` is not null");
return (Criteria) this;
}
public Criteria andResultEqualTo(String value) {
addCriterion("`result` =", value, "result");
return (Criteria) this;
}
public Criteria andResultNotEqualTo(String value) {
addCriterion("`result` <>", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThan(String value) {
addCriterion("`result` >", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThanOrEqualTo(String value) {
addCriterion("`result` >=", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThan(String value) {
addCriterion("`result` <", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThanOrEqualTo(String value) {
addCriterion("`result` <=", value, "result");
return (Criteria) this;
}
public Criteria andResultLike(String value) {
addCriterion("`result` like", value, "result");
return (Criteria) this;
}
public Criteria andResultNotLike(String value) {
addCriterion("`result` not like", value, "result");
return (Criteria) this;
}
public Criteria andResultIn(List<String> values) {
addCriterion("`result` in", values, "result");
return (Criteria) this;
}
public Criteria andResultNotIn(List<String> values) {
addCriterion("`result` not in", values, "result");
return (Criteria) this;
}
public Criteria andResultBetween(String value1, String value2) {
addCriterion("`result` between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andResultNotBetween(String value1, String value2) {
addCriterion("`result` not between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiExecutionInfo implements Serializable {
private String id;
private String sourceId;
private String result;
private Long createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,470 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiExecutionInfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiExecutionInfoExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andSourceIdIsNull() {
addCriterion("source_id is null");
return (Criteria) this;
}
public Criteria andSourceIdIsNotNull() {
addCriterion("source_id is not null");
return (Criteria) this;
}
public Criteria andSourceIdEqualTo(String value) {
addCriterion("source_id =", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotEqualTo(String value) {
addCriterion("source_id <>", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThan(String value) {
addCriterion("source_id >", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThanOrEqualTo(String value) {
addCriterion("source_id >=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThan(String value) {
addCriterion("source_id <", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThanOrEqualTo(String value) {
addCriterion("source_id <=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLike(String value) {
addCriterion("source_id like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotLike(String value) {
addCriterion("source_id not like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdIn(List<String> values) {
addCriterion("source_id in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotIn(List<String> values) {
addCriterion("source_id not in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdBetween(String value1, String value2) {
addCriterion("source_id between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotBetween(String value1, String value2) {
addCriterion("source_id not between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andResultIsNull() {
addCriterion("`result` is null");
return (Criteria) this;
}
public Criteria andResultIsNotNull() {
addCriterion("`result` is not null");
return (Criteria) this;
}
public Criteria andResultEqualTo(String value) {
addCriterion("`result` =", value, "result");
return (Criteria) this;
}
public Criteria andResultNotEqualTo(String value) {
addCriterion("`result` <>", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThan(String value) {
addCriterion("`result` >", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThanOrEqualTo(String value) {
addCriterion("`result` >=", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThan(String value) {
addCriterion("`result` <", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThanOrEqualTo(String value) {
addCriterion("`result` <=", value, "result");
return (Criteria) this;
}
public Criteria andResultLike(String value) {
addCriterion("`result` like", value, "result");
return (Criteria) this;
}
public Criteria andResultNotLike(String value) {
addCriterion("`result` not like", value, "result");
return (Criteria) this;
}
public Criteria andResultIn(List<String> values) {
addCriterion("`result` in", values, "result");
return (Criteria) this;
}
public Criteria andResultNotIn(List<String> values) {
addCriterion("`result` not in", values, "result");
return (Criteria) this;
}
public Criteria andResultBetween(String value1, String value2) {
addCriterion("`result` between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andResultNotBetween(String value1, String value2) {
addCriterion("`result` not between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class FunctionCaseExecutionInfo implements Serializable {
private String id;
private String sourceId;
private String result;
private Long createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,470 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class FunctionCaseExecutionInfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public FunctionCaseExecutionInfoExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andSourceIdIsNull() {
addCriterion("source_id is null");
return (Criteria) this;
}
public Criteria andSourceIdIsNotNull() {
addCriterion("source_id is not null");
return (Criteria) this;
}
public Criteria andSourceIdEqualTo(String value) {
addCriterion("source_id =", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotEqualTo(String value) {
addCriterion("source_id <>", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThan(String value) {
addCriterion("source_id >", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThanOrEqualTo(String value) {
addCriterion("source_id >=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThan(String value) {
addCriterion("source_id <", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThanOrEqualTo(String value) {
addCriterion("source_id <=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLike(String value) {
addCriterion("source_id like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotLike(String value) {
addCriterion("source_id not like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdIn(List<String> values) {
addCriterion("source_id in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotIn(List<String> values) {
addCriterion("source_id not in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdBetween(String value1, String value2) {
addCriterion("source_id between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotBetween(String value1, String value2) {
addCriterion("source_id not between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andResultIsNull() {
addCriterion("`result` is null");
return (Criteria) this;
}
public Criteria andResultIsNotNull() {
addCriterion("`result` is not null");
return (Criteria) this;
}
public Criteria andResultEqualTo(String value) {
addCriterion("`result` =", value, "result");
return (Criteria) this;
}
public Criteria andResultNotEqualTo(String value) {
addCriterion("`result` <>", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThan(String value) {
addCriterion("`result` >", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThanOrEqualTo(String value) {
addCriterion("`result` >=", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThan(String value) {
addCriterion("`result` <", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThanOrEqualTo(String value) {
addCriterion("`result` <=", value, "result");
return (Criteria) this;
}
public Criteria andResultLike(String value) {
addCriterion("`result` like", value, "result");
return (Criteria) this;
}
public Criteria andResultNotLike(String value) {
addCriterion("`result` not like", value, "result");
return (Criteria) this;
}
public Criteria andResultIn(List<String> values) {
addCriterion("`result` in", values, "result");
return (Criteria) this;
}
public Criteria andResultNotIn(List<String> values) {
addCriterion("`result` not in", values, "result");
return (Criteria) this;
}
public Criteria andResultBetween(String value1, String value2) {
addCriterion("`result` between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andResultNotBetween(String value1, String value2) {
addCriterion("`result` not between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ScenarioExecutionInfo implements Serializable {
private String id;
private String sourceId;
private String result;
private Long createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,470 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ScenarioExecutionInfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ScenarioExecutionInfoExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andSourceIdIsNull() {
addCriterion("source_id is null");
return (Criteria) this;
}
public Criteria andSourceIdIsNotNull() {
addCriterion("source_id is not null");
return (Criteria) this;
}
public Criteria andSourceIdEqualTo(String value) {
addCriterion("source_id =", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotEqualTo(String value) {
addCriterion("source_id <>", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThan(String value) {
addCriterion("source_id >", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThanOrEqualTo(String value) {
addCriterion("source_id >=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThan(String value) {
addCriterion("source_id <", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThanOrEqualTo(String value) {
addCriterion("source_id <=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLike(String value) {
addCriterion("source_id like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotLike(String value) {
addCriterion("source_id not like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdIn(List<String> values) {
addCriterion("source_id in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotIn(List<String> values) {
addCriterion("source_id not in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdBetween(String value1, String value2) {
addCriterion("source_id between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotBetween(String value1, String value2) {
addCriterion("source_id not between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andResultIsNull() {
addCriterion("`result` is null");
return (Criteria) this;
}
public Criteria andResultIsNotNull() {
addCriterion("`result` is not null");
return (Criteria) this;
}
public Criteria andResultEqualTo(String value) {
addCriterion("`result` =", value, "result");
return (Criteria) this;
}
public Criteria andResultNotEqualTo(String value) {
addCriterion("`result` <>", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThan(String value) {
addCriterion("`result` >", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThanOrEqualTo(String value) {
addCriterion("`result` >=", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThan(String value) {
addCriterion("`result` <", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThanOrEqualTo(String value) {
addCriterion("`result` <=", value, "result");
return (Criteria) this;
}
public Criteria andResultLike(String value) {
addCriterion("`result` like", value, "result");
return (Criteria) this;
}
public Criteria andResultNotLike(String value) {
addCriterion("`result` not like", value, "result");
return (Criteria) this;
}
public Criteria andResultIn(List<String> values) {
addCriterion("`result` in", values, "result");
return (Criteria) this;
}
public Criteria andResultNotIn(List<String> values) {
addCriterion("`result` not in", values, "result");
return (Criteria) this;
}
public Criteria andResultBetween(String value1, String value2) {
addCriterion("`result` between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andResultNotBetween(String value1, String value2) {
addCriterion("`result` not between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiCaseExecutionInfo;
import io.metersphere.base.domain.ApiCaseExecutionInfoExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiCaseExecutionInfoMapper {
long countByExample(ApiCaseExecutionInfoExample example);
int deleteByExample(ApiCaseExecutionInfoExample example);
int deleteByPrimaryKey(String id);
int insert(ApiCaseExecutionInfo record);
int insertSelective(ApiCaseExecutionInfo record);
List<ApiCaseExecutionInfo> selectByExample(ApiCaseExecutionInfoExample example);
ApiCaseExecutionInfo selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiCaseExecutionInfo record, @Param("example") ApiCaseExecutionInfoExample example);
int updateByExample(@Param("record") ApiCaseExecutionInfo record, @Param("example") ApiCaseExecutionInfoExample example);
int updateByPrimaryKeySelective(ApiCaseExecutionInfo record);
int updateByPrimaryKey(ApiCaseExecutionInfo record);
}

View File

@ -0,0 +1,196 @@
<?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.ApiCaseExecutionInfoMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiCaseExecutionInfo">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
<result column="result" jdbcType="VARCHAR" property="result" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
</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, source_id, `result`, create_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiCaseExecutionInfoExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_case_execution_info
<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 api_case_execution_info
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_case_execution_info
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiCaseExecutionInfoExample">
delete from api_case_execution_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiCaseExecutionInfo">
insert into api_case_execution_info (id, source_id, `result`,
create_time)
values (#{id,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiCaseExecutionInfo">
insert into api_case_execution_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="sourceId != null">
source_id,
</if>
<if test="result != null">
`result`,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
#{sourceId,jdbcType=VARCHAR},
</if>
<if test="result != null">
#{result,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiCaseExecutionInfoExample" resultType="java.lang.Long">
select count(*) from api_case_execution_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_case_execution_info
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.sourceId != null">
source_id = #{record.sourceId,jdbcType=VARCHAR},
</if>
<if test="record.result != null">
`result` = #{record.result,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_case_execution_info
set id = #{record.id,jdbcType=VARCHAR},
source_id = #{record.sourceId,jdbcType=VARCHAR},
`result` = #{record.result,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiCaseExecutionInfo">
update api_case_execution_info
<set>
<if test="sourceId != null">
source_id = #{sourceId,jdbcType=VARCHAR},
</if>
<if test="result != null">
`result` = #{result,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiCaseExecutionInfo">
update api_case_execution_info
set source_id = #{sourceId,jdbcType=VARCHAR},
`result` = #{result,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiExecutionInfo;
import io.metersphere.base.domain.ApiExecutionInfoExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiExecutionInfoMapper {
long countByExample(ApiExecutionInfoExample example);
int deleteByExample(ApiExecutionInfoExample example);
int deleteByPrimaryKey(String id);
int insert(ApiExecutionInfo record);
int insertSelective(ApiExecutionInfo record);
List<ApiExecutionInfo> selectByExample(ApiExecutionInfoExample example);
ApiExecutionInfo selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiExecutionInfo record, @Param("example") ApiExecutionInfoExample example);
int updateByExample(@Param("record") ApiExecutionInfo record, @Param("example") ApiExecutionInfoExample example);
int updateByPrimaryKeySelective(ApiExecutionInfo record);
int updateByPrimaryKey(ApiExecutionInfo record);
}

View File

@ -0,0 +1,196 @@
<?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.ApiExecutionInfoMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiExecutionInfo">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
<result column="result" jdbcType="VARCHAR" property="result" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
</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, source_id, `result`, create_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiExecutionInfoExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_execution_info
<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 api_execution_info
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_execution_info
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiExecutionInfoExample">
delete from api_execution_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiExecutionInfo">
insert into api_execution_info (id, source_id, `result`,
create_time)
values (#{id,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiExecutionInfo">
insert into api_execution_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="sourceId != null">
source_id,
</if>
<if test="result != null">
`result`,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
#{sourceId,jdbcType=VARCHAR},
</if>
<if test="result != null">
#{result,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiExecutionInfoExample" resultType="java.lang.Long">
select count(*) from api_execution_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_execution_info
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.sourceId != null">
source_id = #{record.sourceId,jdbcType=VARCHAR},
</if>
<if test="record.result != null">
`result` = #{record.result,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_execution_info
set id = #{record.id,jdbcType=VARCHAR},
source_id = #{record.sourceId,jdbcType=VARCHAR},
`result` = #{record.result,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiExecutionInfo">
update api_execution_info
<set>
<if test="sourceId != null">
source_id = #{sourceId,jdbcType=VARCHAR},
</if>
<if test="result != null">
`result` = #{result,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiExecutionInfo">
update api_execution_info
set source_id = #{sourceId,jdbcType=VARCHAR},
`result` = #{result,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.FunctionCaseExecutionInfo;
import io.metersphere.base.domain.FunctionCaseExecutionInfoExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface FunctionCaseExecutionInfoMapper {
long countByExample(FunctionCaseExecutionInfoExample example);
int deleteByExample(FunctionCaseExecutionInfoExample example);
int deleteByPrimaryKey(String id);
int insert(FunctionCaseExecutionInfo record);
int insertSelective(FunctionCaseExecutionInfo record);
List<FunctionCaseExecutionInfo> selectByExample(FunctionCaseExecutionInfoExample example);
FunctionCaseExecutionInfo selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") FunctionCaseExecutionInfo record, @Param("example") FunctionCaseExecutionInfoExample example);
int updateByExample(@Param("record") FunctionCaseExecutionInfo record, @Param("example") FunctionCaseExecutionInfoExample example);
int updateByPrimaryKeySelective(FunctionCaseExecutionInfo record);
int updateByPrimaryKey(FunctionCaseExecutionInfo record);
}

View File

@ -0,0 +1,196 @@
<?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.FunctionCaseExecutionInfoMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.FunctionCaseExecutionInfo">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
<result column="result" jdbcType="VARCHAR" property="result" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
</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, source_id, `result`, create_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.FunctionCaseExecutionInfoExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from function_case_execution_info
<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 function_case_execution_info
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from function_case_execution_info
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.FunctionCaseExecutionInfoExample">
delete from function_case_execution_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.FunctionCaseExecutionInfo">
insert into function_case_execution_info (id, source_id, `result`,
create_time)
values (#{id,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.FunctionCaseExecutionInfo">
insert into function_case_execution_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="sourceId != null">
source_id,
</if>
<if test="result != null">
`result`,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
#{sourceId,jdbcType=VARCHAR},
</if>
<if test="result != null">
#{result,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.FunctionCaseExecutionInfoExample" resultType="java.lang.Long">
select count(*) from function_case_execution_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update function_case_execution_info
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.sourceId != null">
source_id = #{record.sourceId,jdbcType=VARCHAR},
</if>
<if test="record.result != null">
`result` = #{record.result,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update function_case_execution_info
set id = #{record.id,jdbcType=VARCHAR},
source_id = #{record.sourceId,jdbcType=VARCHAR},
`result` = #{record.result,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.FunctionCaseExecutionInfo">
update function_case_execution_info
<set>
<if test="sourceId != null">
source_id = #{sourceId,jdbcType=VARCHAR},
</if>
<if test="result != null">
`result` = #{result,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.FunctionCaseExecutionInfo">
update function_case_execution_info
set source_id = #{sourceId,jdbcType=VARCHAR},
`result` = #{result,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ScenarioExecutionInfo;
import io.metersphere.base.domain.ScenarioExecutionInfoExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ScenarioExecutionInfoMapper {
long countByExample(ScenarioExecutionInfoExample example);
int deleteByExample(ScenarioExecutionInfoExample example);
int deleteByPrimaryKey(String id);
int insert(ScenarioExecutionInfo record);
int insertSelective(ScenarioExecutionInfo record);
List<ScenarioExecutionInfo> selectByExample(ScenarioExecutionInfoExample example);
ScenarioExecutionInfo selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ScenarioExecutionInfo record, @Param("example") ScenarioExecutionInfoExample example);
int updateByExample(@Param("record") ScenarioExecutionInfo record, @Param("example") ScenarioExecutionInfoExample example);
int updateByPrimaryKeySelective(ScenarioExecutionInfo record);
int updateByPrimaryKey(ScenarioExecutionInfo record);
}

View File

@ -0,0 +1,196 @@
<?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.ScenarioExecutionInfoMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ScenarioExecutionInfo">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
<result column="result" jdbcType="VARCHAR" property="result" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
</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, source_id, `result`, create_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ScenarioExecutionInfoExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from scenario_execution_info
<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 scenario_execution_info
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from scenario_execution_info
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ScenarioExecutionInfoExample">
delete from scenario_execution_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ScenarioExecutionInfo">
insert into scenario_execution_info (id, source_id, `result`,
create_time)
values (#{id,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ScenarioExecutionInfo">
insert into scenario_execution_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="sourceId != null">
source_id,
</if>
<if test="result != null">
`result`,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
#{sourceId,jdbcType=VARCHAR},
</if>
<if test="result != null">
#{result,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ScenarioExecutionInfoExample" resultType="java.lang.Long">
select count(*) from scenario_execution_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update scenario_execution_info
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.sourceId != null">
source_id = #{record.sourceId,jdbcType=VARCHAR},
</if>
<if test="record.result != null">
`result` = #{record.result,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update scenario_execution_info
set id = #{record.id,jdbcType=VARCHAR},
source_id = #{record.sourceId,jdbcType=VARCHAR},
`result` = #{record.result,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ScenarioExecutionInfo">
update scenario_execution_info
<set>
<if test="sourceId != null">
source_id = #{sourceId,jdbcType=VARCHAR},
</if>
<if test="result != null">
`result` = #{result,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ScenarioExecutionInfo">
update scenario_execution_info
set source_id = #{sourceId,jdbcType=VARCHAR},
`result` = #{result,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -48,4 +48,6 @@ public interface ExtApiDefinitionExecResultMapper {
List<ApiDefinitionExecResult> findByProjectIds(@Param("request") TaskCenterRequest request);
List<String> selectDistinctStatusByReportId(String reportId);
String selectResourceId(String id);
}

View File

@ -3,97 +3,132 @@
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper">
<delete id="deleteByResourceId" parameterType="java.lang.String">
delete
from api_definition_exec_result where resource_id = #{id,jdbcType=VARCHAR}
from api_definition_exec_result
where resource_id = #{id,jdbcType=VARCHAR}
</delete>
<select id="selectMaxResultByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs">
select * from api_definition_exec_result
where resource_id = #{resourceId,jdbcType=VARCHAR} ORDER BY create_time DESC LIMIT 1
<select id="selectMaxResultByResourceId" parameterType="java.lang.String"
resultType="io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs">
select *
from api_definition_exec_result
where resource_id = #{resourceId,jdbcType=VARCHAR}
ORDER BY create_time DESC LIMIT 1
</select>
<select id="selectMaxResultByResourceIdAndType"
resultType="io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs">
select * from api_definition_exec_result
where resource_id = #{resourceId,jdbcType=VARCHAR} and `type` = #{type, jdbcType=VARCHAR}
select *
from api_definition_exec_result
where resource_id = #{resourceId,jdbcType=VARCHAR}
and `type` = #{type, jdbcType=VARCHAR}
ORDER BY start_time DESC LIMIT 5, 1
</select>
<select id="countByProjectIDAndCreateInThisWeek" resultType="java.lang.Long">
SELECT count(id) AS countNumber FROM api_definition_exec_result
WHERE resource_id IN (
SELECT testCase.id FROM api_test_case testCase
WHERE testCase.project_id = #{projectId})
and start_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
SELECT count(id) AS countNumber
FROM api_definition_exec_result
WHERE resource_id IN (SELECT testCase.id
FROM api_test_case testCase
WHERE testCase.project_id = #{projectId})
and start_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
</select>
<select id="countByTestCaseIDInProject" resultType="java.lang.Long">
SELECT count(id) AS countNumber FROM api_definition_exec_result
WHERE resource_id IN (
SELECT testCase.id FROM api_test_case testCase
WHERE testCase.project_id = #{projectId})
SELECT count(id) AS countNumber
FROM api_definition_exec_result
WHERE resource_id IN (SELECT testCase.id
FROM api_test_case testCase
WHERE testCase.project_id = #{projectId})
</select>
<select id="selectDistinctStatusByReportId" resultType="java.lang.String">
SELECT DISTINCT status FROM api_definition_exec_result WHERE integrated_report_id = #{0}
SELECT DISTINCT status
FROM api_definition_exec_result
WHERE integrated_report_id = #{0}
</select>
<select id="findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber" resultType="io.metersphere.api.dto.datacount.ExecutedCaseInfoResult">
SELECT * FROM (
-- api_test_case 只查找测试计划执行的结果
SELECT testCase.testCaseID AS testCaseID,testCase.id AS id,testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes,'apiCase' AS caseType
FROM (
SELECT testPlanCase.id AS testPlanCaseID, testPlanCase.api_case_id as testCaseID, apiCase.id AS id,apiCase.`name` AS testCaseName,testPlan.`name` AS testPlanName, testPlanCase.update_time as updateTime
FROM api_test_case apiCase
inner join api_definition on api_definition.id = apiCase.api_definition_id
INNER JOIN test_plan_api_case testPlanCase ON testPlanCase.api_case_id = apiCase.id
INNER JOIN test_plan testPlan ON testPlan.id = testPlanCase.test_plan_id
and api_definition.status != 'Trash'
ORDER BY apiCase.create_time DESC
)testCase
INNER JOIN (
SELECT resource_id AS testPlanCaseID,COUNT(id) AS dataCountNumber,start_time AS executeTime FROM api_definition_exec_result
WHERE resource_id IN (
SELECT t2.id FROM api_test_case t1
INNER JOIN test_plan_api_case t2 ON t1.id = t2.api_case_id
WHERE t1.project_id = #{projectId}
) and `status` = 'error' GROUP BY resource_id
) caseErrorCountData ON caseErrorCountData.testPlanCaseID =testCase.testPlanCaseID
WHERE testCase.updateTime >= #{startTimestamp}
UNION
SELECT scene.id AS testCaseID,scene.id AS id,scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType
FROM api_scenario_report report
INNER JOIN api_scenario scene ON report.scenario_id = scene.id
INNER JOIN(
SELECT apiScene.api_scenario_id, group_concat(testPlan.`name`) AS testPlanName
FROM test_plan_api_scenario apiScene
INNER JOIN test_plan testPlan ON testPlan.id = apiScene.test_plan_id
GROUP BY apiScene.api_scenario_id
)apiScene ON apiScene.api_scenario_id = scene.id
WHERE report.project_id = #{projectId}
AND scene.`status` != 'Trash'
<select id="findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber"
resultType="io.metersphere.api.dto.datacount.ExecutedCaseInfoResult">
SELECT *
FROM (
-- api_test_case 只查找测试计划执行的结果
SELECT testCase.testCaseID AS testCaseID,
testCase.id AS id,
testCase.testCaseName AS caseName,
testCase.testPlanName AS testPlan,
caseErrorCountData.dataCountNumber AS failureTimes,
'apiCase' AS caseType
FROM (SELECT testPlanCase.id AS testPlanCaseID,
testPlanCase.api_case_id as testCaseID,
apiCase.id AS id,
apiCase.`name` AS testCaseName,
testPlan.`name` AS testPlanName,
testPlanCase.update_time as updateTime
FROM api_test_case apiCase
inner join api_definition on api_definition.id = apiCase.api_definition_id
INNER JOIN test_plan_api_case testPlanCase ON testPlanCase.api_case_id = apiCase.id
INNER JOIN test_plan testPlan ON testPlan.id = testPlanCase.test_plan_id
and api_definition.status != 'Trash'
ORDER BY apiCase.create_time DESC) testCase
INNER JOIN (SELECT resource_id AS testPlanCaseID,
COUNT(id) AS dataCountNumber,
start_time AS executeTime
FROM api_definition_exec_result
WHERE resource_id IN (SELECT t2.id
FROM api_test_case t1
INNER JOIN test_plan_api_case t2 ON t1.id = t2.api_case_id
WHERE t1.project_id = #{projectId})
and `status` = 'error'
GROUP BY resource_id) caseErrorCountData
ON caseErrorCountData.testPlanCaseID = testCase.testPlanCaseID
WHERE testCase.updateTime >= #{startTimestamp}
UNION
SELECT ltr.test_id as testCaseID,
ltr.id AS id,
ltr.name as caseName,
tplt.testPlanName AS testPlan,
count(ltr.id) as failureTimes,
'load' as caseType
FROM load_test_report ltr
join load_test on load_test.id = ltr.test_id
JOIN (select tplc.load_case_id, group_concat(tp.`name`) AS testPlanName, tp.project_id
from test_plan_load_case tplc
join test_plan tp on tp.id = tplc.test_plan_id
GROUP BY tplc.load_case_id) tplt on tplt.load_case_id = ltr.test_id
WHERE load_test.project_id = #{projectId}
AND ltr.STATUS = 'Error'
and ltr.trigger_mode = 'TEST_PLAN_SCHEDULE'
AND ltr.create_time >= #{startTimestamp}
GROUP BY load_test.id
UNION
SELECT scene.id AS testCaseID,
scene.id AS id,
scene.`name` AS caseName,
apiScene.testPlanName AS testPlan,
count(report.id) AS failureTimes,
'scenario' AS caseType
FROM api_scenario_report report
INNER JOIN api_scenario scene ON report.scenario_id = scene.id
INNER JOIN(SELECT apiScene.api_scenario_id, group_concat(testPlan.`name`) AS testPlanName
FROM test_plan_api_scenario apiScene
INNER JOIN test_plan testPlan ON testPlan.id = apiScene.test_plan_id
GROUP BY apiScene.api_scenario_id) apiScene ON apiScene.api_scenario_id = scene.id
WHERE report.project_id = #{projectId}
AND scene.`status` != 'Trash'
AND ( report.STATUS = 'Error' OR report.STATUS = 'Fail' ) AND report.create_time >= #{startTimestamp}
GROUP BY scene.id
UNION
SELECT ltr.test_id as testCaseID,ltr.id AS id, ltr.name as caseName,tplt.testPlanName AS testPlan, count(ltr.id) as failureTimes, 'load' as caseType FROM load_test_report ltr
join load_test on load_test.id = ltr.test_id
JOIN (
select tplc.load_case_id, group_concat(tp.`name`) AS testPlanName, tp.project_id
from test_plan_load_case tplc
join test_plan tp on tp.id = tplc.test_plan_id
GROUP BY tplc.load_case_id
) tplt on tplt.load_case_id = ltr.test_id
WHERE load_test.project_id = #{projectId}
AND ltr.STATUS = 'Error' and ltr.trigger_mode = 'TEST_PLAN_SCHEDULE' AND ltr.create_time >= #{startTimestamp}
GROUP BY load_test.id
) showTable
GROUP BY scene.id) showTable
ORDER BY showTable.failureTimes DESC
</select>
<select id="selectExecResult" resultType="java.lang.String">
select ader.status from api_definition_exec_result ader where ader.resource_id=#{resourceId}
</select>
select ader.status
from api_definition_exec_result ader
where ader.resource_id = #{resourceId}
</select>
<select id="selectPlanApiMaxResultByTestIdAndType"
resultType="io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs">
select * from api_definition_exec_result
where resource_id = #{resourceId,jdbcType=VARCHAR} and `type` = #{type, jdbcType=VARCHAR}
select *
from api_definition_exec_result
where resource_id = #{resourceId,jdbcType=VARCHAR}
and `type` = #{type, jdbcType=VARCHAR}
ORDER BY start_time DESC LIMIT 1
</select>
@ -284,10 +319,17 @@
</foreach>
</update>
<select id="findByProjectIds" resultType="io.metersphere.base.domain.ApiDefinitionExecResult" parameterType="java.lang.String">
select actuator ,id from api_definition_exec_result where status in ("running","starting","waiting") and project_id in
<select id="findByProjectIds" resultType="io.metersphere.base.domain.ApiDefinitionExecResult"
parameterType="java.lang.String">
select actuator ,id from api_definition_exec_result where status in ("running","starting","waiting") and
project_id in
<foreach collection="request.projects" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</select>
<select id="selectResourceId" resultType="java.lang.String">
SELECT resource_id
FROM api_definition_exec_result
WHERE id = #{0}
</select>
</mapper>

View File

@ -98,4 +98,5 @@ public interface ExtApiDefinitionMapper {
List<ApiDefinitionWithBLOBs> selectRepeatByBLOBsSameUrl(@Param("blobs") List<ApiDefinitionWithBLOBs> blobs, @Param("projectId") String projectId, @Param("moduleId") String moduleId, @Param("versionId") String versionId);
int countById(String id);
}

View File

@ -394,9 +394,11 @@
SELECT count(api.id) AS countNumber,
if(test_case_api.api_definition_id is null, "uncoverage", "coverage") AS groupField
FROM api_definition api
left Join (
SELECT DISTINCT api_definition_id FROM api_test_case WHERE status is null or status != 'Trash'
) test_case_api ON api.id = test_case_api.api_definition_id
left Join (SELECT DISTINCT api_definition_id
FROM api_test_case
WHERE status is null
or status != 'Trash') test_case_api
ON api.id = test_case_api.api_definition_id
WHERE api.project_id = #{0}
and api.`status` != 'Trash' and api.latest = 1
GROUP BY groupField
@ -913,7 +915,11 @@
</foreach>
and api_definition.status != 'Trash';
</select>
<select id="countById" resultType="java.lang.Integer">
select count(id)
from api_definition
where id = #{0}
</select>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample"
resultType="java.lang.Long">
select count(DISTINCT ref_id) from api_definition
@ -992,12 +998,10 @@
<select id="selectRefIdsForVersionChange" resultType="java.lang.String">
SELECT DISTINCT ref_id
FROM api_definition
WHERE ref_id NOT IN (
SELECT DISTINCT ref_id
FROM api_definition
WHERE version_id = #{versionId}
AND project_id = #{projectId}
)
WHERE ref_id NOT IN (SELECT DISTINCT ref_id
FROM api_definition
WHERE version_id = #{versionId}
AND project_id = #{projectId})
AND project_id = #{projectId}
</select>

View File

@ -77,5 +77,7 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCase> checkName(@Param("request") SaveApiTestCaseRequest request);
int toBeUpdateCase(@Param("ids") List<String> ids,@Param("toBeUpdate") Boolean toBeUpdate);
int toBeUpdateCase(@Param("ids") List<String> ids, @Param("toBeUpdate") Boolean toBeUpdate);
int countById(String resourceID);
}

View File

@ -77,11 +77,12 @@
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, name,api_definition_id,priority,description, create_user_id, update_user_id, create_time, update_time
</sql>
id
, project_id, name,api_definition_id,priority,description, create_user_id, update_user_id, create_time, update_time
</sql>
<sql id="Blob_Column_List">
request
</sql>
request
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestCaseExample"
resultMap="ResultMapWithBLOBs">
select
@ -282,14 +283,15 @@
</sql>
<select id="selectApiCaseInfoByPrimaryKey" resultType="io.metersphere.api.dto.definition.ApiTestCaseInfo">
SELECT
t1.*,
a.method AS apiMethod, project_version.name as version_name, project.version_enable
FROM
api_test_case t1
inner join api_definition a on t1.api_definition_id = a.id
LEFT JOIN project_version on a.project_id = project_version.project_id AND project_version.id = t1.version_id
LEFT JOIN project on a.project_id = project.id
SELECT t1.*,
a.method AS apiMethod,
project_version.name as version_name,
project.version_enable
FROM api_test_case t1
inner join api_definition a on t1.api_definition_id = a.id
LEFT JOIN project_version
on a.project_id = project_version.project_id AND project_version.id = t1.version_id
LEFT JOIN project on a.project_id = project.id
WHERE t1.id = #{0}
</select>
@ -320,25 +322,25 @@
<select id="findPassRateByIds" resultType="io.metersphere.api.dto.definition.ParamsDTO">
SELECT
t2.resource_id as id,
CONCAT(
FORMAT(
SUM(
IF
( t2.`status` = 'success', 1, 0 ))/ COUNT( t2.id )* 100,
2
),
'%'
) value
t2.resource_id as id,
CONCAT(
FORMAT(
SUM(
IF
( t2.`status` = 'success', 1, 0 ))/ COUNT( t2.id )* 100,
2
),
'%'
) value
FROM
api_definition_exec_result t2
api_definition_exec_result t2
WHERE
t2.resource_id IN
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
t2.resource_id IN
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
GROUP BY
t2.resource_id
t2.resource_id
</select>
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
@ -460,7 +462,7 @@
<if test="key=='status' and values.size == 0">
and (t1.status is null or t1.status != 'Trash')
</if>
</if>
</if>
</foreach>
</if>
<if test="request.filters == null || request.filters.size() == 0 ">
@ -555,39 +557,43 @@
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_plan_api_case pc
where pc.test_plan_id = #{planId}
)
and c.id not in (select pc.api_case_id
from test_plan_api_case pc
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}
)
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
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
WHERE testCase.project_id = #{0} AND (testCase.status IS NULL or testCase.status != "Trash") and latest = 1
SELECT apiDef.protocol AS groupField, COUNT(testCase.id) AS countNumber
FROM api_test_case testCase
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
WHERE testCase.project_id = #{0}
AND (testCase.status IS NULL or testCase.status != "Trash")
and latest = 1
GROUP BY apiDef.protocol
</select>
<select id="findApiUrlAndMethodById" resultType="io.metersphere.base.domain.ApiDefinition">
SELECT method,path FROM api_definition WHERE id IN (
SELECT api_definition_id FROM api_test_case WHERE id = #{0}
)
SELECT method, path
FROM api_definition
WHERE id IN (SELECT api_definition_id
FROM api_test_case
WHERE id = #{0})
</select>
<select id="countByProjectIDAndCreateInThisWeek" resultType="java.lang.Long">
SELECT count(testCase.id) AS countNumber FROM api_test_case testCase
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
SELECT count(testCase.id) AS countNumber
FROM api_test_case testCase
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
WHERE testCase.project_id = #{projectId}AND apiDef.status != "Trash"
AND testCase.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
AND testCase.create_time BETWEEN #{firstDayTimestamp}
AND #{lastDayTimestamp}
and latest = 1
</select>
@ -633,11 +639,12 @@
SELECT *
FROM api_test_case
WHERE api_test_case.api_definition_id = #{definitionId}
ORDER BY num DESC
LIMIT 1;
ORDER BY num DESC LIMIT 1;
</select>
<select id="selectEffectiveTestCaseByProjectId" resultType="io.metersphere.base.domain.ApiTestCase">
select id,api_definition_id from api_test_case where project_id = #{projectId}
select id, api_definition_id
from api_test_case
where project_id = #{projectId}
</select>
<select id="getCannotReductionApiCaseList" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
@ -667,7 +674,8 @@
</select>
<select id="selectNameById" resultType="java.lang.String">
SELECT testCase.name FROM api_test_case testCase
SELECT testCase.name
FROM api_test_case testCase
WHERE testCase.id = #{0}
</select>
@ -760,10 +768,14 @@
<include refid="queryWhereCondition"/>
</select>
<select id="selectProjectIds" resultType="java.lang.String">
select DISTINCT project_id from api_test_case;
select DISTINCT project_id
from api_test_case;
</select>
<select id="getIdsOrderByUpdateTime" resultType="java.lang.String">
select id from api_test_case where project_id = #{projectId} order by update_time ASC;
select id
from api_test_case
where project_id = #{projectId}
order by update_time ASC;
</select>
<select id="getPreOrder" resultType="java.lang.Long">
select `order` from api_test_case where project_id = #{projectId}
@ -846,13 +858,40 @@
</sql>
<insert id="insertNewVersionCases">
INSERT INTO api_test_case(id, project_id, name, priority, api_definition_id, description, request, create_user_id,
update_user_id, create_time, update_time, num, tags, last_result_id, status, original_status,
delete_time, delete_user_id, version, `order`, case_status, version_id)
SELECT UUID(), project_id, name, priority, #{api.id}, description, request, #{api.createUser}, update_user_id,
create_time, update_time, num, tags, last_result_id, status, original_status, delete_time, delete_user_id,
version, `order`, case_status, #{api.versionId}
INSERT INTO api_test_case(id, project_id, name, priority, api_definition_id, description, request,
create_user_id,
update_user_id, create_time, update_time, num, tags, last_result_id, status,
original_status,
delete_time, delete_user_id, version, `order`, case_status, version_id)
SELECT UUID(),
project_id,
name,
priority,
#{api.id},
description,
request,
#{api.createUser},
update_user_id,
create_time,
update_time,
num,
tags,
last_result_id,
status,
original_status,
delete_time,
delete_user_id,
version,
`order`,
case_status,
#{api.versionId}
FROM api_test_case
WHERE api_definition_id = #{old.id};
</insert>
<select id="countById" resultType="java.lang.Integer">
select count(id)
from api_test_case
where id = #{0}
</select>
</mapper>

View File

@ -71,4 +71,6 @@ public interface ExtTestPlanTestCaseMapper {
List<TestCase> getTestCaseWithNodeInfo(@Param("planId") String planId);
List<CountMapDTO> getExecResultMapByPlanId(@Param("planId") String planId);
String selectCaseId(String id);
}

View File

@ -375,25 +375,25 @@
</select>
<select id="get" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_case.remark,
test_plan_test_case.id as id,
test_plan_test_case.id as id,
test_plan_test_case.*,
test_case.*,
if(pa.type_value = 'false', cast(test_case.num as char), test_case.custom_num) as customNum,
test_case_node.name as model,
project.name as projectName
test_case_node.name as model,
project.name as projectName
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id = test_case.node_id
inner join project on project.id = test_case.project_id
inner join project_application pa on project.id = pa.project_id and pa.type = 'CASE_CUSTOM_NUM'
where test_plan_test_case.id = #{testPlanTestCaseId}
where test_plan_test_case.id = #{testPlanTestCaseId}
</select>
<select id="getExecResultByPlanId" resultType="java.lang.String">
select status
from test_plan_test_case
where plan_id = #{planId}
AND case_id in (SELECT id FROM test_case WHERE (`status` is null or `status` != 'Trash'))
AND case_id in (SELECT id FROM test_case WHERE (`status` is null or `status` != 'Trash'))
</select>
<select id="listByPlanId" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
SELECT test_plan_api_case.id as reportId,test_plan_api_case.api_case_id as id,"definition" as
@ -561,15 +561,21 @@
<select id="getTestCaseWithNodeInfo" resultType="io.metersphere.base.domain.TestCase">
select tc.project_id, tc.node_id
from test_plan_test_case tptc
join test_case tc on tptc.case_id = tc.id
join test_case tc on tptc.case_id = tc.id
where tptc.plan_id = #{planId}
</select>
<select id="getExecResultMapByPlanId" resultType="io.metersphere.track.dto.CountMapDTO">
select status as `key`, count(*) as `value`
from test_plan_test_case
where plan_id = #{planId} and is_del = 0
where plan_id = #{planId}
and is_del = 0
group by status
</select>
<select id="selectCaseId" resultType="java.lang.String">
select case_id
from test_plan_test_case
where id = #{0}
</select>
<sql id="queryVersionCondition">
<if test="request.versionId != null">

View File

@ -7,12 +7,12 @@ import io.metersphere.commons.utils.LogUtil;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.service.ProjectApplicationService;
import io.metersphere.service.ProjectService;
import io.metersphere.xpack.ui.service.UiScenarioReportStructureService;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.JobExecutionContext;
import org.quartz.JobKey;
import org.quartz.TriggerKey;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.function.BiConsumer;
@ -24,7 +24,6 @@ public class CleanUpReportJob extends MsScheduleJob {
private final ProjectService projectService;
private final ProjectApplicationService projectApplicationService;
private final UiScenarioReportStructureService uiScenarioReportStructureService;
private static final String UNIT_DAY = "D";
private static final String UNIT_MONTH = "M";
private static final String UNIT_YEAR = "Y";
@ -33,7 +32,6 @@ public class CleanUpReportJob extends MsScheduleJob {
public CleanUpReportJob() {
projectService = CommonBeanFactory.getBean(ProjectService.class);
projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class);
uiScenarioReportStructureService = CommonBeanFactory.getBean(UiScenarioReportStructureService.class);
localDate = LocalDate.now();
}

View File

@ -0,0 +1,57 @@
package io.metersphere.service;
import io.metersphere.base.domain.ApiCaseExecutionInfo;
import io.metersphere.base.domain.ApiCaseExecutionInfoExample;
import io.metersphere.base.mapper.ApiCaseExecutionInfoMapper;
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@Service
@Transactional
public class ApiCaseExecutionInfoService {
@Resource
private ApiCaseExecutionInfoMapper apiCaseExecutionInfoMapper;
@Resource
private ExtApiTestCaseMapper extApiTestCaseMapper;
@Lazy
public void insertExecutionInfo(String apiCaseId, String result) {
if (StringUtils.isNotEmpty(apiCaseId) && StringUtils.isNotEmpty(result)) {
ApiCaseExecutionInfo executionInfo = new ApiCaseExecutionInfo();
executionInfo.setResult(result);
executionInfo.setSourceId(apiCaseId);
executionInfo.setId(UUID.randomUUID().toString());
executionInfo.setCreateTime(System.currentTimeMillis());
apiCaseExecutionInfoMapper.insert(executionInfo);
}
}
public void deleteByApiCaseId(String resourceId) {
ApiCaseExecutionInfoExample example = new ApiCaseExecutionInfoExample();
example.createCriteria().andSourceIdEqualTo(resourceId);
apiCaseExecutionInfoMapper.deleteByExample(example);
}
public void deleteByApiCaseIdList(List<String> resourceIdList) {
if (CollectionUtils.isNotEmpty(resourceIdList)) {
ApiCaseExecutionInfoExample example = new ApiCaseExecutionInfoExample();
example.createCriteria().andSourceIdIn(resourceIdList);
apiCaseExecutionInfoMapper.deleteByExample(example);
}
}
public void deleteByApiDefeinitionIdList(List<String> apiIdList) {
if (CollectionUtils.isNotEmpty(apiIdList)) {
List<String> apiCaseIdList = extApiTestCaseMapper.selectCaseIdsByApiIds(apiIdList);
this.deleteByApiCaseIdList(apiCaseIdList);
}
}
}

View File

@ -0,0 +1,95 @@
package io.metersphere.service;
import io.metersphere.base.domain.ApiCaseExecutionInfo;
import io.metersphere.base.domain.ApiDefinitionExecResult;
import io.metersphere.base.domain.ApiExecutionInfo;
import io.metersphere.base.domain.ApiExecutionInfoExample;
import io.metersphere.base.mapper.ApiCaseExecutionInfoMapper;
import io.metersphere.base.mapper.ApiExecutionInfoMapper;
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ext.ExtApiDefinitionMapper;
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@Service
@Transactional
public class ApiExecutionInfoService {
@Resource
private ApiExecutionInfoMapper apiExecutionInfoMapper;
@Resource
private ApiCaseExecutionInfoMapper apiCaseExecutionInfoMapper;
@Resource
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
@Resource
private ExtApiDefinitionMapper extApiDefinitionMapper;
@Resource
private ExtApiTestCaseMapper extApiTestCaseMapper;
@Resource
private ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
@Lazy
public void insertExecutionInfo(ApiDefinitionExecResult result) {
if (result != null && StringUtils.isNotEmpty(result.getStatus()) && StringUtils.isNotEmpty(result.getId())) {
String resourceID = result.getResourceId();
if (resourceID == null) {
resourceID = extApiDefinitionExecResultMapper.selectResourceId(result.getId());
}
boolean isApiDefinition = extApiDefinitionMapper.countById(resourceID) > 0;
if (isApiDefinition) {
this.insertApiExecutionInfo(resourceID, result.getStatus());
} else {
boolean isApiCase = extApiTestCaseMapper.countById(resourceID) > 0;
if (isApiCase) {
this.insertApiCaseExecutionInfo(resourceID, result.getStatus());
} else {
String apiCaseIdInTestPlan = extTestPlanApiCaseMapper.getApiTestCaseIdById(resourceID);
if (StringUtils.isNotEmpty(apiCaseIdInTestPlan)) {
this.insertApiCaseExecutionInfo(apiCaseIdInTestPlan, result.getStatus());
}
}
}
}
}
private void insertApiCaseExecutionInfo(String resourceID, String status) {
ApiCaseExecutionInfo info = new ApiCaseExecutionInfo();
info.setId(UUID.randomUUID().toString());
info.setSourceId(resourceID);
info.setCreateTime(System.currentTimeMillis());
info.setResult(status);
apiCaseExecutionInfoMapper.insert(info);
}
private void insertApiExecutionInfo(String resourceID, String status) {
ApiExecutionInfo info = new ApiExecutionInfo();
info.setId(UUID.randomUUID().toString());
info.setSourceId(resourceID);
info.setCreateTime(System.currentTimeMillis());
info.setResult(status);
apiExecutionInfoMapper.insert(info);
}
public void deleteByApiId(String resourceId) {
ApiExecutionInfoExample example = new ApiExecutionInfoExample();
example.createCriteria().andSourceIdEqualTo(resourceId);
apiExecutionInfoMapper.deleteByExample(example);
}
public void deleteByApiIdList(List<String> resourceIdList) {
if (CollectionUtils.isNotEmpty(resourceIdList)) {
ApiExecutionInfoExample example = new ApiExecutionInfoExample();
example.createCriteria().andSourceIdIn(resourceIdList);
apiExecutionInfoMapper.deleteByExample(example);
}
}
}

View File

@ -0,0 +1,47 @@
package io.metersphere.service;
import io.metersphere.base.domain.FunctionCaseExecutionInfo;
import io.metersphere.base.domain.FunctionCaseExecutionInfoExample;
import io.metersphere.base.mapper.FunctionCaseExecutionInfoMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@Service
@Transactional
public class FunctionCaseExecutionInfoService {
@Resource
private FunctionCaseExecutionInfoMapper functionCaseExecutionInfoMapper;
public void insertExecutionInfo(String caseId, String result) {
if (!StringUtils.isAnyEmpty(caseId, result)) {
FunctionCaseExecutionInfo executionInfo = new FunctionCaseExecutionInfo();
executionInfo.setResult(result);
executionInfo.setSourceId(caseId);
executionInfo.setId(UUID.randomUUID().toString());
executionInfo.setCreateTime(System.currentTimeMillis());
functionCaseExecutionInfoMapper.insert(executionInfo);
}
}
public void deleteBySourceIdList(List<String> ids) {
if (CollectionUtils.isNotEmpty(ids)) {
FunctionCaseExecutionInfoExample example = new FunctionCaseExecutionInfoExample();
example.createCriteria().andSourceIdIn(ids);
functionCaseExecutionInfoMapper.deleteByExample(example);
}
}
public void deleteBySourceId(String id) {
if (StringUtils.isNotEmpty(id)) {
FunctionCaseExecutionInfoExample example = new FunctionCaseExecutionInfoExample();
example.createCriteria().andSourceIdEqualTo(id);
functionCaseExecutionInfoMapper.deleteByExample(example);
}
}
}

View File

@ -5,7 +5,10 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import io.metersphere.api.dto.DeleteAPITestRequest;
import io.metersphere.api.dto.QueryAPITestRequest;
import io.metersphere.api.dto.automation.ExecuteType;
import io.metersphere.api.service.*;
import io.metersphere.api.service.APITestService;
import io.metersphere.api.service.ApiScenarioReportService;
import io.metersphere.api.service.ApiTestDelService;
import io.metersphere.api.service.ProjectApplicationSyncService;
import io.metersphere.api.tcp.TCPPool;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;

View File

@ -0,0 +1,60 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSONArray;
import io.metersphere.base.domain.ScenarioExecutionInfo;
import io.metersphere.base.domain.ScenarioExecutionInfoExample;
import io.metersphere.base.mapper.ScenarioExecutionInfoMapper;
import io.metersphere.commons.utils.LogUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@Service
@Transactional
public class ScenarioExecutionInfoService {
@Resource
private ScenarioExecutionInfoMapper scenarioExecutionInfoMapper;
@Lazy
public void insertExecutionInfo(String scenarioId, String result) {
if (StringUtils.isNotEmpty(scenarioId) && StringUtils.isNotEmpty(result)) {
ScenarioExecutionInfo executionInfo = new ScenarioExecutionInfo();
executionInfo.setResult(result);
executionInfo.setSourceId(scenarioId);
executionInfo.setId(UUID.randomUUID().toString());
executionInfo.setCreateTime(System.currentTimeMillis());
scenarioExecutionInfoMapper.insert(executionInfo);
}
}
public void insertExecutionInfoByScenarioIds(String scenarioIdJsonString, String status) {
try {
List<String> scenarioIdList = JSONArray.parseArray(scenarioIdJsonString, String.class);
for (String scenarioId : scenarioIdList) {
this.insertExecutionInfo(scenarioId, status);
}
} catch (Exception e) {
LogUtil.error("解析场景ID的JSON" + scenarioIdJsonString + "失败!", e);
}
}
public void deleteByScenarioId(String resourceId) {
ScenarioExecutionInfoExample example = new ScenarioExecutionInfoExample();
example.createCriteria().andSourceIdEqualTo(resourceId);
scenarioExecutionInfoMapper.deleteByExample(example);
}
public void deleteByScenarioIdList(List<String> resourceIdList) {
if (CollectionUtils.isNotEmpty(resourceIdList)) {
ScenarioExecutionInfoExample example = new ScenarioExecutionInfoExample();
example.createCriteria().andSourceIdIn(resourceIdList);
scenarioExecutionInfoMapper.deleteByExample(example);
}
}
}

View File

@ -168,6 +168,8 @@ public class TestCaseService {
private CustomFieldTestCaseMapper customFieldTestCaseMapper;
@Resource
private CustomFieldTestCaseService customFieldTestCaseService;
@Resource
private FunctionCaseExecutionInfoService functionCaseExecutionInfoService;
@Lazy
@Resource
private TestPlanTestCaseService testPlanTestCaseService;
@ -345,7 +347,7 @@ public class TestCaseService {
public TestCaseDTO getTestCase(String testCaseId) {
TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(testCaseId);
TestCaseDTO testCaseDTO = new TestCaseDTO();
TestCaseDTO testCaseDTO = new TestCaseDTO();
BeanUtils.copyBean(testCaseDTO, testCaseWithBLOBs);
buildCustomField(testCaseDTO);
return testCaseDTO;
@ -531,11 +533,9 @@ public class TestCaseService {
if (StringUtils.isNotBlank(testCase.getTestId())) {
criteria.andTestIdEqualTo(testCase.getTestId());
}
if (StringUtils.isNotBlank(testCase.getId())) {
criteria.andIdNotEqualTo(testCase.getId());
}
List<TestCaseWithBLOBs> caseList = testCaseMapper.selectByExampleWithBLOBs(example);
// 如果上边字段全部相同去检查 remark steps
@ -606,6 +606,7 @@ public class TestCaseService {
relationshipEdgeService.delete(testCaseId); // 删除关系图
deleteFollows(testCaseId);
customFieldTestCaseService.deleteByResourceId(testCaseId); // 删除自定义字段关联关系
functionCaseExecutionInfoService.deleteBySourceId(testCaseId);
return testCaseMapper.deleteByPrimaryKey(testCaseId);
}
@ -1597,14 +1598,14 @@ public class TestCaseService {
for (int j = 0; j < jsonArray.size(); j++) {
int num = j + 1;
String stepItem = jsonArray.getJSONObject(j).getString("desc");
if(StringUtils.isEmpty(stepItem)){
if (StringUtils.isEmpty(stepItem)) {
stepItem = "";
}
//正则去空格回车换行符制表符
stepItem = stepItem.replaceAll("\\s*|\t|\r|\n", "");
step.append(num + "." + stepItem + "\n");
String resultItem = jsonArray.getJSONObject(j).getString("result");
if(StringUtils.isEmpty(resultItem)){
if (StringUtils.isEmpty(resultItem)) {
resultItem = "";
}
result.append(num + "." + resultItem + "\n");
@ -1825,6 +1826,8 @@ public class TestCaseService {
deleteTestPlanTestCaseBath(request.getIds());
relationshipEdgeService.delete(request.getIds()); // 删除关系图
customFieldTestCaseService.deleteByResourceIds(request.getIds()); // 删除自定义字段
//删除执行信息
functionCaseExecutionInfoService.deleteBySourceIdList(request.getIds());
request.getIds().forEach(testCaseId -> { // todo 优化下效率
testCaseIssueService.delTestCaseIssues(testCaseId);
@ -1856,6 +1859,12 @@ public class TestCaseService {
public void deleteTestCaseByProjectId(String projectId) {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andProjectIdEqualTo(projectId);
List<TestCase> testCaseList = testCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(testCaseList)) {
List<String> idList = testCaseList.stream().map(TestCase::getId).collect(Collectors.toList());
//删除执行记录
functionCaseExecutionInfoService.deleteBySourceIdList(idList);
}
testCaseMapper.deleteByExample(example);
}
@ -2676,6 +2685,9 @@ public class TestCaseService {
List<TestCaseWithBLOBs> testCaseList = testCaseMapper.selectByExampleWithBLOBs(e);
if (CollectionUtils.isNotEmpty(testCaseList)) {
testCaseMapper.deleteByExample(e);
List<String> idList = testCaseList.stream().map(TestCase::getId).collect(Collectors.toList());
//删除执行记录
functionCaseExecutionInfoService.deleteBySourceIdList(idList);
//检查最新版本
checkAndSetLatestVersion(refId, version, testCaseList.get(0).getProjectId(), "del");
}

View File

@ -16,6 +16,7 @@ import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.service.FunctionCaseExecutionInfoService;
import io.metersphere.service.ProjectApplicationService;
import io.metersphere.service.ProjectService;
import io.metersphere.service.UserService;
@ -74,6 +75,8 @@ public class TestPlanTestCaseService {
private ProjectService projectService;
@Resource
private ProjectApplicationService projectApplicationService;
@Resource
private FunctionCaseExecutionInfoService functionCaseExecutionInfoService;
public List<TestPlanTestCaseWithBLOBs> listAll() {
TestPlanTestCaseExample example = new TestPlanTestCaseExample();
@ -144,6 +147,14 @@ public class TestPlanTestCaseService {
public void editTestCase(TestPlanTestCaseWithBLOBs testPlanTestCase) {
if (StringUtils.equals(TestPlanTestCaseStatus.Prepare.name(), testPlanTestCase.getStatus())) {
testPlanTestCase.setStatus(TestPlanTestCaseStatus.Underway.name());
} else {
if (StringUtils.isEmpty(testPlanTestCase.getCaseId())) {
String caseId = extTestPlanTestCaseMapper.selectCaseId(testPlanTestCase.getId());
functionCaseExecutionInfoService.insertExecutionInfo(caseId, testPlanTestCase.getStatus());
} else {
//记录功能用例执行信息
functionCaseExecutionInfoService.insertExecutionInfo(testPlanTestCase.getCaseId(), testPlanTestCase.getStatus());
}
}
testPlanTestCase.setExecutor(SessionUtils.getUser().getId());
testPlanTestCase.setUpdateTime(System.currentTimeMillis());
@ -458,13 +469,13 @@ public class TestPlanTestCaseService {
}
public List<TestPlanCaseDTO> buildCaseInfo(List<TestPlanCaseDTO> cases) {
if(CollectionUtils.isNotEmpty(cases)){
if (CollectionUtils.isNotEmpty(cases)) {
Map<String, Project> projectMap = ServiceUtils.getProjectMap(
cases.stream().map(TestPlanCaseDTO::getProjectId).collect(Collectors.toList()));
Map<String, String> userNameMap = ServiceUtils.getUserNameMap(
cases.stream().map(TestPlanCaseDTO::getExecutor).collect(Collectors.toList()));
cases.forEach(item -> {
if(projectMap.containsKey(item.getProjectId())){
if (projectMap.containsKey(item.getProjectId())) {
item.setProjectName(projectMap.get(item.getProjectId()).getName());
}
ProjectConfig config = projectApplicationService.getSpecificTypeValue(item.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
@ -485,6 +496,7 @@ public class TestPlanTestCaseService {
/**
* 用例自定义排序
*
* @param request
*/
public void updateOrder(ResetOrderRequest request) {