refactor(接口定义): 重构用例存储及结果统计
This commit is contained in:
parent
66c14eea89
commit
ea7090b3eb
|
@ -15,15 +15,15 @@ import io.metersphere.track.dto.TestPlanDTO;
|
||||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||||
import io.metersphere.track.service.TestPlanApiCaseService;
|
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||||
import io.metersphere.track.service.TestPlanService;
|
import io.metersphere.track.service.TestPlanService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -37,32 +37,39 @@ public class ApiDefinitionExecResultService {
|
||||||
private TestPlanApiCaseService testPlanApiCaseService;
|
private TestPlanApiCaseService testPlanApiCaseService;
|
||||||
@Resource
|
@Resource
|
||||||
private TestPlanService testPlanService;
|
private TestPlanService testPlanService;
|
||||||
|
@Resource
|
||||||
|
SqlSessionFactory sqlSessionFactory;
|
||||||
|
|
||||||
public void saveApiResult(TestResult result, String type) {
|
public void saveApiResult(TestResult result, String type) {
|
||||||
result.getScenarios().get(0).getRequestResults().forEach(item -> {
|
if (CollectionUtils.isNotEmpty(result.getScenarios())) {
|
||||||
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
saveResult.setId(UUID.randomUUID().toString());
|
ApiDefinitionExecResultMapper definitionExecResultMapper = sqlSession.getMapper(ApiDefinitionExecResultMapper.class);
|
||||||
saveResult.setCreateTime(System.currentTimeMillis());
|
result.getScenarios().get(0).getRequestResults().forEach(item -> {
|
||||||
saveResult.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
|
||||||
saveResult.setName(item.getName());
|
saveResult.setId(UUID.randomUUID().toString());
|
||||||
saveResult.setResourceId(item.getName());
|
saveResult.setCreateTime(System.currentTimeMillis());
|
||||||
saveResult.setContent(JSON.toJSONString(item));
|
saveResult.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||||
saveResult.setStartTime(item.getStartTime());
|
saveResult.setName(item.getName());
|
||||||
String status = item.isSuccess() ? "success" : "error";
|
saveResult.setResourceId(item.getName());
|
||||||
saveResult.setEndTime(item.getResponseResult().getResponseTime());
|
saveResult.setContent(JSON.toJSONString(item));
|
||||||
saveResult.setType(type);
|
saveResult.setStartTime(item.getStartTime());
|
||||||
saveResult.setStatus(status);
|
String status = item.isSuccess() ? "success" : "error";
|
||||||
if (StringUtils.equals(type, ApiRunMode.API_PLAN.name())) {
|
saveResult.setEndTime(item.getResponseResult().getResponseTime());
|
||||||
testPlanApiCaseService.setExecResult(item.getName(), status);
|
saveResult.setType(type);
|
||||||
}
|
saveResult.setStatus(status);
|
||||||
apiDefinitionExecResultMapper.insert(saveResult);
|
if (StringUtils.equals(type, ApiRunMode.API_PLAN.name())) {
|
||||||
});
|
testPlanApiCaseService.setExecResult(item.getName(), status);
|
||||||
|
}
|
||||||
|
definitionExecResultMapper.insert(saveResult);
|
||||||
|
});
|
||||||
|
sqlSession.flushStatements();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务触发的保存逻辑
|
* 定时任务触发的保存逻辑
|
||||||
* 定时任务时,userID要改为定时任务中的用户
|
* 定时任务时,userID要改为定时任务中的用户
|
||||||
|
*
|
||||||
* @param result
|
* @param result
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
|
@ -87,7 +94,7 @@ public class ApiDefinitionExecResultService {
|
||||||
userID = scheduleCreateUser;
|
userID = scheduleCreateUser;
|
||||||
apiCase.setStatus(status);
|
apiCase.setStatus(status);
|
||||||
testPlanApiCaseService.updateByPrimaryKeySelective(apiCase);
|
testPlanApiCaseService.updateByPrimaryKeySelective(apiCase);
|
||||||
}else {
|
} else {
|
||||||
userID = Objects.requireNonNull(SessionUtils.getUser()).getId();
|
userID = Objects.requireNonNull(SessionUtils.getUser()).getId();
|
||||||
testPlanApiCaseService.setExecResult(item.getName(), status);
|
testPlanApiCaseService.setExecResult(item.getName(), status);
|
||||||
}
|
}
|
||||||
|
@ -144,26 +151,26 @@ public class ApiDefinitionExecResultService {
|
||||||
if (startTime == null) {
|
if (startTime == null) {
|
||||||
return new ArrayList<>(0);
|
return new ArrayList<>(0);
|
||||||
} else {
|
} else {
|
||||||
List<ExecutedCaseInfoResult>list = extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId, startTime.getTime());
|
List<ExecutedCaseInfoResult> list = extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId, startTime.getTime());
|
||||||
|
|
||||||
List<ExecutedCaseInfoResult> returnList = new ArrayList<>(limitNumber);
|
List<ExecutedCaseInfoResult> returnList = new ArrayList<>(limitNumber);
|
||||||
|
|
||||||
for(int i = 0;i<list.size();i++){
|
for (int i = 0; i < list.size(); i++) {
|
||||||
if(i<limitNumber){
|
if (i < limitNumber) {
|
||||||
//开始遍历查询TestPlan信息 --> 提供前台做超链接
|
//开始遍历查询TestPlan信息 --> 提供前台做超链接
|
||||||
ExecutedCaseInfoResult item = list.get(i);
|
ExecutedCaseInfoResult item = list.get(i);
|
||||||
|
|
||||||
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
||||||
planRequest.setProjectId(projectId);
|
planRequest.setProjectId(projectId);
|
||||||
if("scenario".equals(item.getCaseType())){
|
if ("scenario".equals(item.getCaseType())) {
|
||||||
planRequest.setScenarioId(item.getTestCaseID());
|
planRequest.setScenarioId(item.getTestCaseID());
|
||||||
}else if("apiCase".equals(item.getCaseType())){
|
} else if ("apiCase".equals(item.getCaseType())) {
|
||||||
planRequest.setApiId(item.getTestCaseID());
|
planRequest.setApiId(item.getTestCaseID());
|
||||||
}
|
}
|
||||||
List<TestPlanDTO> dtoList = testPlanService.selectTestPlanByRelevancy(planRequest);
|
List<TestPlanDTO> dtoList = testPlanService.selectTestPlanByRelevancy(planRequest);
|
||||||
item.setTestPlanDTOList(dtoList);
|
item.setTestPlanDTOList(dtoList);
|
||||||
returnList.add(item);
|
returnList.add(item);
|
||||||
}else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,6 @@ public class ApiTestCaseService {
|
||||||
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||||
test.setProjectId(request.getProjectId());
|
test.setProjectId(request.getProjectId());
|
||||||
test.setRequest(JSONObject.toJSONString(request.getRequest()));
|
test.setRequest(JSONObject.toJSONString(request.getRequest()));
|
||||||
test.setResponse(JSONObject.toJSONString(request.getResponse()));
|
|
||||||
test.setPriority(request.getPriority());
|
test.setPriority(request.getPriority());
|
||||||
test.setUpdateTime(System.currentTimeMillis());
|
test.setUpdateTime(System.currentTimeMillis());
|
||||||
test.setDescription(request.getDescription());
|
test.setDescription(request.getDescription());
|
||||||
|
@ -242,7 +241,6 @@ public class ApiTestCaseService {
|
||||||
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||||
test.setProjectId(request.getProjectId());
|
test.setProjectId(request.getProjectId());
|
||||||
test.setRequest(JSONObject.toJSONString(request.getRequest()));
|
test.setRequest(JSONObject.toJSONString(request.getRequest()));
|
||||||
test.setResponse(JSONObject.toJSONString(request.getResponse()));
|
|
||||||
test.setCreateTime(System.currentTimeMillis());
|
test.setCreateTime(System.currentTimeMillis());
|
||||||
test.setPriority(request.getPriority());
|
test.setPriority(request.getPriority());
|
||||||
test.setUpdateTime(System.currentTimeMillis());
|
test.setUpdateTime(System.currentTimeMillis());
|
||||||
|
@ -438,7 +436,7 @@ public class ApiTestCaseService {
|
||||||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||||
if (testCaseWithBLOBs != null && StringUtils.isNotEmpty(testCaseWithBLOBs.getRequest())) {
|
if (testCaseWithBLOBs != null && StringUtils.isNotEmpty(testCaseWithBLOBs.getRequest())) {
|
||||||
try {
|
try {
|
||||||
HashTree jmeterHashTree = this.generateHashTree(request,testCaseWithBLOBs);
|
HashTree jmeterHashTree = this.generateHashTree(request, testCaseWithBLOBs);
|
||||||
String runMode = ApiRunMode.DEFINITION.name();
|
String runMode = ApiRunMode.DEFINITION.name();
|
||||||
// 调用执行方法
|
// 调用执行方法
|
||||||
jMeterService.runDefinition(request.getReportId(), jmeterHashTree, request.getReportId(), runMode);
|
jMeterService.runDefinition(request.getReportId(), jmeterHashTree, request.getReportId(), runMode);
|
||||||
|
@ -449,7 +447,8 @@ public class ApiTestCaseService {
|
||||||
}
|
}
|
||||||
return request.getReportId();
|
return request.getReportId();
|
||||||
}
|
}
|
||||||
public String run(ApiTestCaseWithBLOBs apiCaseBolbs,String id,String debugReportId,String testPlanID,String runMode) {
|
|
||||||
|
public String run(ApiTestCaseWithBLOBs apiCaseBolbs, String id, String debugReportId, String testPlanID, String runMode) {
|
||||||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||||
if (apiCaseBolbs != null && StringUtils.isNotEmpty(apiCaseBolbs.getRequest())) {
|
if (apiCaseBolbs != null && StringUtils.isNotEmpty(apiCaseBolbs.getRequest())) {
|
||||||
try {
|
try {
|
||||||
|
@ -457,7 +456,7 @@ public class ApiTestCaseService {
|
||||||
RunCaseRequest request = new RunCaseRequest();
|
RunCaseRequest request = new RunCaseRequest();
|
||||||
request.setCaseId(apiTestCase.getId());
|
request.setCaseId(apiTestCase.getId());
|
||||||
request.setTestPlanId(testPlanID);
|
request.setTestPlanId(testPlanID);
|
||||||
HashTree jmeterHashTree = this.generateHashTree(request,apiCaseBolbs);
|
HashTree jmeterHashTree = this.generateHashTree(request, apiCaseBolbs);
|
||||||
// 调用执行方法
|
// 调用执行方法
|
||||||
jMeterService.runDefinition(id, jmeterHashTree, debugReportId, runMode);
|
jMeterService.runDefinition(id, jmeterHashTree, debugReportId, runMode);
|
||||||
|
|
||||||
|
@ -467,18 +466,19 @@ public class ApiTestCaseService {
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
public HashTree generateHashTree(RunCaseRequest request,ApiTestCaseWithBLOBs testCaseWithBLOBs) throws Exception {
|
|
||||||
|
public HashTree generateHashTree(RunCaseRequest request, ApiTestCaseWithBLOBs testCaseWithBLOBs) throws Exception {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
MsTestElement element = mapper.readValue(testCaseWithBLOBs.getRequest(), new TypeReference<MsTestElement>() {
|
MsTestElement element = mapper.readValue(testCaseWithBLOBs.getRequest(), new TypeReference<MsTestElement>() {
|
||||||
});
|
});
|
||||||
if(StringUtils.isBlank(request.getEnvironmentId())){
|
if (StringUtils.isBlank(request.getEnvironmentId())) {
|
||||||
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
||||||
example.createCriteria().andTestPlanIdEqualTo(request.getTestPlanId()).andApiCaseIdEqualTo(request.getCaseId());
|
example.createCriteria().andTestPlanIdEqualTo(request.getTestPlanId()).andApiCaseIdEqualTo(request.getCaseId());
|
||||||
List<TestPlanApiCase> list=testPlanApiCaseMapper.selectByExample(example);
|
List<TestPlanApiCase> list = testPlanApiCaseMapper.selectByExample(example);
|
||||||
request.setEnvironmentId(list.get(0).getEnvironmentId());
|
request.setEnvironmentId(list.get(0).getEnvironmentId());
|
||||||
element.setName(list.get(0).getId());
|
element.setName(list.get(0).getId());
|
||||||
}else{
|
} else {
|
||||||
element.setName(request.getCaseId());
|
element.setName(request.getCaseId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,19 +498,19 @@ public class ApiTestCaseService {
|
||||||
testPlan.getHashTree().add(group);
|
testPlan.getHashTree().add(group);
|
||||||
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(request.getEnvironmentId());
|
ApiTestEnvironmentWithBLOBs environment = environmentService.get(request.getEnvironmentId());
|
||||||
ParameterConfig parameterConfig=new ParameterConfig();
|
ParameterConfig parameterConfig = new ParameterConfig();
|
||||||
if (environment != null && environment.getConfig() != null) {
|
if (environment != null && environment.getConfig() != null) {
|
||||||
parameterConfig.setConfig( JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class));
|
parameterConfig.setConfig(JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class));
|
||||||
}
|
}
|
||||||
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), parameterConfig);
|
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), parameterConfig);
|
||||||
return jmeterHashTree;
|
return jmeterHashTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecResult(String id){
|
public String getExecResult(String id) {
|
||||||
ApiDefinitionExecResultExample apidefinitionexecresultexample = new ApiDefinitionExecResultExample();
|
ApiDefinitionExecResultExample apidefinitionexecresultexample = new ApiDefinitionExecResultExample();
|
||||||
ApiDefinitionExecResultExample.Criteria criteria = apidefinitionexecresultexample.createCriteria();
|
ApiDefinitionExecResultExample.Criteria criteria = apidefinitionexecresultexample.createCriteria();
|
||||||
criteria.andResourceIdEqualTo(id);
|
criteria.andResourceIdEqualTo(id);
|
||||||
String status=apiDefinitionExecResultMapper.selectByExample(apidefinitionexecresultexample).get(0).getStatus();
|
String status = apiDefinitionExecResultMapper.selectByExample(apidefinitionexecresultexample).get(0).getStatus();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,7 @@ public class ApiTestCase implements Serializable {
|
||||||
|
|
||||||
private String tags;
|
private String tags;
|
||||||
|
|
||||||
|
private String lastResultId;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -843,6 +843,76 @@ public class ApiTestCaseExample {
|
||||||
addCriterion("tags not between", value1, value2, "tags");
|
addCriterion("tags not between", value1, value2, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdIsNull() {
|
||||||
|
addCriterion("last_result_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdIsNotNull() {
|
||||||
|
addCriterion("last_result_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdEqualTo(String value) {
|
||||||
|
addCriterion("last_result_id =", value, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdNotEqualTo(String value) {
|
||||||
|
addCriterion("last_result_id <>", value, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdGreaterThan(String value) {
|
||||||
|
addCriterion("last_result_id >", value, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("last_result_id >=", value, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdLessThan(String value) {
|
||||||
|
addCriterion("last_result_id <", value, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("last_result_id <=", value, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdLike(String value) {
|
||||||
|
addCriterion("last_result_id like", value, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdNotLike(String value) {
|
||||||
|
addCriterion("last_result_id not like", value, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdIn(List<String> values) {
|
||||||
|
addCriterion("last_result_id in", values, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdNotIn(List<String> values) {
|
||||||
|
addCriterion("last_result_id not in", values, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("last_result_id between", value1, value2, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastResultIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("last_result_id not between", value1, value2, "lastResultId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -13,7 +13,5 @@ public class ApiTestCaseWithBLOBs extends ApiTestCase implements Serializable {
|
||||||
|
|
||||||
private String request;
|
private String request;
|
||||||
|
|
||||||
private String response;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -13,11 +13,11 @@
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||||
<result column="num" jdbcType="INTEGER" property="num" />
|
<result column="num" jdbcType="INTEGER" property="num" />
|
||||||
<result column="tags" jdbcType="VARCHAR" property="tags" />
|
<result column="tags" jdbcType="VARCHAR" property="tags" />
|
||||||
|
<result column="last_result_id" jdbcType="VARCHAR" property="lastResultId" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||||
<result column="request" jdbcType="LONGVARCHAR" property="request" />
|
<result column="request" jdbcType="LONGVARCHAR" property="request" />
|
||||||
<result column="response" jdbcType="LONGVARCHAR" property="response" />
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
<where>
|
<where>
|
||||||
|
@ -79,10 +79,10 @@
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
|
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
|
||||||
create_time, update_time, num, tags
|
create_time, update_time, num, tags, last_result_id
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
description, request, response
|
description, request
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestCaseExample" resultMap="ResultMapWithBLOBs">
|
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestCaseExample" resultMap="ResultMapWithBLOBs">
|
||||||
select
|
select
|
||||||
|
@ -136,13 +136,13 @@
|
||||||
insert into api_test_case (id, project_id, `name`,
|
insert into api_test_case (id, project_id, `name`,
|
||||||
priority, api_definition_id, create_user_id,
|
priority, api_definition_id, create_user_id,
|
||||||
update_user_id, create_time, update_time,
|
update_user_id, create_time, update_time,
|
||||||
num, tags, description,
|
num, tags, last_result_id,
|
||||||
request, response)
|
description, request)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||||
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
|
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
|
||||||
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{lastResultId,jdbcType=VARCHAR},
|
||||||
#{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR})
|
#{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||||
insert into api_test_case
|
insert into api_test_case
|
||||||
|
@ -180,15 +180,15 @@
|
||||||
<if test="tags != null">
|
<if test="tags != null">
|
||||||
tags,
|
tags,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lastResultId != null">
|
||||||
|
last_result_id,
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
description,
|
description,
|
||||||
</if>
|
</if>
|
||||||
<if test="request != null">
|
<if test="request != null">
|
||||||
request,
|
request,
|
||||||
</if>
|
</if>
|
||||||
<if test="response != null">
|
|
||||||
response,
|
|
||||||
</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
@ -224,15 +224,15 @@
|
||||||
<if test="tags != null">
|
<if test="tags != null">
|
||||||
#{tags,jdbcType=VARCHAR},
|
#{tags,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lastResultId != null">
|
||||||
|
#{lastResultId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
#{description,jdbcType=LONGVARCHAR},
|
#{description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="request != null">
|
<if test="request != null">
|
||||||
#{request,jdbcType=LONGVARCHAR},
|
#{request,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="response != null">
|
|
||||||
#{response,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestCaseExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestCaseExample" resultType="java.lang.Long">
|
||||||
|
@ -277,15 +277,15 @@
|
||||||
<if test="record.tags != null">
|
<if test="record.tags != null">
|
||||||
tags = #{record.tags,jdbcType=VARCHAR},
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.lastResultId != null">
|
||||||
|
last_result_id = #{record.lastResultId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.description != null">
|
<if test="record.description != null">
|
||||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.request != null">
|
<if test="record.request != null">
|
||||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
request = #{record.request,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.response != null">
|
|
||||||
response = #{record.response,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
</set>
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
@ -304,9 +304,9 @@
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
tags = #{record.tags,jdbcType=VARCHAR},
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
|
last_result_id = #{record.lastResultId,jdbcType=VARCHAR},
|
||||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
request = #{record.request,jdbcType=LONGVARCHAR}
|
||||||
response = #{record.response,jdbcType=LONGVARCHAR}
|
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -323,7 +323,8 @@
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
tags = #{record.tags,jdbcType=VARCHAR}
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
|
last_result_id = #{record.lastResultId,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -361,15 +362,15 @@
|
||||||
<if test="tags != null">
|
<if test="tags != null">
|
||||||
tags = #{tags,jdbcType=VARCHAR},
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lastResultId != null">
|
||||||
|
last_result_id = #{lastResultId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
description = #{description,jdbcType=LONGVARCHAR},
|
description = #{description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="request != null">
|
<if test="request != null">
|
||||||
request = #{request,jdbcType=LONGVARCHAR},
|
request = #{request,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="response != null">
|
|
||||||
response = #{response,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
@ -385,9 +386,9 @@
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=INTEGER},
|
||||||
tags = #{tags,jdbcType=VARCHAR},
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
|
last_result_id = #{lastResultId,jdbcType=VARCHAR},
|
||||||
description = #{description,jdbcType=LONGVARCHAR},
|
description = #{description,jdbcType=LONGVARCHAR},
|
||||||
request = #{request,jdbcType=LONGVARCHAR},
|
request = #{request,jdbcType=LONGVARCHAR}
|
||||||
response = #{response,jdbcType=LONGVARCHAR}
|
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestCase">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestCase">
|
||||||
|
@ -401,7 +402,8 @@
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=INTEGER},
|
||||||
tags = #{tags,jdbcType=VARCHAR}
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
|
last_result_id = #{lastResultId,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -15,7 +15,6 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCase">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCase">
|
||||||
<result column="request" jdbcType="LONGVARCHAR" property="request"/>
|
<result column="request" jdbcType="LONGVARCHAR" property="request"/>
|
||||||
<result column="response" jdbcType="LONGVARCHAR" property="response"/>
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
<where>
|
<where>
|
||||||
|
@ -200,7 +199,6 @@
|
||||||
u2.name as updateUser,
|
u2.name as updateUser,
|
||||||
atc.description,
|
atc.description,
|
||||||
atc.request,
|
atc.request,
|
||||||
atc.response,
|
|
||||||
atc.create_user_id,
|
atc.create_user_id,
|
||||||
atc.create_time,
|
atc.create_time,
|
||||||
atc.update_user_id,
|
atc.update_user_id,
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE api_test_case drop COLUMN response;
|
||||||
|
ALTER TABLE api_test_case add COLUMN last_result_id varchar(64) COMMENT 'Last ApiDefinitionExecResult ID';
|
|
@ -304,4 +304,8 @@
|
||||||
.is-selected {
|
.is-selected {
|
||||||
background: #EFF7FF;
|
background: #EFF7FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon.is-active {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue