Merge remote-tracking branch 'origin/master'

# Conflicts:
#	backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
#	frontend/src/business/components/api/automation/ApiAutomation.vue
#	frontend/src/i18n/zh-CN.js
This commit is contained in:
q4speed 2020-12-02 15:34:04 +08:00
commit 4065663f55
88 changed files with 5399 additions and 1764 deletions

View File

@ -1,13 +1,12 @@
package io.metersphere.api.dto.definition;
import io.metersphere.base.domain.ApiDefinition;
import io.metersphere.base.domain.Schedule;
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class ApiDefinitionResult extends ApiDefinition {
public class ApiDefinitionResult extends ApiDefinitionWithBLOBs {
private String projectName;
@ -18,6 +17,4 @@ public class ApiDefinitionResult extends ApiDefinition {
private String caseStatus;
private String casePassingRate;
private Schedule schedule;
}

View File

@ -1,12 +1,12 @@
package io.metersphere.api.dto.definition;
import io.metersphere.base.domain.ApiTestCase;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class ApiTestCaseResult extends ApiTestCase {
public class ApiTestCaseResult extends ApiTestCaseWithBLOBs {
private String projectName;
private String createUser;
private String updateUser;

View File

@ -19,6 +19,8 @@ import lombok.EqualsAndHashCode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.http.control.Header;
import org.apache.jmeter.protocol.http.control.HeaderManager;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy;
import org.apache.jmeter.protocol.http.util.HTTPArgument;
import org.apache.jmeter.protocol.http.util.HTTPFileArg;
@ -80,6 +82,8 @@ public class MsHTTPSamplerProxy extends MsTestElement {
@JSONField(ordinal = 23)
private String useEnvironment;
@JSONField(ordinal = 24)
private List<KeyValue> headers;
public void toHashTree(HashTree tree, List<MsTestElement> hashTree) {
HTTPSamplerProxy sampler = new HTTPSamplerProxy();
@ -174,7 +178,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
final HashTree httpSamplerTree = tree.add(sampler);
setHeader(httpSamplerTree);
//判断是否要开启DNS
if (config != null && config.getCommonConfig() != null && config.getCommonConfig().isEnableHost()) {
MsDNSCacheManager.addEnvironmentVariables(httpSamplerTree, this.getName(), config);
@ -244,6 +248,19 @@ public class MsHTTPSamplerProxy extends MsTestElement {
return list.toArray(new HTTPFileArg[0]);
}
public void setHeader(HashTree tree) {
HeaderManager headerManager = new HeaderManager();
headerManager.setEnabled(true);
headerManager.setName(this.getName() + "Headers");
headerManager.setProperty(TestElement.TEST_CLASS, HeaderManager.class.getName());
headerManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("HeaderPanel"));
headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
headerManager.add(new Header(keyValue.getName(), keyValue.getValue()))
);
tree.add(headerManager);
}
private boolean isRest() {
return this.getRest().stream().filter(KeyValue::isEnable).filter(KeyValue::isValid).toArray().length > 0;
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import io.metersphere.api.jmeter.TestResult;
import io.metersphere.base.domain.ApiDefinitionExecResult;
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
import io.metersphere.commons.utils.SessionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -17,12 +18,14 @@ import java.util.UUID;
public class ApiDefinitionExecResultService {
@Resource
private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper;
@Resource
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
public void saveApiResult(TestResult result) {
result.getScenarios().get(0).getRequestResults().forEach(item -> {
// 清理原始资源每个执行 保留一条结果
apiDefinitionExecResultMapper.deleteByResourceId(item.getName());
extApiDefinitionExecResultMapper.deleteByResourceId(item.getName());
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
saveResult.setId(UUID.randomUUID().toString());
saveResult.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());

View File

@ -1,20 +0,0 @@
package io.metersphere.api.service;
import io.metersphere.base.domain.ApiDefinitionHistory;
import io.metersphere.base.mapper.ApiDefinitionHistoryMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiDefinitionHistoryService {
@Resource
private ApiDefinitionHistoryMapper apiDefinitionHistoryMapper;
public List<ApiDefinitionHistory> selectByApiDefinitionId(String id){
return apiDefinitionHistoryMapper.selectByApiDefinitionId(id);
}
}

View File

@ -12,17 +12,22 @@ import io.metersphere.api.jmeter.TestResult;
import io.metersphere.api.parse.ApiImportParser;
import io.metersphere.api.parse.ApiImportParserFactory;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ApiDefinitionMapper;
import io.metersphere.base.mapper.ApiTestFileMapper;
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ext.ExtApiDefinitionMapper;
import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.i18n.Translator;
import io.metersphere.service.FileService;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.jorphan.collections.HashTree;
import org.aspectj.util.FileUtil;
import org.springframework.stereotype.Service;
@ -40,6 +45,8 @@ import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiDefinitionService {
@Resource
private ExtApiDefinitionMapper extApiDefinitionMapper;
@Resource
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
@ -49,9 +56,11 @@ public class ApiDefinitionService {
@Resource
private ApiTestCaseService apiTestCaseService;
@Resource
private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper;
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
@Resource
private JMeterService jMeterService;
@Resource
private SqlSessionFactory sqlSessionFactory;
private static Cache cache = Cache.newHardMemoryCache(0, 3600 * 24);
@ -59,10 +68,10 @@ public class ApiDefinitionService {
public List<ApiDefinitionResult> list(ApiDefinitionRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<ApiDefinitionResult> resList = apiDefinitionMapper.list(request);
List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request);
if (!resList.isEmpty()) {
List<String> ids = resList.stream().map(ApiDefinitionResult::getId).collect(Collectors.toList());
List<ApiComputeResult> results = apiDefinitionMapper.selectByIds(ids);
List<ApiComputeResult> results = extApiDefinitionMapper.selectByIds(ids);
Map<String, ApiComputeResult> resultMap = results.stream().collect(Collectors.toMap(ApiComputeResult::getApiDefinitionId, Function.identity()));
for (ApiDefinitionResult res : resList) {
ApiComputeResult compRes = resultMap.get(res.getId());
@ -121,7 +130,7 @@ public class ApiDefinitionService {
public void delete(String apiId) {
apiTestCaseService.deleteTestCase(apiId);
deleteFileByTestId(apiId);
apiDefinitionExecResultMapper.deleteByResourceId(apiId);
extApiDefinitionExecResultMapper.deleteByResourceId(apiId);
apiDefinitionMapper.deleteByPrimaryKey(apiId);
deleteBodyFiles(apiId);
}
@ -134,7 +143,7 @@ public class ApiDefinitionService {
}
public void removeToGc(List<String> apiIds) {
apiDefinitionMapper.removeToGc(apiIds);
extApiDefinitionMapper.removeToGc(apiIds);
}
public void deleteBodyFiles(String apiId) {
@ -148,12 +157,16 @@ public class ApiDefinitionService {
private void checkNameExist(SaveApiDefinitionRequest request) {
ApiDefinitionExample example = new ApiDefinitionExample();
if (request.getProtocol().equals(RequestType.HTTP)) {
example.createCriteria().andProtocolEqualTo(request.getProtocol()).andPathEqualTo(request.getPath()).andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
example.createCriteria().andMethodEqualTo(request.getMethod())
.andProtocolEqualTo(request.getProtocol()).andPathEqualTo(request.getPath())
.andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
if (apiDefinitionMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("api_definition_url_not_repeating"));
}
} else {
example.createCriteria().andProtocolEqualTo(request.getProtocol()).andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
example.createCriteria().andProtocolEqualTo(request.getProtocol())
.andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId())
.andIdNotEqualTo(request.getId());
if (apiDefinitionMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("load_test_already_exists"));
}
@ -163,7 +176,7 @@ public class ApiDefinitionService {
private ApiDefinition updateTest(SaveApiDefinitionRequest request) {
checkNameExist(request);
final ApiDefinition test = new ApiDefinition();
final ApiDefinitionWithBLOBs test = new ApiDefinitionWithBLOBs();
test.setId(request.getId());
test.setName(request.getName());
test.setPath(request.getPath());
@ -186,7 +199,7 @@ public class ApiDefinitionService {
private ApiDefinition createTest(SaveApiDefinitionRequest request) {
checkNameExist(request);
final ApiDefinition test = new ApiDefinition();
final ApiDefinitionWithBLOBs test = new ApiDefinitionWithBLOBs();
test.setId(request.getId());
test.setName(request.getName());
test.setProtocol(request.getProtocol());
@ -211,39 +224,27 @@ public class ApiDefinitionService {
return test;
}
private ApiDefinition createTest(ApiDefinitionResult request) {
private ApiDefinition createTest(ApiDefinitionResult request, ApiDefinitionMapper batchMapper) {
SaveApiDefinitionRequest saveReq = new SaveApiDefinitionRequest();
BeanUtils.copyBean(saveReq, request);
saveReq.setId(UUID.randomUUID().toString());
saveReq.setName(request.getName());
saveReq.setProtocol(request.getProtocol());
saveReq.setProjectId(request.getProjectId());
saveReq.setPath(request.getPath());
checkNameExist(saveReq);
final ApiDefinition test = new ApiDefinition();
test.setId(request.getId());
test.setName(request.getName());
test.setProtocol(request.getProtocol());
test.setMethod(request.getMethod());
test.setPath(request.getPath());
test.setModuleId(request.getModuleId());
test.setProjectId(request.getProjectId());
test.setRequest(request.getRequest());
final ApiDefinitionWithBLOBs test = new ApiDefinitionWithBLOBs();
BeanUtils.copyBean(test, request);
test.setCreateTime(System.currentTimeMillis());
test.setUpdateTime(System.currentTimeMillis());
test.setStatus(APITestStatus.Underway.name());
test.setModulePath(request.getModulePath());
test.setResponse(request.getResponse());
test.setEnvironmentId(request.getEnvironmentId());
if (request.getUserId() == null) {
test.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
} else {
test.setUserId(request.getUserId());
}
test.setDescription(request.getDescription());
apiDefinitionMapper.insert(test);
batchMapper.insert(test);
return test;
}
private void deleteFileByTestId(String apiId) {
ApiTestFileExample apiTestFileExample = new ApiTestFileExample();
apiTestFileExample.createCriteria().andTestIdEqualTo(apiId);
@ -306,7 +307,7 @@ public class ApiDefinitionService {
* @return
*/
public APIReportResult getDbResult(String testId) {
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByResourceId(testId);
ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectByResourceId(testId);
if (result == null) {
return null;
}
@ -330,15 +331,23 @@ public class ApiDefinitionService {
}
private void importApiTest(ApiTestImportRequest importRequest, ApiDefinitionImport apiImport) {
apiImport.getData().forEach(item -> {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ApiDefinitionMapper batchMapper = sqlSession.getMapper(ApiDefinitionMapper.class);
List<ApiDefinitionResult> data = apiImport.getData();
for (int i = 0; i < data.size(); i++) {
ApiDefinitionResult item = data.get(i);
item.setProjectId(importRequest.getProjectId());
item.setModuleId(importRequest.getModuleId());
item.setModulePath(importRequest.getModulePath());
item.setEnvironmentId(importRequest.getEnvironmentId());
item.setId(UUID.randomUUID().toString());
item.setUserId(null);
createTest(item);
});
createTest(item, batchMapper);
if (i % 300 == 0) {
sqlSession.flushStatements();
}
}
sqlSession.flushStatements();
}
}

View File

@ -10,6 +10,7 @@ import io.metersphere.base.domain.ApiModule;
import io.metersphere.base.domain.ApiModuleExample;
import io.metersphere.base.mapper.ApiDefinitionMapper;
import io.metersphere.base.mapper.ApiModuleMapper;
import io.metersphere.base.mapper.ext.ExtApiDefinitionMapper;
import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.BeanUtils;
@ -33,6 +34,9 @@ public class ApiModuleService {
ApiModuleMapper apiModuleMapper;
@Resource
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
private ExtApiDefinitionMapper extApiDefinitionMapper;
@Resource
SqlSessionFactory sqlSessionFactory;
@ -132,7 +136,7 @@ public class ApiModuleService {
private List<ApiDefinitionResult> queryByModuleIds(List<String> nodeIds) {
ApiDefinitionRequest apiDefinitionRequest = new ApiDefinitionRequest();
apiDefinitionRequest.setModuleIds(nodeIds);
return apiDefinitionMapper.list(apiDefinitionRequest);
return extApiDefinitionMapper.list(apiDefinitionRequest);
}
public int editNode(DragModuleRequest request) {

View File

@ -5,9 +5,10 @@ import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.ApiTestCaseResult;
import io.metersphere.api.dto.definition.SaveApiTestCaseRequest;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ApiTestCaseMapper;
import io.metersphere.base.mapper.ApiTestFileMapper;
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
@ -36,17 +37,19 @@ public class ApiTestCaseService {
@Resource
private ApiTestCaseMapper apiTestCaseMapper;
@Resource
private ExtApiTestCaseMapper extApiTestCaseMapper;
@Resource
private ApiTestFileMapper apiTestFileMapper;
@Resource
private FileService fileService;
@Resource
private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper;
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
public List<ApiTestCaseResult> list(ApiTestCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return apiTestCaseMapper.list(request);
return extApiTestCaseMapper.list(request);
}
public ApiTestCase get(String id) {
@ -99,7 +102,7 @@ public class ApiTestCaseService {
public void delete(String testId) {
deleteFileByTestId(testId);
apiDefinitionExecResultMapper.deleteByResourceId(testId);
extApiDefinitionExecResultMapper.deleteByResourceId(testId);
apiTestCaseMapper.deleteByPrimaryKey(testId);
deleteBodyFiles(testId);
}
@ -151,7 +154,7 @@ public class ApiTestCaseService {
private ApiTestCase updateTest(SaveApiTestCaseRequest request) {
checkNameExist(request);
final ApiTestCase test = new ApiTestCase();
final ApiTestCaseWithBLOBs test = new ApiTestCaseWithBLOBs();
test.setId(request.getId());
test.setName(request.getName());
test.setApiDefinitionId(request.getApiDefinitionId());
@ -169,7 +172,7 @@ public class ApiTestCaseService {
private ApiTestCase createTest(SaveApiTestCaseRequest request) {
request.setId(UUID.randomUUID().toString());
checkNameExist(request);
final ApiTestCase test = new ApiTestCase();
final ApiTestCaseWithBLOBs test = new ApiTestCaseWithBLOBs();
test.setId(request.getId());
test.setName(request.getName());
test.setApiDefinitionId(request.getApiDefinitionId());

View File

@ -14,29 +14,27 @@ public class ApiDefinition implements Serializable {
private String method;
private String path;
private String protocol;
private String environmentId;
private String status;
private String modulePath;
private String description;
private String userId;
private String environmentId;
private String schedule;
private String status;
private String moduleId;
private String modulePath;
private String userId;
private Long createTime;
private Long updateTime;
private String request;
private String protocol;
private String response;
private String path;
private static final long serialVersionUID = 1L;
}

View File

@ -159,11 +159,6 @@ public class ApiDefinitionExample {
return (Criteria) this;
}
public Criteria andModuleIdIn(List<String> values) {
addCriterion("module_id in", values, "module_id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
@ -250,83 +245,212 @@ public class ApiDefinitionExample {
}
public Criteria andNameIsNull() {
addCriterion("name is null");
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andPathEqualTo(String value) {
addCriterion("path =", value, "path");
return (Criteria) this;
}
public Criteria andProtocolEqualTo(String value) {
addCriterion("protocol =", value, "protocol");
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andMethodIsNull() {
addCriterion("`method` is null");
return (Criteria) this;
}
public Criteria andMethodIsNotNull() {
addCriterion("`method` is not null");
return (Criteria) this;
}
public Criteria andMethodEqualTo(String value) {
addCriterion("`method` =", value, "method");
return (Criteria) this;
}
public Criteria andMethodNotEqualTo(String value) {
addCriterion("`method` <>", value, "method");
return (Criteria) this;
}
public Criteria andMethodGreaterThan(String value) {
addCriterion("`method` >", value, "method");
return (Criteria) this;
}
public Criteria andMethodGreaterThanOrEqualTo(String value) {
addCriterion("`method` >=", value, "method");
return (Criteria) this;
}
public Criteria andMethodLessThan(String value) {
addCriterion("`method` <", value, "method");
return (Criteria) this;
}
public Criteria andMethodLessThanOrEqualTo(String value) {
addCriterion("`method` <=", value, "method");
return (Criteria) this;
}
public Criteria andMethodLike(String value) {
addCriterion("`method` like", value, "method");
return (Criteria) this;
}
public Criteria andMethodNotLike(String value) {
addCriterion("`method` not like", value, "method");
return (Criteria) this;
}
public Criteria andMethodIn(List<String> values) {
addCriterion("`method` in", values, "method");
return (Criteria) this;
}
public Criteria andMethodNotIn(List<String> values) {
addCriterion("`method` not in", values, "method");
return (Criteria) this;
}
public Criteria andMethodBetween(String value1, String value2) {
addCriterion("`method` between", value1, value2, "method");
return (Criteria) this;
}
public Criteria andMethodNotBetween(String value1, String value2) {
addCriterion("`method` not between", value1, value2, "method");
return (Criteria) this;
}
public Criteria andModulePathIsNull() {
addCriterion("module_path is null");
return (Criteria) this;
}
public Criteria andModulePathIsNotNull() {
addCriterion("module_path is not null");
return (Criteria) this;
}
public Criteria andModulePathEqualTo(String value) {
addCriterion("module_path =", value, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathNotEqualTo(String value) {
addCriterion("module_path <>", value, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathGreaterThan(String value) {
addCriterion("module_path >", value, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathGreaterThanOrEqualTo(String value) {
addCriterion("module_path >=", value, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathLessThan(String value) {
addCriterion("module_path <", value, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathLessThanOrEqualTo(String value) {
addCriterion("module_path <=", value, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathLike(String value) {
addCriterion("module_path like", value, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathNotLike(String value) {
addCriterion("module_path not like", value, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathIn(List<String> values) {
addCriterion("module_path in", values, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathNotIn(List<String> values) {
addCriterion("module_path not in", values, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathBetween(String value1, String value2) {
addCriterion("module_path between", value1, value2, "modulePath");
return (Criteria) this;
}
public Criteria andModulePathNotBetween(String value1, String value2) {
addCriterion("module_path not between", value1, value2, "modulePath");
return (Criteria) this;
}
@ -400,73 +524,283 @@ public class ApiDefinitionExample {
return (Criteria) this;
}
public Criteria andEnvironmentIdIsNull() {
addCriterion("environment_id is null");
return (Criteria) this;
}
public Criteria andEnvironmentIdIsNotNull() {
addCriterion("environment_id is not null");
return (Criteria) this;
}
public Criteria andEnvironmentIdEqualTo(String value) {
addCriterion("environment_id =", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotEqualTo(String value) {
addCriterion("environment_id <>", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdGreaterThan(String value) {
addCriterion("environment_id >", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdGreaterThanOrEqualTo(String value) {
addCriterion("environment_id >=", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLessThan(String value) {
addCriterion("environment_id <", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLessThanOrEqualTo(String value) {
addCriterion("environment_id <=", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLike(String value) {
addCriterion("environment_id like", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotLike(String value) {
addCriterion("environment_id not like", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdIn(List<String> values) {
addCriterion("environment_id in", values, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotIn(List<String> values) {
addCriterion("environment_id not in", values, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdBetween(String value1, String value2) {
addCriterion("environment_id between", value1, value2, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotBetween(String value1, String value2) {
addCriterion("environment_id not between", value1, value2, "environmentId");
return (Criteria) this;
}
public Criteria andScheduleIsNull() {
addCriterion("schedule is null");
return (Criteria) this;
}
public Criteria andScheduleIsNotNull() {
addCriterion("schedule is not null");
return (Criteria) this;
}
public Criteria andScheduleEqualTo(String value) {
addCriterion("schedule =", value, "schedule");
return (Criteria) this;
}
public Criteria andScheduleNotEqualTo(String value) {
addCriterion("schedule <>", value, "schedule");
return (Criteria) this;
}
public Criteria andScheduleGreaterThan(String value) {
addCriterion("schedule >", value, "schedule");
return (Criteria) this;
}
public Criteria andScheduleGreaterThanOrEqualTo(String value) {
addCriterion("schedule >=", value, "schedule");
return (Criteria) this;
}
public Criteria andScheduleLessThan(String value) {
addCriterion("schedule <", value, "schedule");
return (Criteria) this;
}
public Criteria andScheduleLessThanOrEqualTo(String value) {
addCriterion("schedule <=", value, "schedule");
return (Criteria) this;
}
public Criteria andScheduleLike(String value) {
addCriterion("schedule like", value, "schedule");
return (Criteria) this;
}
public Criteria andScheduleNotLike(String value) {
addCriterion("schedule not like", value, "schedule");
return (Criteria) this;
}
public Criteria andScheduleIn(List<String> values) {
addCriterion("schedule in", values, "schedule");
return (Criteria) this;
}
public Criteria andScheduleNotIn(List<String> values) {
addCriterion("schedule not in", values, "schedule");
return (Criteria) this;
}
public Criteria andScheduleBetween(String value1, String value2) {
addCriterion("schedule between", value1, value2, "schedule");
return (Criteria) this;
}
public Criteria andScheduleNotBetween(String value1, String value2) {
addCriterion("schedule not between", value1, value2, "schedule");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("status =", value, "status");
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("status <>", value, "status");
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("status >", value, "status");
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("status >=", value, "status");
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("status <", value, "status");
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("status <=", value, "status");
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("status like", value, "status");
addCriterion("`status` like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("status not like", value, "status");
addCriterion("`status` not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("status in", values, "status");
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("status not in", values, "status");
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("status between", value1, value2, "status");
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("status not between", value1, value2, "status");
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andModuleIdIsNull() {
addCriterion("module_id is null");
return (Criteria) this;
}
public Criteria andModuleIdIsNotNull() {
addCriterion("module_id is not null");
return (Criteria) this;
}
public Criteria andModuleIdEqualTo(String value) {
addCriterion("module_id =", value, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdNotEqualTo(String value) {
addCriterion("module_id <>", value, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdGreaterThan(String value) {
addCriterion("module_id >", value, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdGreaterThanOrEqualTo(String value) {
addCriterion("module_id >=", value, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdLessThan(String value) {
addCriterion("module_id <", value, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdLessThanOrEqualTo(String value) {
addCriterion("module_id <=", value, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdLike(String value) {
addCriterion("module_id like", value, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdNotLike(String value) {
addCriterion("module_id not like", value, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdIn(List<String> values) {
addCriterion("module_id in", values, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdNotIn(List<String> values) {
addCriterion("module_id not in", values, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdBetween(String value1, String value2) {
addCriterion("module_id between", value1, value2, "moduleId");
return (Criteria) this;
}
public Criteria andModuleIdNotBetween(String value1, String value2) {
addCriterion("module_id not between", value1, value2, "moduleId");
return (Criteria) this;
}
@ -659,6 +993,146 @@ public class ApiDefinitionExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andProtocolIsNull() {
addCriterion("protocol is null");
return (Criteria) this;
}
public Criteria andProtocolIsNotNull() {
addCriterion("protocol is not null");
return (Criteria) this;
}
public Criteria andProtocolEqualTo(String value) {
addCriterion("protocol =", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotEqualTo(String value) {
addCriterion("protocol <>", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThan(String value) {
addCriterion("protocol >", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThanOrEqualTo(String value) {
addCriterion("protocol >=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThan(String value) {
addCriterion("protocol <", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThanOrEqualTo(String value) {
addCriterion("protocol <=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLike(String value) {
addCriterion("protocol like", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotLike(String value) {
addCriterion("protocol not like", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolIn(List<String> values) {
addCriterion("protocol in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotIn(List<String> values) {
addCriterion("protocol not in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolBetween(String value1, String value2) {
addCriterion("protocol between", value1, value2, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotBetween(String value1, String value2) {
addCriterion("protocol not between", value1, value2, "protocol");
return (Criteria) this;
}
public Criteria andPathIsNull() {
addCriterion("`path` is null");
return (Criteria) this;
}
public Criteria andPathIsNotNull() {
addCriterion("`path` is not null");
return (Criteria) this;
}
public Criteria andPathEqualTo(String value) {
addCriterion("`path` =", value, "path");
return (Criteria) this;
}
public Criteria andPathNotEqualTo(String value) {
addCriterion("`path` <>", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThan(String value) {
addCriterion("`path` >", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThanOrEqualTo(String value) {
addCriterion("`path` >=", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThan(String value) {
addCriterion("`path` <", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThanOrEqualTo(String value) {
addCriterion("`path` <=", value, "path");
return (Criteria) this;
}
public Criteria andPathLike(String value) {
addCriterion("`path` like", value, "path");
return (Criteria) this;
}
public Criteria andPathNotLike(String value) {
addCriterion("`path` not like", value, "path");
return (Criteria) this;
}
public Criteria andPathIn(List<String> values) {
addCriterion("`path` in", values, "path");
return (Criteria) this;
}
public Criteria andPathNotIn(List<String> values) {
addCriterion("`path` not in", values, "path");
return (Criteria) this;
}
public Criteria andPathBetween(String value1, String value2) {
addCriterion("`path` between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andPathNotBetween(String value1, String value2) {
addCriterion("`path` not between", value1, value2, "path");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -7,12 +7,20 @@ import java.io.Serializable;
@Data
public class ApiDefinitionExecResult implements Serializable {
private String id;
private String resourceId;
private String name;
private String content;
private String resourceId;
private String status;
private String userId;
private Long startTime;
private Long endTime;
}
private String content;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,670 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiDefinitionExecResultExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiDefinitionExecResultExample() {
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 andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andResourceIdIsNull() {
addCriterion("resource_id is null");
return (Criteria) this;
}
public Criteria andResourceIdIsNotNull() {
addCriterion("resource_id is not null");
return (Criteria) this;
}
public Criteria andResourceIdEqualTo(String value) {
addCriterion("resource_id =", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotEqualTo(String value) {
addCriterion("resource_id <>", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdGreaterThan(String value) {
addCriterion("resource_id >", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
addCriterion("resource_id >=", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdLessThan(String value) {
addCriterion("resource_id <", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdLessThanOrEqualTo(String value) {
addCriterion("resource_id <=", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdLike(String value) {
addCriterion("resource_id like", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotLike(String value) {
addCriterion("resource_id not like", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdIn(List<String> values) {
addCriterion("resource_id in", values, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotIn(List<String> values) {
addCriterion("resource_id not in", values, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdBetween(String value1, String value2) {
addCriterion("resource_id between", value1, value2, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotBetween(String value1, String value2) {
addCriterion("resource_id not between", value1, value2, "resourceId");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("`status` like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("`status` not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andStartTimeIsNull() {
addCriterion("start_time is null");
return (Criteria) this;
}
public Criteria andStartTimeIsNotNull() {
addCriterion("start_time is not null");
return (Criteria) this;
}
public Criteria andStartTimeEqualTo(Long value) {
addCriterion("start_time =", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotEqualTo(Long value) {
addCriterion("start_time <>", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThan(Long value) {
addCriterion("start_time >", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThanOrEqualTo(Long value) {
addCriterion("start_time >=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThan(Long value) {
addCriterion("start_time <", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThanOrEqualTo(Long value) {
addCriterion("start_time <=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeIn(List<Long> values) {
addCriterion("start_time in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotIn(List<Long> values) {
addCriterion("start_time not in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeBetween(Long value1, Long value2) {
addCriterion("start_time between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotBetween(Long value1, Long value2) {
addCriterion("start_time not between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andEndTimeIsNull() {
addCriterion("end_time is null");
return (Criteria) this;
}
public Criteria andEndTimeIsNotNull() {
addCriterion("end_time is not null");
return (Criteria) this;
}
public Criteria andEndTimeEqualTo(Long value) {
addCriterion("end_time =", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotEqualTo(Long value) {
addCriterion("end_time <>", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThan(Long value) {
addCriterion("end_time >", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("end_time >=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThan(Long value) {
addCriterion("end_time <", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThanOrEqualTo(Long value) {
addCriterion("end_time <=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeIn(List<Long> values) {
addCriterion("end_time in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotIn(List<Long> values) {
addCriterion("end_time not in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeBetween(Long value1, Long value2) {
addCriterion("end_time between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotBetween(Long value1, Long value2) {
addCriterion("end_time not between", value1, value2, "endTime");
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

@ -1,22 +0,0 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiDefinitionHistory implements Serializable {
private String id;
private String apiDefinitionId;
private String content;
private String userId;
private Long createTime;
private Long updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ApiDefinitionWithBLOBs extends ApiDefinition implements Serializable {
private String request;
private String response;
private static final long serialVersionUID = 1L;
}

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiModule implements Serializable {
@ -12,12 +11,12 @@ public class ApiModule implements Serializable {
private String name;
private String protocol;
private String parentId;
private Integer level;
private String protocol;
private Long createTime;
private Long updateTime;

View File

@ -189,12 +189,6 @@ public class ApiModuleExample {
return (Criteria) this;
}
public Criteria andProtocolEqualTo(String value) {
addCriterion("protocol =", value, "protocol");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
@ -251,72 +245,142 @@ public class ApiModuleExample {
}
public Criteria andNameIsNull() {
addCriterion("name is null");
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andProtocolIsNull() {
addCriterion("protocol is null");
return (Criteria) this;
}
public Criteria andProtocolIsNotNull() {
addCriterion("protocol is not null");
return (Criteria) this;
}
public Criteria andProtocolEqualTo(String value) {
addCriterion("protocol =", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotEqualTo(String value) {
addCriterion("protocol <>", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThan(String value) {
addCriterion("protocol >", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThanOrEqualTo(String value) {
addCriterion("protocol >=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThan(String value) {
addCriterion("protocol <", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThanOrEqualTo(String value) {
addCriterion("protocol <=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLike(String value) {
addCriterion("protocol like", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotLike(String value) {
addCriterion("protocol not like", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolIn(List<String> values) {
addCriterion("protocol in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotIn(List<String> values) {
addCriterion("protocol not in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolBetween(String value1, String value2) {
addCriterion("protocol between", value1, value2, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotBetween(String value1, String value2) {
addCriterion("protocol not between", value1, value2, "protocol");
return (Criteria) this;
}
@ -391,62 +455,62 @@ public class ApiModuleExample {
}
public Criteria andLevelIsNull() {
addCriterion("level is null");
addCriterion("`level` is null");
return (Criteria) this;
}
public Criteria andLevelIsNotNull() {
addCriterion("level is not null");
addCriterion("`level` is not null");
return (Criteria) this;
}
public Criteria andLevelEqualTo(Integer value) {
addCriterion("level =", value, "level");
addCriterion("`level` =", value, "level");
return (Criteria) this;
}
public Criteria andLevelNotEqualTo(Integer value) {
addCriterion("level <>", value, "level");
addCriterion("`level` <>", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThan(Integer value) {
addCriterion("level >", value, "level");
addCriterion("`level` >", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThanOrEqualTo(Integer value) {
addCriterion("level >=", value, "level");
addCriterion("`level` >=", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThan(Integer value) {
addCriterion("level <", value, "level");
addCriterion("`level` <", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThanOrEqualTo(Integer value) {
addCriterion("level <=", value, "level");
addCriterion("`level` <=", value, "level");
return (Criteria) this;
}
public Criteria andLevelIn(List<Integer> values) {
addCriterion("level in", values, "level");
addCriterion("`level` in", values, "level");
return (Criteria) this;
}
public Criteria andLevelNotIn(List<Integer> values) {
addCriterion("level not in", values, "level");
addCriterion("`level` not in", values, "level");
return (Criteria) this;
}
public Criteria andLevelBetween(Integer value1, Integer value2) {
addCriterion("level between", value1, value2, "level");
addCriterion("`level` between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andLevelNotBetween(Integer value1, Integer value2) {
addCriterion("level not between", value1, value2, "level");
addCriterion("`level` not between", value1, value2, "level");
return (Criteria) this;
}

View File

@ -18,10 +18,6 @@ public class ApiTestCase implements Serializable {
private String description;
private String request;
private String response;
private String createUserId;
private String updateUserId;

View File

@ -159,11 +159,6 @@ public class ApiTestCaseExample {
return (Criteria) this;
}
public Criteria andModuleIdIn(List<String> values) {
addCriterion("module_id in", values, "module_id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
@ -194,12 +189,6 @@ public class ApiTestCaseExample {
return (Criteria) this;
}
public Criteria andApiDefinitionIdEqualTo(String value) {
addCriterion("api_definition_id =", value, "api_definition_id");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
@ -256,72 +245,212 @@ public class ApiTestCaseExample {
}
public Criteria andNameIsNull() {
addCriterion("name is null");
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andPriorityIsNull() {
addCriterion("priority is null");
return (Criteria) this;
}
public Criteria andPriorityIsNotNull() {
addCriterion("priority is not null");
return (Criteria) this;
}
public Criteria andPriorityEqualTo(String value) {
addCriterion("priority =", value, "priority");
return (Criteria) this;
}
public Criteria andPriorityNotEqualTo(String value) {
addCriterion("priority <>", value, "priority");
return (Criteria) this;
}
public Criteria andPriorityGreaterThan(String value) {
addCriterion("priority >", value, "priority");
return (Criteria) this;
}
public Criteria andPriorityGreaterThanOrEqualTo(String value) {
addCriterion("priority >=", value, "priority");
return (Criteria) this;
}
public Criteria andPriorityLessThan(String value) {
addCriterion("priority <", value, "priority");
return (Criteria) this;
}
public Criteria andPriorityLessThanOrEqualTo(String value) {
addCriterion("priority <=", value, "priority");
return (Criteria) this;
}
public Criteria andPriorityLike(String value) {
addCriterion("priority like", value, "priority");
return (Criteria) this;
}
public Criteria andPriorityNotLike(String value) {
addCriterion("priority not like", value, "priority");
return (Criteria) this;
}
public Criteria andPriorityIn(List<String> values) {
addCriterion("priority in", values, "priority");
return (Criteria) this;
}
public Criteria andPriorityNotIn(List<String> values) {
addCriterion("priority not in", values, "priority");
return (Criteria) this;
}
public Criteria andPriorityBetween(String value1, String value2) {
addCriterion("priority between", value1, value2, "priority");
return (Criteria) this;
}
public Criteria andPriorityNotBetween(String value1, String value2) {
addCriterion("priority not between", value1, value2, "priority");
return (Criteria) this;
}
public Criteria andApiDefinitionIdIsNull() {
addCriterion("api_definition_id is null");
return (Criteria) this;
}
public Criteria andApiDefinitionIdIsNotNull() {
addCriterion("api_definition_id is not null");
return (Criteria) this;
}
public Criteria andApiDefinitionIdEqualTo(String value) {
addCriterion("api_definition_id =", value, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdNotEqualTo(String value) {
addCriterion("api_definition_id <>", value, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdGreaterThan(String value) {
addCriterion("api_definition_id >", value, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdGreaterThanOrEqualTo(String value) {
addCriterion("api_definition_id >=", value, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdLessThan(String value) {
addCriterion("api_definition_id <", value, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdLessThanOrEqualTo(String value) {
addCriterion("api_definition_id <=", value, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdLike(String value) {
addCriterion("api_definition_id like", value, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdNotLike(String value) {
addCriterion("api_definition_id not like", value, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdIn(List<String> values) {
addCriterion("api_definition_id in", values, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdNotIn(List<String> values) {
addCriterion("api_definition_id not in", values, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdBetween(String value1, String value2) {
addCriterion("api_definition_id between", value1, value2, "apiDefinitionId");
return (Criteria) this;
}
public Criteria andApiDefinitionIdNotBetween(String value1, String value2) {
addCriterion("api_definition_id not between", value1, value2, "apiDefinitionId");
return (Criteria) this;
}
@ -395,143 +524,143 @@ public class ApiTestCaseExample {
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
public Criteria andCreateUserIdIsNull() {
addCriterion("create_user_id is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
public Criteria andCreateUserIdIsNotNull() {
addCriterion("create_user_id is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("status =", value, "status");
public Criteria andCreateUserIdEqualTo(String value) {
addCriterion("create_user_id =", value, "createUserId");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("status <>", value, "status");
public Criteria andCreateUserIdNotEqualTo(String value) {
addCriterion("create_user_id <>", value, "createUserId");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("status >", value, "status");
public Criteria andCreateUserIdGreaterThan(String value) {
addCriterion("create_user_id >", value, "createUserId");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("status >=", value, "status");
public Criteria andCreateUserIdGreaterThanOrEqualTo(String value) {
addCriterion("create_user_id >=", value, "createUserId");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("status <", value, "status");
public Criteria andCreateUserIdLessThan(String value) {
addCriterion("create_user_id <", value, "createUserId");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("status <=", value, "status");
public Criteria andCreateUserIdLessThanOrEqualTo(String value) {
addCriterion("create_user_id <=", value, "createUserId");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("status like", value, "status");
public Criteria andCreateUserIdLike(String value) {
addCriterion("create_user_id like", value, "createUserId");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("status not like", value, "status");
public Criteria andCreateUserIdNotLike(String value) {
addCriterion("create_user_id not like", value, "createUserId");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("status in", values, "status");
public Criteria andCreateUserIdIn(List<String> values) {
addCriterion("create_user_id in", values, "createUserId");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("status not in", values, "status");
public Criteria andCreateUserIdNotIn(List<String> values) {
addCriterion("create_user_id not in", values, "createUserId");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("status between", value1, value2, "status");
public Criteria andCreateUserIdBetween(String value1, String value2) {
addCriterion("create_user_id between", value1, value2, "createUserId");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("status not between", value1, value2, "status");
public Criteria andCreateUserIdNotBetween(String value1, String value2) {
addCriterion("create_user_id not between", value1, value2, "createUserId");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
public Criteria andUpdateUserIdIsNull() {
addCriterion("update_user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
public Criteria andUpdateUserIdIsNotNull() {
addCriterion("update_user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
public Criteria andUpdateUserIdEqualTo(String value) {
addCriterion("update_user_id =", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
public Criteria andUpdateUserIdNotEqualTo(String value) {
addCriterion("update_user_id <>", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
public Criteria andUpdateUserIdGreaterThan(String value) {
addCriterion("update_user_id >", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
public Criteria andUpdateUserIdGreaterThanOrEqualTo(String value) {
addCriterion("update_user_id >=", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
public Criteria andUpdateUserIdLessThan(String value) {
addCriterion("update_user_id <", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
public Criteria andUpdateUserIdLessThanOrEqualTo(String value) {
addCriterion("update_user_id <=", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
public Criteria andUpdateUserIdLike(String value) {
addCriterion("update_user_id like", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
public Criteria andUpdateUserIdNotLike(String value) {
addCriterion("update_user_id not like", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
public Criteria andUpdateUserIdIn(List<String> values) {
addCriterion("update_user_id in", values, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
public Criteria andUpdateUserIdNotIn(List<String> values) {
addCriterion("update_user_id not in", values, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
public Criteria andUpdateUserIdBetween(String value1, String value2) {
addCriterion("update_user_id between", value1, value2, "updateUserId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
public Criteria andUpdateUserIdNotBetween(String value1, String value2) {
addCriterion("update_user_id not between", value1, value2, "updateUserId");
return (Criteria) this;
}

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ApiTestCaseWithBLOBs extends ApiTestCase implements Serializable {
private String request;
private String response;
private static final long serialVersionUID = 1L;
}

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class MessageTask implements Serializable {

View File

@ -1,15 +1,37 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiDefinitionExecResult;
import io.metersphere.base.domain.ApiDefinitionExecResultExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ApiDefinitionExecResultMapper {
long countByExample(ApiDefinitionExecResultExample example);
int deleteByResourceId(String id);
int deleteByExample(ApiDefinitionExecResultExample example);
int deleteByPrimaryKey(String id);
int insert(ApiDefinitionExecResult record);
ApiDefinitionExecResult selectByResourceId(String resourceId);
int insertSelective(ApiDefinitionExecResult record);
List<ApiDefinitionExecResult> selectByExampleWithBLOBs(ApiDefinitionExecResultExample example);
List<ApiDefinitionExecResult> selectByExample(ApiDefinitionExecResultExample example);
ApiDefinitionExecResult selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiDefinitionExecResult record, @Param("example") ApiDefinitionExecResultExample example);
int updateByExampleWithBLOBs(@Param("record") ApiDefinitionExecResult record, @Param("example") ApiDefinitionExecResultExample example);
int updateByExample(@Param("record") ApiDefinitionExecResult record, @Param("example") ApiDefinitionExecResultExample example);
int updateByPrimaryKeySelective(ApiDefinitionExecResult record);
int updateByPrimaryKeyWithBLOBs(ApiDefinitionExecResult record);
int updateByPrimaryKey(ApiDefinitionExecResult record);
}

View File

@ -1,27 +1,304 @@
<?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.ApiDefinitionExecResultMapper">
<delete id="deleteByResourceId" parameterType="java.lang.String">
delete from api_definition_exec_result where resource_id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
insert into api_definition_exec_result
(id, resource_id,name,content, status, user_id, start_time, end_time)
values
(#{id,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}, #{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT})
</insert>
<select id="selectByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
select * from api_definition_exec_result
where resource_id = #{resourceId,jdbcType=VARCHAR}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
select * from api_definition_exec_result
where id = #{id,jdbcType=VARCHAR}
</select>
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiDefinitionExecResult">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="start_time" jdbcType="BIGINT" property="startTime" />
<result column="end_time" jdbcType="BIGINT" property="endTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionExecResult">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</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, `name`, resource_id, `status`, user_id, start_time, end_time
</sql>
<sql id="Blob_Column_List">
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiDefinitionExecResultExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from api_definition_exec_result
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExecResultExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_definition_exec_result
<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="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from api_definition_exec_result
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_definition_exec_result
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExecResultExample">
delete from api_definition_exec_result
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
insert into api_definition_exec_result (id, `name`, resource_id,
`status`, user_id, start_time,
end_time, content)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
#{endTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
insert into api_definition_exec_result
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
`name`,
</if>
<if test="resourceId != null">
resource_id,
</if>
<if test="status != null">
`status`,
</if>
<if test="userId != null">
user_id,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="resourceId != null">
#{resourceId,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
#{endTime,jdbcType=BIGINT},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExecResultExample" resultType="java.lang.Long">
select count(*) from api_definition_exec_result
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_definition_exec_result
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.resourceId != null">
resource_id = #{record.resourceId,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=BIGINT},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=BIGINT},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update api_definition_exec_result
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_definition_exec_result
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
update api_definition_exec_result
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="resourceId != null">
resource_id = #{resourceId,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=BIGINT},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
update api_definition_exec_result
set `name` = #{name,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
update api_definition_exec_result
set `name` = #{name,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -1,15 +0,0 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiDefinitionHistory;
import java.util.List;
public interface ApiDefinitionHistoryMapper {
int deleteByApiDefinitionId(String id);
int insert(ApiDefinitionHistory record);
List<ApiDefinitionHistory> selectByApiDefinitionId(String id);
}

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ApiDefinitionHistoryMapper">
<delete id="deleteByApiDefinitionId" parameterType="java.lang.String">
delete from api_definition_history where api_definition_id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionHistory">
insert into api_definition_history
(id, api_definition_id,content, user_id, create_time, update_time)
values
(#{id,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
</insert>
<select id="selectByApiDefinitionId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionHistory">
select * from api_definition_history where api_definition_id = #{id,jdbcType=VARCHAR}
</select>
</mapper>

View File

@ -1,42 +1,38 @@
package io.metersphere.base.mapper;
import io.metersphere.api.dto.definition.ApiComputeResult;
import io.metersphere.api.dto.definition.ApiDefinitionRequest;
import io.metersphere.api.dto.definition.ApiDefinitionResult;
import io.metersphere.base.domain.ApiDefinition;
import io.metersphere.base.domain.ApiDefinitionExample;
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ApiDefinitionMapper {
List<ApiDefinitionResult> list(@Param("request") ApiDefinitionRequest request);
List<ApiComputeResult> selectByIds(@Param("ids") List<String> ids);
long countByExample(ApiDefinitionExample example);
int deleteByExample(ApiDefinitionExample example);
int deleteByPrimaryKey(String id);
int insert(ApiDefinition record);
int insert(ApiDefinitionWithBLOBs record);
int insertSelective(ApiDefinitionWithBLOBs record);
List<ApiDefinition> selectByExampleWithBLOBs(ApiDefinitionExample example);
List<ApiDefinitionWithBLOBs> selectByExampleWithBLOBs(ApiDefinitionExample example);
List<ApiDefinition> selectByExample(ApiDefinitionExample example);
ApiDefinition selectByPrimaryKey(String id);
ApiDefinitionWithBLOBs selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiDefinitionWithBLOBs record, @Param("example") ApiDefinitionExample example);
int updateByPrimaryKeySelective(ApiDefinition record);
int updateByExampleWithBLOBs(@Param("record") ApiDefinitionWithBLOBs record, @Param("example") ApiDefinitionExample example);
int updateByPrimaryKeyWithBLOBs(ApiDefinition record);
int updateByExample(@Param("record") ApiDefinition record, @Param("example") ApiDefinitionExample example);
int updateByPrimaryKeySelective(ApiDefinitionWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(ApiDefinitionWithBLOBs record);
int updateByPrimaryKey(ApiDefinition record);
int removeToGc(@Param("ids") List<String> ids);
}

View File

@ -1,417 +1,462 @@
<?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.ApiDefinitionMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiDefinition">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
<result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
<result column="module_path" jdbcType="VARCHAR" property="modulePath"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="protocol" jdbcType="VARCHAR" property="protocol"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="method" jdbcType="VARCHAR" property="method"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinition">
<result column="request" jdbcType="LONGVARCHAR" property="request"/>
<result column="response" jdbcType="LONGVARCHAR" property="response"/>
</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>
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiDefinition">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="method" jdbcType="VARCHAR" property="method" />
<result column="module_path" jdbcType="VARCHAR" property="modulePath" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
<result column="schedule" jdbcType="VARCHAR" property="schedule" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
<result column="path" jdbcType="VARCHAR" property="path" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
<result column="request" jdbcType="LONGVARCHAR" property="request" />
<result column="response" jdbcType="LONGVARCHAR" property="response" />
</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>
</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, project_id, name,module_id,module_path,protocol ,path,method ,description, status, user_id, create_time, update_time
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Blob_Column_List">
request
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiDefinitionExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from api_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByIds" resultType="io.metersphere.api.dto.definition.ApiComputeResult">
select t1.api_definition_id apiDefinitionId,count(t1.id) caseTotal,
case t2.status
when 'success' then '通过'
when 'error' then '未通过'
ELSE '未执行' end as status ,
CONCAT(FORMAT(SUM(IF(t2.`status` = 'success', 1, 0))/ COUNT(t1.id)*100, 2), '%') passRate
from api_test_case t1 left join api_definition_exec_result t2 on t1.id = t2.resource_id
group by t1.api_definition_id having t1.api_definition_id in
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
order by t2.end_time desc;
</select>
<sql id="combine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and api_definition.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and api_definition.update_time
<include refid="condition">
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.projectName != null">
and project.name
<include refid="condition">
<property name="object" value="${condition}.projectName"/>
</include>
</if>
<if test="${condition}.createTime != null">
and api_definition.create_time
<include refid="condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.status != null">
and api_definition.status
<include refid="condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test="${condition}.creator != null">
and api_definition.user_id
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
select api_definition.id, api_definition.project_id,
api_definition.name,api_definition.protocol,api_definition.path,api_definition.module_id,api_definition.module_path,api_definition.method,
api_definition.description,api_definition.request,api_definition.response,api_definition.environment_id,
api_definition.status, api_definition.user_id, api_definition.create_time, api_definition.update_time, project.name as
project_name, user.name as user_name
from api_definition
left join project on api_definition.project_id = project.id
left join user on api_definition.user_id = user.id
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and api_definition.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.protocol != null">
AND api_definition.protocol = #{request.protocol}
</if>
<if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId}
</if>
<if test="request.projectId != null">
AND project.id = #{request.projectId}
</if>
<if test="request.id != null">
AND api_definition.id = #{request.id}
</if>
<if test="request.userId != null">
AND api_definition.user_id = #{request.userId}
</if>
<if test="request.moduleId != null">
AND api_definition.module_id = #{request.moduleId}
</if>
<if test="request.projectId != null">
AND api_definition.project_id = #{request.projectId}
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
AND api_definition.module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</if>
<if test="request.filters != null and request.filters.size() > 0">
and api_definition.status in
<foreach collection="request.filters" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
api_definition.${order.name} ${order.type}
<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>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from api_definition
<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="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from api_definition
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, `method`, module_path, description, environment_id, schedule,
`status`, module_id, user_id, create_time, update_time, protocol, `path`
</sql>
<sql id="Blob_Column_List">
request, response
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiDefinitionExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from api_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_definition
<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="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from api_definition
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_definition
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample">
delete from api_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinition">
insert into api_definition (id, project_id, name, protocol,path,module_id,module_path,method,
description, status, user_id,create_time, update_time, request,response,environment_id )
values
(#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR},#{path,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},#{modulePath,jdbcType=VARCHAR},#{method,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{request,jdbcType=LONGVARCHAR},#{response,jdbcType=LONGVARCHAR},#{environmentId,jdbcType=VARCHAR}
)
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample"
resultType="java.lang.Long">
select count(*) from api_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiDefinition">
update api_definition
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
protocol = #{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
path = #{path,jdbcType=VARCHAR},
</if>
<if test="method != null">
method = #{method,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
module_path = #{modulePath,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="request != null">
request = #{request,jdbcType=LONGVARCHAR},
</if>
<if test="response != null">
response = #{response,jdbcType=LONGVARCHAR},
</if>
<if test="environmentId != null">
environment_id = #{environmentId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiDefinition">
update api_definition
set project_id = #{projectId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
path = #{path,jdbcType=VARCHAR},
method = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
request = #{request,jdbcType=LONGVARCHAR},
response = #{response,jdbcType=LONGVARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample">
delete from api_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition (id, project_id, `name`,
`method`, module_path, description,
environment_id, schedule, `status`,
module_id, user_id, create_time,
update_time, protocol, `path`,
request, response)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{environmentId,jdbcType=VARCHAR}, #{schedule,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{moduleId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR},
#{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="method != null">
`method`,
</if>
<if test="modulePath != null">
module_path,
</if>
<if test="description != null">
description,
</if>
<if test="environmentId != null">
environment_id,
</if>
<if test="schedule != null">
schedule,
</if>
<if test="status != null">
`status`,
</if>
<if test="moduleId != null">
module_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="protocol != null">
protocol,
</if>
<if test="path != null">
`path`,
</if>
<if test="request != null">
request,
</if>
<if test="response != null">
response,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="method != null">
#{method,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
#{modulePath,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="environmentId != null">
#{environmentId,jdbcType=VARCHAR},
</if>
<if test="schedule != null">
#{schedule,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="protocol != null">
#{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
<if test="request != null">
#{request,jdbcType=LONGVARCHAR},
</if>
<if test="response != null">
#{response,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample" resultType="java.lang.Long">
select count(*) from api_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_definition
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.method != null">
`method` = #{record.method,jdbcType=VARCHAR},
</if>
<if test="record.modulePath != null">
module_path = #{record.modulePath,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.environmentId != null">
environment_id = #{record.environmentId,jdbcType=VARCHAR},
</if>
<if test="record.schedule != null">
schedule = #{record.schedule,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.moduleId != null">
module_id = #{record.moduleId,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.protocol != null">
protocol = #{record.protocol,jdbcType=VARCHAR},
</if>
<if test="record.path != null">
`path` = #{record.path,jdbcType=VARCHAR},
</if>
<if test="record.request != null">
request = #{record.request,jdbcType=LONGVARCHAR},
</if>
<if test="record.response != null">
response = #{record.response,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiDefinition">
update api_definition
set project_id = #{projectId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
path = #{path,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
method = #{method,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
<update id="updateByExampleWithBLOBs" parameterType="map">
update api_definition
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`method` = #{record.method,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
schedule = #{record.schedule,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
module_id = #{record.moduleId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
protocol = #{record.protocol,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR},
request = #{record.request,jdbcType=LONGVARCHAR},
response = #{record.response,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_definition
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`method` = #{record.method,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
schedule = #{record.schedule,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
module_id = #{record.moduleId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
protocol = #{record.protocol,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
update api_definition
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="method != null">
`method` = #{method,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
module_path = #{modulePath,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="environmentId != null">
environment_id = #{environmentId,jdbcType=VARCHAR},
</if>
<if test="schedule != null">
schedule = #{schedule,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="protocol != null">
protocol = #{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
<if test="request != null">
request = #{request,jdbcType=LONGVARCHAR},
</if>
<if test="response != null">
response = #{response,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
update api_definition
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR},
schedule = #{schedule,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
request = #{request,jdbcType=LONGVARCHAR},
response = #{response,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiDefinition">
update api_definition
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR},
schedule = #{schedule,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="removeToGc">
update api_definition
set
status = 'Trash'
where id in
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</update>
</mapper>

View File

@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ApiModuleMapper {
long countByExample(ApiModuleExample example);
int deleteByExample(ApiModuleExample example);
@ -16,8 +15,6 @@ public interface ApiModuleMapper {
int insert(ApiModule record);
int insertBatch(@Param("records") List<ApiModule> records);
int insertSelective(ApiModule record);
List<ApiModule> selectByExample(ApiModuleExample example);

View File

@ -1,273 +1,258 @@
<?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.ApiModuleMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiModule">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="parent_id" jdbcType="VARCHAR" property="parentId"/>
<result column="level" jdbcType="INTEGER" property="level"/>
<result column="protocol" jdbcType="VARCHAR" property="protocol"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiModule">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</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, project_id, name, parent_id, level, create_time, update_time
</trim>
</if>
</foreach>
</where>
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseNodeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
<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>
<include refid="Base_Column_List"/>
from api_module
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_module
where id = #{id,jdbcType=VARCHAR}
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, protocol, parent_id, `level`, create_time, update_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiModuleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_module
<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_module
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_module
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseNodeExample">
delete from api_module
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insertBatch" parameterType="io.metersphere.base.domain.ApiModule">
insert into api_module (id, project_id, name,protocol
parent_id, level, create_time,
update_time)
values
<foreach collection="records" item="emp" separator=",">
(#{emp.id,jdbcType=VARCHAR}, #{emp.projectId,jdbcType=VARCHAR},
#{emp.name,jdbcType=VARCHAR},#{emp.protocol,jdbcType=VARCHAR},
#{emp.parentId,jdbcType=VARCHAR}, #{emp.level,jdbcType=INTEGER}, #{emp.createTime,jdbcType=BIGINT},
#{emp.updateTime,jdbcType=BIGINT})
</foreach>
</insert>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiModule">
insert into api_module (id, project_id, name,protocol
parent_id, level, create_time,
update_time)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},#{protocol,jdbcType=VARCHAR},
#{parentId,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT})
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiModuleExample">
delete from api_module
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiModule">
insert into api_module (id, project_id, `name`,
protocol, parent_id, `level`,
create_time, update_time)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{protocol,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiModule">
insert into api_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="name != null">
name,
</if>
<if test="protocol != null">
protocol,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="level != null">
level,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
#{protocol,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=VARCHAR},
</if>
<if test="level != null">
#{level,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseNodeExample"
resultType="java.lang.Long">
select count(*) from api_module
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_module
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.protocol != null">
protocol = #{record.protocol,jdbcType=VARCHAR},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=VARCHAR},
</if>
<if test="record.level != null">
level = #{record.level,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_module
set id = #{record.id,jdbcType=VARCHAR},
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiModule">
insert into api_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="protocol != null">
protocol,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="level != null">
`level`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
#{protocol,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=VARCHAR},
</if>
<if test="level != null">
#{level,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiModuleExample" resultType="java.lang.Long">
select count(*) from api_module
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_module
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.protocol != null">
protocol = #{record.protocol,jdbcType=VARCHAR},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=VARCHAR},
level = #{record.level,jdbcType=INTEGER},
</if>
<if test="record.level != null">
`level` = #{record.level,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiModule">
update api_module
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
protocol = #{protocol,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=VARCHAR},
</if>
<if test="level != null">
level = #{level,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiModule">
update api_module
set project_id = #{projectId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
parent_id = #{parentId,jdbcType=VARCHAR},
level = #{level,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_module
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
protocol = #{record.protocol,jdbcType=VARCHAR},
parent_id = #{record.parentId,jdbcType=VARCHAR},
`level` = #{record.level,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiModule">
update api_module
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
protocol = #{protocol,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=VARCHAR},
</if>
<if test="level != null">
`level` = #{level,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiModule">
update api_module
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
parent_id = #{parentId,jdbcType=VARCHAR},
`level` = #{level,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -1,32 +1,38 @@
package io.metersphere.base.mapper;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.ApiTestCaseResult;
import io.metersphere.base.domain.ApiTestCase;
import io.metersphere.base.domain.ApiTestCaseExample;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ApiTestCaseMapper {
List<ApiTestCaseResult> list(@Param("request") ApiTestCaseRequest request);
long countByExample(ApiTestCaseExample example);
int deleteByExample(ApiTestCaseExample example);
int deleteByPrimaryKey(String id);
int insert(ApiTestCase record);
int insert(ApiTestCaseWithBLOBs record);
List<ApiTestCase> selectByExampleWithBLOBs(ApiTestCaseExample example);
int insertSelective(ApiTestCaseWithBLOBs record);
List<ApiTestCaseWithBLOBs> selectByExampleWithBLOBs(ApiTestCaseExample example);
List<ApiTestCase> selectByExample(ApiTestCaseExample example);
ApiTestCase selectByPrimaryKey(String id);
ApiTestCaseWithBLOBs selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(ApiTestCase record);
int updateByExampleSelective(@Param("record") ApiTestCaseWithBLOBs record, @Param("example") ApiTestCaseExample example);
int updateByExampleWithBLOBs(@Param("record") ApiTestCaseWithBLOBs record, @Param("example") ApiTestCaseExample example);
int updateByExample(@Param("record") ApiTestCase record, @Param("example") ApiTestCaseExample example);
int updateByPrimaryKeySelective(ApiTestCaseWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(ApiTestCaseWithBLOBs record);
int updateByPrimaryKey(ApiTestCase record);
}

View File

@ -1,281 +1,375 @@
<?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.ApiTestCaseMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTestCase">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
<result column="api_definition_id" jdbcType="VARCHAR" property="apiDefinitionId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="priority" jdbcType="VARCHAR" property="priority"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCase">
<result column="request" jdbcType="LONGVARCHAR" property="request"/>
<result column="response" jdbcType="LONGVARCHAR" property="response"/>
</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>
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTestCase">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="priority" jdbcType="VARCHAR" property="priority" />
<result column="api_definition_id" jdbcType="VARCHAR" property="apiDefinitionId" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
<result column="request" jdbcType="LONGVARCHAR" property="request" />
<result column="response" jdbcType="LONGVARCHAR" property="response" />
</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>
</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, project_id, name,api_definition_id,priority,description, create_user_id, update_user_id, create_time, update_time
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Blob_Column_List">
request
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestCaseExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
<select id="list" resultType="io.metersphere.api.dto.definition.ApiTestCaseResult">
select atc.id, atc.project_id,
atc.name,atc.priority,atc.api_definition_id,T1.name as createUser ,T2.name as updateUser,
atc.description,atc.request,atc.response,atc.create_user_id,
atc.create_time,atc.update_user_id, atc.update_time,ader.status execResult
from api_test_case atc left join user T1 on atc.create_user_id = T1.id left join user T2 on
atc.update_user_id = T2.id left join api_definition_exec_result ader on atc.id = ader.resource_id
<where>
<if test="request.name != null and request.name!=''">
and atc.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.id != null and request.id!=''">
AND atc.id = #{request.id}
</if>
<if test="request.priority != null and request.priority!=''">
AND atc.priority = #{request.priority}
</if>
<if test="request.projectId != null and request.projectId!=''">
AND atc.project_id = #{request.projectId}
</if>
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
AND atc.api_definition_id = #{request.apiDefinitionId}
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
atc.${order.name} ${order.type}
<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>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestCaseExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from api_test_case
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_test_case where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTestCaseExample">
delete from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestCase">
insert into api_test_case (id, project_id, name, priority,api_definition_id,description, create_user_id, update_user_id,
create_time, update_time, request,response
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, priority, api_definition_id, description, create_user_id,
update_user_id, create_time, update_time
</sql>
<sql id="Blob_Column_List">
request, response
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestCaseExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestCaseExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from api_test_case
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_test_case
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTestCaseExample">
delete from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
insert into api_test_case (id, project_id, `name`,
priority, api_definition_id, description,
create_user_id, update_user_id, create_time,
update_time, request, response
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{createUserId,jdbcType=VARCHAR}, #{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR}
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR},#{description,jdbcType=VARCHAR},
#{createUserId,jdbcType=VARCHAR}, #{updateUserId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR})
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestCaseExample"
resultType="java.lang.Long">
select count(*) from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiTestCase">
update api_test_case
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="apiDefinitionId != null">
api_definition_id = #{apiDefinitionId,jdbcType=BIGINT},
</if>
<if test="priority != null">
priority = #{priority,jdbcType=LONGVARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="request != null">
request = #{request,jdbcType=LONGVARCHAR},
</if>
<if test="response != null">
response = #{response,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestCase">
update api_test_case
set project_id = #{projectId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
update_user_id = #{updateUserId,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
insert into api_test_case
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="priority != null">
priority,
</if>
<if test="apiDefinitionId != null">
api_definition_id,
</if>
<if test="description != null">
description,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="request != null">
request,
</if>
<if test="response != null">
response,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="priority != null">
#{priority,jdbcType=VARCHAR},
</if>
<if test="apiDefinitionId != null">
#{apiDefinitionId,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="createUserId != null">
#{createUserId,jdbcType=VARCHAR},
</if>
<if test="updateUserId != null">
#{updateUserId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="request != null">
#{request,jdbcType=LONGVARCHAR},
</if>
<if test="response != null">
#{response,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestCaseExample" resultType="java.lang.Long">
select count(*) from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_test_case
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.priority != null">
priority = #{record.priority,jdbcType=VARCHAR},
</if>
<if test="record.apiDefinitionId != null">
api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.createUserId != null">
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
</if>
<if test="record.updateUserId != null">
update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.request != null">
request = #{record.request,jdbcType=LONGVARCHAR},
</if>
<if test="record.response != null">
response = #{record.response,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update api_test_case
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
priority = #{record.priority,jdbcType=VARCHAR},
api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
request = #{record.request,jdbcType=LONGVARCHAR},
response = #{record.response,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_test_case
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
priority = #{record.priority,jdbcType=VARCHAR},
api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
update api_test_case
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="priority != null">
priority = #{priority,jdbcType=VARCHAR},
</if>
<if test="apiDefinitionId != null">
api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId,jdbcType=VARCHAR},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="request != null">
request = #{request,jdbcType=LONGVARCHAR},
</if>
<if test="response != null">
response = #{response,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
update api_test_case
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR},
api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_user_id = #{createUserId,jdbcType=VARCHAR},
update_user_id = #{updateUserId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
request = #{request,jdbcType=LONGVARCHAR},
response = #{response,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestCase">
update api_test_case
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR},
api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_user_id = #{createUserId,jdbcType=VARCHAR},
update_user_id = #{updateUserId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,12 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.ApiDefinitionExecResult;
public interface ExtApiDefinitionExecResultMapper {
void deleteByResourceId(String id);
ApiDefinitionExecResult selectByResourceId(String resourceId);
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper">
<delete id="deleteByResourceId" parameterType="java.lang.String">
delete from api_definition_exec_result where resource_id = #{id,jdbcType=VARCHAR}
</delete>
<select id="selectByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
select * from api_definition_exec_result
where resource_id = #{resourceId,jdbcType=VARCHAR}
</select>
</mapper>

View File

@ -0,0 +1,18 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.api.dto.definition.ApiComputeResult;
import io.metersphere.api.dto.definition.ApiDefinitionRequest;
import io.metersphere.api.dto.definition.ApiDefinitionResult;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtApiDefinitionMapper {
List<ApiDefinitionResult> list(@Param("request") ApiDefinitionRequest request);
List<ApiComputeResult> selectByIds(@Param("ids") List<String> ids);
int removeToGc(@Param("ids") List<String> ids);
}

View File

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiDefinitionMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiDefinition">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
<result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
<result column="module_path" jdbcType="VARCHAR" property="modulePath"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="protocol" jdbcType="VARCHAR" property="protocol"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="method" jdbcType="VARCHAR" property="method"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
<result column="request" jdbcType="LONGVARCHAR" property="request"/>
<result column="response" jdbcType="LONGVARCHAR" property="response"/>
</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, project_id, name,module_id,module_path,protocol ,path,method ,description, status, user_id, create_time, update_time
</sql>
<sql id="Blob_Column_List">
request
</sql>
<select id="selectByIds" resultType="io.metersphere.api.dto.definition.ApiComputeResult">
select t1.api_definition_id apiDefinitionId,count(t1.id) caseTotal,
case t2.status
when 'success' then '通过'
when 'error' then '未通过'
ELSE '未执行' end as status ,
CONCAT(FORMAT(SUM(IF(t2.`status` = 'success', 1, 0))/ COUNT(t1.id)*100, 2), '%') passRate
from api_test_case t1 left join api_definition_exec_result t2 on t1.id = t2.resource_id
group by t1.api_definition_id having t1.api_definition_id in
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
order by t2.end_time desc;
</select>
<sql id="combine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and api_definition.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and api_definition.update_time
<include refid="condition">
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.projectName != null">
and project.name
<include refid="condition">
<property name="object" value="${condition}.projectName"/>
</include>
</if>
<if test="${condition}.createTime != null">
and api_definition.create_time
<include refid="condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.status != null">
and api_definition.status
<include refid="condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test="${condition}.creator != null">
and api_definition.user_id
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
select api_definition.id, api_definition.project_id,
api_definition.name,api_definition.protocol,api_definition.path,api_definition.module_id,api_definition.module_path,api_definition.method,
api_definition.description,api_definition.request,api_definition.response,api_definition.environment_id,
api_definition.status, api_definition.user_id, api_definition.create_time, api_definition.update_time, project.name as
project_name, user.name as user_name
from api_definition
left join project on api_definition.project_id = project.id
left join user on api_definition.user_id = user.id
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and api_definition.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.protocol != null">
AND api_definition.protocol = #{request.protocol}
</if>
<if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId}
</if>
<if test="request.projectId != null">
AND project.id = #{request.projectId}
</if>
<if test="request.id != null">
AND api_definition.id = #{request.id}
</if>
<if test="request.userId != null">
AND api_definition.user_id = #{request.userId}
</if>
<if test="request.moduleId != null">
AND api_definition.module_id = #{request.moduleId}
</if>
<if test="request.projectId != null">
AND api_definition.project_id = #{request.projectId}
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
AND api_definition.module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</if>
<if test="request.filters != null and request.filters.size() > 0">
and api_definition.status in
<foreach collection="request.filters" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
api_definition.${order.name} ${order.type}
</foreach>
</if>
</select>
<update id="removeToGc">
update api_definition
set
status = 'Trash'
where id in
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,10 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.ApiModule;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtApiModuleMapper {
int insertBatch(@Param("records") List<ApiModule> records);
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiModuleMapper">
<insert id="insertBatch" parameterType="io.metersphere.base.domain.ApiModule">
insert into api_module (id, project_id, name,protocol
parent_id, level, create_time,
update_time)
values
<foreach collection="records" item="emp" separator=",">
(#{emp.id,jdbcType=VARCHAR}, #{emp.projectId,jdbcType=VARCHAR},
#{emp.name,jdbcType=VARCHAR},#{emp.protocol,jdbcType=VARCHAR},
#{emp.parentId,jdbcType=VARCHAR}, #{emp.level,jdbcType=INTEGER}, #{emp.createTime,jdbcType=BIGINT},
#{emp.updateTime,jdbcType=BIGINT})
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,12 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.ApiTestCaseResult;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtApiTestCaseMapper {
List<ApiTestCaseResult> list(@Param("request") ApiTestCaseRequest request);
}

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiTestCaseMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTestCase">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
<result column="api_definition_id" jdbcType="VARCHAR" property="apiDefinitionId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="priority" jdbcType="VARCHAR" property="priority"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCase">
<result column="request" jdbcType="LONGVARCHAR" property="request"/>
<result column="response" jdbcType="LONGVARCHAR" property="response"/>
</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, 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>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestCaseExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from api_test_case
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
<select id="list" resultType="io.metersphere.api.dto.definition.ApiTestCaseResult">
select atc.id, atc.project_id,
atc.name,atc.priority,atc.api_definition_id,T1.name as createUser ,T2.name as updateUser,
atc.description,atc.request,atc.response,atc.create_user_id,
atc.create_time,atc.update_user_id, atc.update_time,ader.status execResult
from api_test_case atc left join user T1 on atc.create_user_id = T1.id left join user T2 on
atc.update_user_id = T2.id left join api_definition_exec_result ader on atc.id = ader.resource_id
<where>
<if test="request.name != null and request.name!=''">
and atc.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.id != null and request.id!=''">
AND atc.id = #{request.id}
</if>
<if test="request.priority != null and request.priority!=''">
AND atc.priority = #{request.priority}
</if>
<if test="request.projectId != null and request.projectId!=''">
AND atc.project_id = #{request.projectId}
</if>
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
AND atc.api_definition_id = #{request.apiDefinitionId}
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
atc.${order.name} ${order.type}
</foreach>
</if>
</select>
</mapper>

View File

@ -40,11 +40,4 @@ public interface ExtTestPlanTestCaseMapper {
TestPlanCaseDTO get(String testPlanTestCaseId);
/**
* 获取测试计划下的 TestPlanTestCaseID TestCaseName
* @param request planId 不能为空
* @return List<TestPlanCaseDTO>
*/
List<TestPlanCaseDTO> getTestPlanTestCaseList(@Param("request") QueryTestPlanCaseRequest request);
}

View File

@ -214,13 +214,6 @@
</if>
</select>
<select id="getTestPlanTestCaseList" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_plan_test_case.id as id, test_case.name
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
where test_plan_test_case.plan_id = #{request.planId}
</select>
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select distinct * from test_plan_test_case, test_case
where test_plan_test_case.case_id = test_case.id

View File

@ -19,4 +19,11 @@ public interface ExtTestReviewCaseMapper {
* @return List<TestReviewCaseDTO>
*/
List<TestReviewCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
/**
* 获取 TestReviewTestCase 详细信息
* @param id TestReviewTestCase id
* @return TestReviewTestCase 详细信息
*/
TestReviewCaseDTO get(@Param("id") String id);
}

View File

@ -97,7 +97,10 @@
</sql>
<select id="list" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select test_case.remark, test_case_review_test_case.*, test_case.*, test_case_node.name as model, project.name as projectName
select test_case_review_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority,
test_case.type, test_case.node_path, test_case.method, test_case.num, test_case_review_test_case.reviewer,
test_case.review_status, test_case_review_test_case.update_time, test_case_node.name as model,
project.name as projectName, test_case_review_test_case.review_id as reviewId
from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id
@ -181,6 +184,15 @@
</if>
</select>
<select id="get" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select test_case.remark, test_case_review_test_case.*, test_case.*, test_case_node.name as model, project.name as projectName
from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id
inner join project on project.id = test_case.project_id
where test_case_review_test_case.id = #{id}
</select>
<select id="getStatusByReviewId" resultType="java.lang.String">
select review_status
from test_case

View File

@ -785,7 +785,7 @@ public class JmeterDocumentParser implements DocumentParser {
threadGroup.appendChild(createStringProp(document, "LogFilename", ""));
// bzm - Concurrency Thread Group "Thread Iterations Limit:" 设置为空
// threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
threadGroup.appendChild(createStringProp(document, "Unit", "M"));
threadGroup.appendChild(createStringProp(document, "Unit", "S"));
}
private void processCheckoutTimer(Element element) {
@ -912,7 +912,7 @@ public class JmeterDocumentParser implements DocumentParser {
} else {
duration = (Integer) durations;
}
prop.getFirstChild().setNodeValue(String.valueOf(duration * 60));
prop.getFirstChild().setNodeValue(String.valueOf(duration));
continue;
}
Object rpsLimits = context.getProperty("rpsLimit");

View File

@ -61,6 +61,10 @@ public class CheckOwnerService {
}
public void checkPerformanceTestOwner(String testId) {
// 关联为其他时
if (StringUtils.equals("other", testId)) {
return;
}
String workspaceId = SessionUtils.getCurrentWorkspaceId();
QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setWorkspaceId(workspaceId);

View File

@ -42,7 +42,7 @@ public class FileService {
final List<LoadTestFile> loadTestFiles = loadTestFileMapper.selectByExample(loadTestFileExample);
if (CollectionUtils.isEmpty(loadTestFiles)) {
return null;
return new ArrayList<>();
}
List<String> fileIds = loadTestFiles.stream().map(LoadTestFile::getFileId).collect(Collectors.toList());
FileMetadataExample example = new FileMetadataExample();

View File

@ -44,7 +44,7 @@ public class TestReviewTestCaseController {
}
@PostMapping("/list/all")
public List<TestReviewCaseDTO> getTestPlanCases(@RequestBody QueryCaseReviewRequest request) {
public List<TestReviewCaseDTO> getTestReviewCases(@RequestBody QueryCaseReviewRequest request) {
return testReviewTestCaseService.list(request);
}
@ -53,4 +53,17 @@ public class TestReviewTestCaseController {
public void editTestCase(@RequestBody TestCaseReviewTestCase testCaseReviewTestCase) {
testReviewTestCaseService.editTestCase(testCaseReviewTestCase);
}
@GetMapping("/get/{reviewId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public TestReviewCaseDTO get(@PathVariable String reviewId) {
return testReviewTestCaseService.get(reviewId);
}
@PostMapping("/list/ids")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<TestReviewCaseDTO> getTestReviewCaseList(@RequestBody QueryCaseReviewRequest request) {
return testReviewTestCaseService.getTestCaseReviewDTOList(request);
}
}

View File

@ -372,7 +372,7 @@ public class TestCaseNodeService {
public Map<String, String> createNodes(List<String> nodePaths, String projectId) {
List<TestCaseNodeDTO> nodeTrees = getNodeTreeByProjectId(projectId);
Map<String, String> pathMap = new HashMap<>();
for(String item : nodePaths){
for (String item : nodePaths) {
if (item == null) {
throw new ExcelException(Translator.get("test_case_module_not_null"));
}
@ -590,6 +590,7 @@ public class TestCaseNodeService {
/**
* 测试用例同级模块排序
*
* @param ids 被拖拽模块相邻的前一个模块 id
* 被拖拽的模块 id
* 被拖拽模块相邻的后一个模块 id
@ -635,10 +636,11 @@ public class TestCaseNodeService {
/**
* 按照指定排序方式获取同级模块的列表
*
* @param projectId 所属项目 id
* @param level node level
* @param parentId node parent id
* @param order pos 排序方式
* @param level node level
* @param parentId node parent id
* @param order pos 排序方式
* @return 按照指定排序方式排序的同级模块列表
*/
private List<TestCaseNode> getPos(String projectId, int level, String parentId, String order) {
@ -654,9 +656,10 @@ public class TestCaseNodeService {
/**
* 刷新同级模块的 pos
*
* @param projectId project id
* @param level node level
* @param parentId node parent id
* @param level node level
* @param parentId node parent id
*/
private void refreshPos(String projectId, int level, String parentId) {
List<TestCaseNode> nodes = getPos(projectId, level, parentId, "pos asc");
@ -675,14 +678,15 @@ public class TestCaseNodeService {
/**
* 获得同级模块下一个 pos
*
* @param projectId project id
* @param level node level
* @param parentId node parent id
* @param level node level
* @param parentId node parent id
* @return 同级模块下一个 pos
*/
private double getNextLevelPos(String projectId, int level, String parentId) {
List<TestCaseNode> list = getPos(projectId, level, parentId, "pos desc");
if (!CollectionUtils.isEmpty(list)) {
if (!CollectionUtils.isEmpty(list) && list.get(0) != null && list.get(0).getPos() != null) {
return list.get(0).getPos() + 65536;
} else {
return 65536;

View File

@ -128,4 +128,13 @@ public class TestReviewTestCaseService {
testCase.setReviewStatus(testCaseReviewTestCase.getStatus());
testCaseMapper.updateByPrimaryKeySelective(testCase);
}
public List<TestReviewCaseDTO> getTestCaseReviewDTOList(QueryCaseReviewRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return extTestReviewCaseMapper.list(request);
}
public TestReviewCaseDTO get(String reviewId) {
return extTestReviewCaseMapper.get(reviewId);
}
}

View File

@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS `api_module` (
CREATE TABLE IF NOT EXISTS `api_definition` (
`id` varchar(50) NOT NULL COMMENT 'Test ID',
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
`name` varchar(64) NOT NULL COMMENT 'Test name',
`name` varchar(255) NOT NULL COMMENT 'Test name',
`method` varchar(64) NOT NULL COMMENT 'method',
`protocol` varchar(255) NOT NULL COMMENT 'request protocol',
`path` varchar(255) DEFAULT NULL COMMENT 'request path',

View File

@ -0,0 +1,95 @@
<template>
<div v-loading="loading">
<el-card>
<el-row>
<div class="el-step__icon is-text ms-api-col" v-if="data.referenced">
<div class="el-step__icon-inner">{{data.$treeNodeId}}</div>
</div>
<div class="el-step__icon is-text ms-api-col-create" v-else>
<div class="el-step__icon-inner">{{data.$treeNodeId}}</div>
</div>
<i class="icon el-icon-arrow-right" :class="{'is-active': data.active}"
@click="active(data)"/>
<span>{{data.type!= 'create' ? data.name:''}} </span>
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove" style="margin-right: 20px; float: right"/>
</el-row>
<!-- 请求参数-->
<el-collapse-transition>
<div v-if="data.active">
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
<ms-api-request-form :headers="data.request.hashTree[0].headers " :request="data.request" v-if="data.protocol==='HTTP'"/>
<ms-tcp-basis-parameters :request="data.request" :currentProject="currentProject" v-if="data.protocol==='TCP'"/>
<ms-sql-basis-parameters :request="data.request" :currentProject="currentProject" v-if="data.protocol==='SQL'"/>
<ms-dubbo-basis-parameters :request="data.request" :currentProject="currentProject" v-if="data.protocol==='DUBBO'"/>
<!-- 保存操作 -->
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)" v-if="!data.referenced">
{{$t('commons.save')}}
</el-button>
</div>
</el-collapse-transition>
</el-card>
</div>
</template>
<script>
import MsSqlBasisParameters from "../../definition/components/request/database/BasisParameters";
import MsTcpBasisParameters from "../../definition/components/request/tcp/BasisParameters";
import MsDubboBasisParameters from "../../definition/components/request/dubbo/BasisParameters";
import MsApiRequestForm from "../../definition/components/request/http/ApiRequestForm";
export default {
name: "MsApiComponent",
props: {
data: {},
node: {},
currentProject: {},
},
components: {MsSqlBasisParameters, MsTcpBasisParameters, MsDubboBasisParameters, MsApiRequestForm},
data() {
return {loading: false,}
},
methods: {
remove() {
this.$emit('remove', this.data, this.node);
},
active(item) {
item.active = !item.active;
this.reload();
},
reload() {
this.loading = true
this.$nextTick(() => {
this.loading = false
})
},
}
}
</script>
<style scoped>
.ms-api-col {
background-color: #FCF1F1;
border-color: #F56C6C;
margin-right: 10px;
color: #F56C6C;
}
.ms-api-col-create {
background-color: #EBF2F2;
border-color: #008080;
margin-right: 10px;
color: #008080;
}
/deep/ .el-card__body {
padding: 15px;
}
.icon.is-active {
transform: rotate(90deg);
}
</style>

View File

@ -0,0 +1,61 @@
<template>
<div>
<el-card>
<el-row>
<div class="el-step__icon is-text ms-api-col" style="float: left">
<div class="el-step__icon-inner">{{timer.$treeNodeId}}</div>
</div>
<div>
<el-row :gutter="10" type="flex" align="middle">
<el-col :span="2">{{ $t('api_test.request.wait') }}</el-col>
<el-col :span="10">
<el-input-number class="width-100" size="small" v-model="timer.delay" :min="0" :step="1000"/>
</el-col>
<el-col :span="2">ms</el-col>
<el-col :span="8">
<el-switch v-model="timer.enable" :inactive-text="$t('api_test.scenario.enable_disable')"/>
</el-col>
<el-col :span="2">
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove"/>
</el-col>
</el-row>
</div>
</el-row>
</el-card>
</div>
</template>
<script>
export default {
name: "MsConstantTimer",
props: {
timer: {},
node: {},
},
data() {
return {}
},
methods: {
remove() {
this.$emit('remove', this.timer,this.node);
}
}
}
</script>
<style scoped>
.width-100 {
width: 100%
}
.ms-api-col {
background-color: #F2F9EE;
border-color: #67C23A;
margin-right: 10px;
color: #67C23A;
}
/deep/ .el-card__body {
padding: 15px;
}
</style>

View File

@ -1,21 +1,520 @@
<template>
<div> EditApiScenario</div>
<el-card class="card-content">
<div style="background-color: white;">
<p class="tip">{{$t('test_track.plan_view.base_info')}} </p>
<el-form :model="basicForm" label-position="right" label-width="80px" size="small" :rules="rules" ref="basicForm" style="margin-right: 20px">
<!-- 基础信息 -->
<el-row>
<el-col :span="12">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input class="ms-scenario-input" size="small" v-model="basicForm.name"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('test_track.module.module')" prop="moduleId">
<el-select class="ms-scenario-input" size="small" v-model="basicForm.moduleId">
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('commons.status')" prop="status">
<el-select class="ms-scenario-input" size="small" v-model="basicForm.status">
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('api_test.definition.request.responsible')" prop="principal">
<el-select v-model="basicForm.principal"
:placeholder="$t('api_test.definition.request.responsible')" filterable size="small"
class="ms-scenario-input">
<el-option
v-for="item in maintainerOptions"
:key="item.id"
:label="item.id + ' (' + item.name + ')'"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('test_track.case.priority')" prop="level">
<el-select class="ms-scenario-input" size="small" v-model="basicForm.level">
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople">
<el-select v-model="basicForm.followPeople"
:placeholder="$t('api_test.automation.follow_people')" filterable size="small"
class="ms-scenario-input">
<el-option
v-for="item in maintainerOptions"
:key="item.id"
:label="item.id + ' (' + item.name + ')'"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="Tag" prop="tagId">
<el-select v-model="basicForm.tagId" size="small" class="ms-scenario-input" placeholder="Tag"
@change="tagChange" :multiple="true">
<el-option
v-for="item in maintainerOptions"
:key="item.id"
:label="item.id + ' (' + item.name + ')'"
:value="item.id"/>
<el-button size="mini" type="primary" @click="openTagConfig" class="ms-scenario-button">
{{ $t('api_test.automation.create_tag') }}
</el-button>
<template v-slot:empty>
<div>
<el-button size="mini" type="primary" @click="closeTagConfig" class="ms-scenario-button">
{{ $t('api_test.automation.create_tag') }}
</el-button>
</div>
</template>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('commons.description')" prop="description">
<el-input class="ms-http-textarea"
v-model="basicForm.description"
type="textarea"
:autosize="{ minRows: 2, maxRows: 10}"
:rows="2" size="small"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 场景步骤-->
<div v-loading="isReloadData">
<p class="tip">{{$t('api_test.automation.scenario_step')}} </p>
<el-row>
<el-col :span="21">
<div style="margin-left: 20px;border:1px #DCDFE6 solid;border-radius: 4px;margin-right: 10px">
<el-row style="margin: 5px">
<el-col :span="6" class="ms-col-one">
{{basicForm.name ===undefined || ''? $t('api_test.scenario.name') : basicForm.name}}
</el-col>
<el-col :span="5" class="ms-col-one">
{{$t('api_test.automation.step_total')}}:
</el-col>
<el-col :span="5" class="ms-col-one">
{{$t('api_test.automation.scenario_total')}}:
</el-col>
<el-col :span="6">
{{$t('api_test.definition.request.run_env')}}:
<el-select v-model="basicForm.environmentId" size="small" class="ms-htt-width"
:placeholder="$t('api_test.definition.request.run_env')"
@change="environmentChange" clearable>
<el-option v-for="(environment, index) in environments" :key="index"
:label="environment.name + (environment.config.httpConfig.socket ? (': ' + environment.config.httpConfig.protocol + '://' + environment.config.httpConfig.socket) : '')"
:value="environment.id"/>
<el-button class="ms-scenario-button" size="mini" type="primary" @click="openEnvironmentConfig">
{{ $t('api_test.environment.environment_config') }}
</el-button>
<template v-slot:empty>
<div class="empty-environment">
<el-button class="ms-scenario-button" size="mini" type="primary" @click="openEnvironmentConfig">
{{ $t('api_test.environment.environment_config') }}
</el-button>
</div>
</template>
</el-select>
</el-col>
<el-col :span="2">
<el-button size="small" type="primary" @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
</el-col>
</el-row>
</div>
<!-- 场景步骤内容 -->
<div style="margin-top: 10px">
<el-tree node-key="id" :data="scenarioDefinition" :allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" draggable v-loading="isReloadData">
<span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%">
<template>
<!-- 场景 -->
<el-card v-if="data.type==='scenario'">
<el-row>
<div class="el-step__icon is-text ms-api-col" style="float: left">
<div class="el-step__icon-inner">{{data.$treeNodeId}}</div>
</div>
<div style="margin-left: 20px;float: left"> {{data.name}}</div>
</el-row>
</el-card>
<!--条件控制器-->
<ms-if-controller :controller="data" :node="node" v-if="data.type==='IfController'" @remove="remove"/>
<!--等待控制器-->
<ms-constant-timer :timer="data" :node="node" v-if="data.type==='ConstantTimer'" @remove="remove"/>
<!--自定义脚本-->
<ms-jsr233-processor v-if="data.type==='JSR223Processor'" @remove="remove" :title="$t('api_test.automation.customize_script')"
style-type="color: #7B4D12;background-color: #F1EEE9" :jsr223-processor="data" :node="node"/>
<!--前置脚本-->
<ms-jsr233-processor v-if="data.type==='JSR223PreProcessor'" @remove="remove" :title="$t('api_test.definition.request.pre_script')"
style-type="color: #B8741A;background-color: #F9F1EA" :jsr223-processor="data" :node="node"/>
<!--后置脚本-->
<ms-jsr233-processor v-if="data.type==='JSR223PostProcessor'" @remove="remove" :title="$t('api_test.definition.request.post_script')"
style-type="color: #783887;background-color: #F2ECF3" :jsr223-processor="data" :node="node"/>
<!--断言规则-->
<ms-api-assertions v-if="data.type==='Assertions'" @remove="remove" customizeStyle="margin-top: 0px" :assertions="data" :node="node"/>
<!--提取规则-->
<ms-api-extract @remove="remove" v-if="data.type==='Extract'" customizeStyle="margin-top: 0px" :extract="data" :node="node"/>
<!--API 导入 -->
<ms-api-component :data="data" @remove="remove" current-project="currentProject" v-if="data.type==='API' || data.type==='CASE'" :node="node"/>
</template>
</span>
</el-tree>
</div>
</el-col>
<!-- 按钮列表 -->
<div>
<el-col :span="3" class="ms-left-cell">
<el-button type="primary" icon="el-icon-refresh" size="small" @click="showAll">{{$t('commons.show_all')}}</el-button>
<br/>
<div v-if="operatingElements.indexOf('API')>0 || operatingElements.indexOf('CASE')>0">
<el-button class="ms-right-buttion" size="small" style="color: #F56C6C;background-color: #FCF1F1" @click="apiListImport">+{{$t('api_test.automation.api_list_import')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('OT_IMPORT')>0">
<el-button class="ms-right-buttion" size="small" style="color: #409EFF;background-color: #EEF5FE" @click="addComponent('OT_IMPORT')">+{{$t('api_test.automation.external_import')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('ConstantTimer')>0">
<el-button class="ms-right-buttion" size="small" style="color: #67C23A;background-color: #F2F9EE" @click="addComponent('ConstantTimer')">+{{$t('api_test.automation.wait_controller')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('IfController')>0">
<el-button class="ms-right-buttion" size="small" style="color: #E6A23C;background-color: #FCF6EE" @click="addComponent('IfController')">+{{$t('api_test.automation.if_controller')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('scenario')===0">
<el-button class="ms-right-buttion" size="small" style="color: #606266;background-color: #F4F4F5" @click="addComponent('scenario')">+{{$t('api_test.automation.scenario_import')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('JSR223Processor')>0">
<el-button class="ms-right-buttion" size="small" style="color: #7B4D12;background-color: #F1EEE9" @click="addComponent('JSR223Processor')">+{{$t('api_test.automation.customize_script')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('CustomizeReq')>0">
<el-button class="ms-right-buttion" size="small" style="color: #008080;background-color: #EBF2F2" @click="addComponent('CustomizeReq')">+{{$t('api_test.automation.customize_req')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('JSR223PreProcessor')>0">
<el-button class="ms-right-buttion" size="small" style="color: #B8741A;background-color: #F9F1EA" @click="addComponent('JSR223PreProcessor')">+{{$t('api_test.definition.request.pre_script')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('JSR223PostProcessor')>0">
<el-button class="ms-right-buttion" size="small" style="color: #783887;background-color: #F2ECF3" @click="addComponent('JSR223PostProcessor')">+{{$t('api_test.definition.request.post_script')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('Assertions')>0">
<el-button class="ms-right-buttion" size="small" style="color: #A30014;background-color: #F7E6E9" @click="addComponent('Assertions')">+{{$t('api_test.definition.request.assertions_rule')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('Extract')>0">
<el-button class="ms-right-buttion" size="small" style="color: #015478;background-color: #E6EEF2" @click="addComponent('Extract')">+{{$t('api_test.definition.request.extract_param')}}</el-button>
</div>
</el-col>
</div>
</el-row>
</div>
<!--接口列表-->
<el-drawer :visible.sync="apiListVisible" direction="ltr" :with-header="false" :modal="false" size="90%">
<ms-api-definition :visible="true" :currentRow="currentRow"/>
<el-button style="float: right;margin: 20px" @click="addReferenceApi">{{$t('api_test.scenario.reference')}}</el-button>
</el-drawer>
</div>
</el-card>
</template>
<script>
import {API_STATUS} from "../../definition/model/JsonData";
import {WORKSPACE_ID} from '@/common/js/constants';
import {createComponent} from "../../definition/components/jmeter/components";
import {Assertions, Extract, IfController, JSR223Processor, ConstantTimer} from "../../definition/model/ApiTestModel";
import MsJsr233Processor from "./Jsr233Processor";
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
import MsConstantTimer from "./ConstantTimer";
import MsIfController from "./IfController";
import MsApiAssertions from "../../definition/components/assertion/ApiAssertions";
import MsApiExtract from "../../definition/components/extract/ApiExtract";
import MsApiDefinition from "../../definition/ApiDefinition";
import MsApiComponent from "./ApiComponent";
import {ELEMENTS, ELEMENT_TYPE} from "./Setting";
export default {
name: "EditApiScenario",
components: {},
comments: {},
props: {
moduleOptions: Array,
currentProject: {}
},
components: {MsJsr233Processor, MsConstantTimer, MsIfController, MsApiAssertions, MsApiExtract, MsApiDefinition, MsApiComponent},
data() {
return {}
return {
rules: {
name: [
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
],
userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}],
status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
},
basicForm: {},
environments: [],
maintainerOptions: [],
value: API_STATUS[0].id,
options: API_STATUS,
scenario: {},
isReloadData: false,
apiListVisible: false,
operatingElements: [],
currentRow: {cases: [], apis: []},
selectedTreeNode: undefined,
scenarioDefinition: [{index: 1, id: "xx", type: "scenario", name: "test", children: []}, {index: 2, id: "2", type: "ConstantTimer", children: []}]
}
},
created() {
this.operatingElements = ELEMENTS.get("ALL");
this.getMaintainerOptions();
},
watch: {},
methods: {}
methods: {
nodeClick(e) {
this.operatingElements = ELEMENTS.get(e.type);
this.selectedTreeNode = e;
this.reload();
},
showAll() {
this.operatingElements = ELEMENTS.get("ALL");
this.selectedTreeNode = undefined;
this.reload();
},
apiListImport() {
this.apiListVisible = true;
},
addComponent(type) {
switch (type) {
case ELEMENT_TYPE.IfController:
this.selectedTreeNode != undefined ? this.selectedTreeNode.children.push(new IfController()) :
this.scenarioDefinition.push(new IfController());
break;
case ELEMENT_TYPE.ConstantTimer:
this.selectedTreeNode != undefined ? this.selectedTreeNode.children.push(new ConstantTimer()) :
this.scenarioDefinition.push(new ConstantTimer());
break;
case ELEMENT_TYPE.JSR223Processor:
this.selectedTreeNode != undefined ? this.selectedTreeNode.children.push(new JSR223Processor()) :
this.scenarioDefinition.push(new JSR223Processor());
break;
case ELEMENT_TYPE.JSR223PreProcessor:
this.selectedTreeNode != undefined ? this.selectedTreeNode.children.push(new JSR223Processor({type: "JSR223PreProcessor"})) :
this.scenarioDefinition.push(new JSR223Processor({type: "JSR223PreProcessor"}));
break;
case ELEMENT_TYPE.JSR223PostProcessor:
this.selectedTreeNode != undefined ? this.selectedTreeNode.children.push(new JSR223Processor({type: "JSR223PostProcessor"})) :
this.scenarioDefinition.push(new JSR223Processor({type: "JSR223PostProcessor"}));
break;
case ELEMENT_TYPE.Assertions:
this.selectedTreeNode != undefined ? this.selectedTreeNode.children.push(new Assertions()) :
this.scenarioDefinition.push(new Assertions());
break;
case ELEMENT_TYPE.Extract:
this.selectedTreeNode != undefined ? this.selectedTreeNode.children.push(new Extract()) :
this.scenarioDefinition.push(new Extract());
break;
default:
break;
}
},
addReferenceApi() {
if (this.currentRow.cases.length === 0 && this.currentRow.apis.length === 0) {
this.$warning(this.$t('api_test.automation.reference_info'));
return;
}
this.currentRow.cases.forEach(item => {
item.referenced = true;
item.active = false;
if (this.selectedTreeNode != undefined) {
this.selectedTreeNode.children.push(item);
} else {
this.scenarioDefinition.push(item);
}
})
this.currentRow.apis.forEach(item => {
item.referenced = true;
item.active = false;
item.request = JSON.parse(item.request);
if (this.selectedTreeNode != undefined) {
this.selectedTreeNode.children.push(item);
} else {
this.scenarioDefinition.push(item);
}
})
this.apiListVisible = false;
this.reload();
},
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.maintainerOptions = response.data;
});
},
tagChange() {
},
openTagConfig() {
if (!this.currentProject) {
this.$error(this.$t('api_test.select_project'));
return;
}
this.$refs.environmentConfig.open(this.currentProject.id);
},
closeTagConfig() {
},
addPre() {
let jsr223PreProcessor = createComponent("JSR223PreProcessor");
this.request.hashTree.push(jsr223PreProcessor);
this.reload();
},
addPost() {
let jsr223PostProcessor = createComponent("JSR223PostProcessor");
this.request.hashTree.push(jsr223PostProcessor);
this.reload();
},
addAssertions() {
let assertions = new Assertions();
this.request.hashTree.push(assertions);
this.reload();
},
addExtract() {
let jsonPostProcessor = new Extract();
this.request.hashTree.push(jsonPostProcessor);
this.reload();
},
remove(row, node) {
const parent = node.parent
const children = parent.data.children || parent.data;
const index = children.findIndex(d => d.id != undefined && row.id != undefined && d.id === row.id)
children.splice(index, 1);
this.reload();
},
reload() {
this.isReloadData = true
this.$nextTick(() => {
this.isReloadData = false
})
},
runDebug() {
},
getEnvironments() {
if (this.currentProject) {
this.$get('/api/environment/list/' + this.currentProject.id, response => {
this.environments = response.data;
this.environments.forEach(environment => {
parseEnvironment(environment);
});
let hasEnvironment = false;
for (let i in this.environments) {
if (this.environments[i].id === this.api.environmentId) {
this.api.environment = this.environments[i];
hasEnvironment = true;
break;
}
}
if (!hasEnvironment) {
this.api.environmentId = '';
this.api.environment = undefined;
}
});
} else {
this.api.environmentId = '';
this.api.environment = undefined;
}
},
openEnvironmentConfig() {
if (!this.currentProject) {
this.$error(this.$t('api_test.select_project'));
return;
}
this.$refs.environmentConfig.open(this.currentProject.id);
},
environmentChange(value) {
for (let i in this.environments) {
if (this.environments[i].id === value) {
this.api.request.useEnvironment = this.environments[i].id;
break;
}
}
},
environmentConfigClose() {
this.getEnvironments();
},
allowDrop(draggingNode, dropNode, type) {
if (ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1) {
return true;
}
return false;
},
allowDrag() {
},
}
}
</script>
<style scoped>
.ms-scenario-input {
width: 100%;
}
.ms-scenario-button {
margin-left: 45%;
padding: 7px;
}
.tip {
padding: 3px 5px;
font-size: 16px;
border-radius: 4px;
border-left: 4px solid #783887;
}
.ms-api-col {
background-color: #7C3985;
border-color: #7C3985;
margin-right: 10px;
color: white;
}
.ms-col-one {
margin-top: 6px;
}
.ms-right-buttion {
margin-top: 10px;
}
/deep/ .el-tree-node__content {
height: 100%;
margin-top: 8px;
vertical-align: center;
}
/deep/ .el-card__body {
padding: 15px;
}
</style>

View File

@ -0,0 +1,104 @@
<template>
<el-card>
<el-row>
<div class="el-step__icon is-text ms-api-col" style="float: left">
<div class="el-step__icon-inner">{{controller.$treeNodeId}}</div>
</div>
<div>
<el-row :gutter="10" type="flex" align="middle">
<el-col :span="1">If</el-col>
<el-col :span="6">
<el-input size="small" v-model="controller.variable" :placeholder="$t('api_test.request.condition_variable')"/>
</el-col>
<el-col :span="5">
<el-select v-model="controller.operator" :placeholder="$t('commons.please_select')" size="small"
@change="change">
<el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/>
</el-select>
</el-col>
<el-col :span="6">
<el-input size="small" v-model="controller.value" :placeholder="$t('api_test.value')" v-if="!hasEmptyOperator"/>
</el-col>
<el-col :span="4">
<el-switch v-model="controller.enable" :inactive-text="$t('api_test.scenario.enable_disable')"/>
</el-col>
<el-col :span="2">
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove"/>
</el-col>
</el-row>
</div>
</el-row>
</el-card>
</template>
<script>
export default {
name: "MsIfController",
props: {
controller: {},
node: {},
},
data() {
return {
operators: {
EQ: {
label: "commons.adv_search.operators.equals",
value: "=="
},
NE: {
label: "commons.adv_search.operators.not_equals",
value: "!="
},
LIKE: {
label: "commons.adv_search.operators.like",
value: "=~"
},
NOT_LIKE: {
label: "commons.adv_search.operators.not_like",
value: "!~"
},
GT: {
label: "commons.adv_search.operators.gt",
value: ">"
},
LT: {
label: "commons.adv_search.operators.lt",
value: "<"
},
IS_EMPTY: {
label: "commons.adv_search.operators.is_empty",
value: "is empty"
},
IS_NOT_EMPTY: {
label: "commons.adv_search.operators.is_not_empty",
value: "is not empty"
}
}
}
},
methods: {
remove() {
this.$emit('remove', this.controller, this.node);
},
change(value) {
if (value.indexOf("empty") > 0 && !!this.controller.value) {
this.controller.value = "";
}
}
},
computed: {
hasEmptyOperator() {
return !!this.controller.operator && this.controller.operator.indexOf("empty") > 0;
}
}
}
</script>
<style scoped>
.ms-api-col {
background-color: #FCF6EE;
border-color: #E6A23C;
margin-right: 10px;
color: #E6A23C;
}
</style>

View File

@ -0,0 +1,194 @@
<template>
<el-card>
<el-row>
<div>
<el-button class="ms-left-buttion" size="small" :style="styleType" style="color: #B8741A;background-color: #F9F1EA">{{title}}</el-button>
<i class="icon el-icon-arrow-right" :class="{'is-active': active}" @click="changeActive" style="margin-left: 20px"/>
<el-input size="small" v-model="jsr223ProcessorData.name" class="ms-api-header-select" style="width: 380px"/>
<el-button size="small" style="float: right" @click="remove">移除</el-button>
</div>
</el-row>
<el-collapse-transition>
<div v-if="active">
<el-row style="margin:0px 10px 10px">
<el-col>
<div class="document-url">
<el-link href="https://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor"
type="primary">{{$t('commons.reference_documentation')}}
</el-link>
<ms-instructions-icon :content="$t('api_test.request.processor.bean_shell_processor_tip')"/>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="20" class="script-content">
<ms-code-edit v-if="isCodeEditAlive" :mode="jsr223ProcessorData.scriptLanguage"
:read-only="isReadOnly"
:data.sync="jsr223ProcessorData.script" theme="eclipse" :modes="['java','python']"
ref="codeEdit"/>
</el-col>
<el-col :span="4" class="script-index">
<ms-dropdown :default-command="jsr223ProcessorData.language" :commands="languages" @command="languageChange"/>
<div class="template-title">{{$t('api_test.request.processor.code_template')}}</div>
<div v-for="(template, index) in codeTemplates" :key="index" class="code-template">
<el-link :disabled="template.disabled" @click="addTemplate(template)">{{template.title}}</el-link>
</div>
</el-col>
</el-row>
</div>
</el-collapse-transition>
</el-card>
</template>
<script>
import MsCodeEdit from "../../../common/components/MsCodeEdit";
import MsInstructionsIcon from "../../../common/components/MsInstructionsIcon";
import MsDropdown from "../../../common/components/MsDropdown";
export default {
name: "MsJsr233Processor",
components: {MsDropdown, MsInstructionsIcon, MsCodeEdit},
data() {
return {
active: false,
jsr223ProcessorData: {},
codeTemplates: [
{
title: this.$t('api_test.request.processor.code_template_get_variable'),
value: 'vars.get("variable_name")',
},
{
title: this.$t('api_test.request.processor.code_template_set_variable'),
value: 'vars.put("variable_name", "variable_value")',
},
{
title: this.$t('api_test.request.processor.code_template_get_global_variable'),
value: 'props.get("variable_name")',
},
{
title: this.$t('api_test.request.processor.code_template_set_global_variable'),
value: 'props.put("variable_name", "variable_value")',
},
{
title: this.$t('api_test.request.processor.code_template_get_response_header'),
value: 'prev.getResponseHeaders()',
disabled: this.isPreProcessor
},
{
title: this.$t('api_test.request.processor.code_template_get_response_code'),
value: 'prev.getResponseCode()',
disabled: this.isPreProcessor
},
{
title: this.$t('api_test.request.processor.code_template_get_response_result'),
value: 'prev.getResponseDataAsString()',
disabled: this.isPreProcessor
}
],
isCodeEditAlive: true,
languages: [
'java', "python"
],
codeEditModeMap: {
beanshell: 'java',
python: 'python'
}
}
},
created() {
this.jsr223ProcessorData = this.jsr223Processor;
},
props: {
isReadOnly: {
type: Boolean,
default:
false
},
jsr223Processor: {
type: Object,
},
isPreProcessor: {
type: Boolean,
default:
false
},
title: String,
styleType: String,
node: {},
},
watch: {
jsr223Processor() {
this.reload();
}
}
,
methods: {
addTemplate(template) {
if (!this.jsr223ProcessorData.script) {
this.jsr223ProcessorData.script = "";
}
this.jsr223ProcessorData.script += template.value;
if (this.jsr223ProcessorData.language === 'beanshell') {
this.jsr223ProcessorData.script += ';';
}
this.reload();
},
remove() {
this.$emit('remove', this.jsr223ProcessorData,this.node);
},
reload() {
this.isCodeEditAlive = false;
this.$nextTick(() => (this.isCodeEditAlive = true));
},
languageChange(language) {
this.jsr223ProcessorData.language = language;
},
changeActive() {
this.active = !this.active;
},
}
}
</script>
<style scoped>
.ace_editor {
border-radius: 5px;
}
.script-content {
height: calc(100vh - 570px);
}
.script-index {
padding: 0 20px;
}
.template-title {
margin-bottom: 5px;
font-weight: bold;
font-size: 15px;
}
.document-url {
margin-top: 10px;
}
.instructions-icon {
margin-left: 5px;
}
.ms-dropdown {
margin-bottom: 20px;
}
.ms-api-header-select {
margin-left: 20px;
min-width: 300px;
}
.icon.is-active {
transform: rotate(90deg);
}
</style>

View File

@ -0,0 +1,31 @@
export const ELEMENTS = new Map([
['ALL', ["scenario", "API", "CASE", "OT_IMPORT", "IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
['scenario', ["API", "CASE", "OT_IMPORT", "IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
['API', ["IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['CASE', ["IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['OT_IMPORT', []],
['IfController', ["API", "CASE", "OT_IMPORT", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
['ConstantTimer', ["API", "CASE", "OT_IMPORT", "IfController", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
['JSR223Processor', []],
['JSR223PreProcessor', []],
['JSR223PostProcessor', []],
['Assertions', []],
['Extract', []],
['CustomizeReq', ["API", "CASE", "OT_IMPORT", "IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
])
export const ELEMENT_TYPE = {
scenario: "scenario",
API: "API",
CASE: "CASE",
OT_IMPORT: "OT_IMPORT",
IfController: "IfController",
ConstantTimer: "ConstantTimer",
JSR223Processor: "JSR223Processor",
JSR223PreProcessor: "JSR223PreProcessor",
JSR223PostProcessor: "JSR223PostProcessor",
Assertions: "Assertions",
Extract: "Extract",
CustomizeReq: "CustomizeReq"
}

View File

@ -31,6 +31,8 @@
:current-module="currentModule"
@editApi="editApi"
@handleCase="handleCase"
:visible="visible"
:currentRow="currentRow"
ref="apiList"/>
<!-- 添加测试窗口-->
@ -86,7 +88,7 @@
import {downloadFile, getCurrentUser, getUUID} from "@/common/js/utils";
export default {
name: "TestCase",
name: "ApiDefinition",
components: {
MsNodeTree,
MsApiList,
@ -103,7 +105,15 @@
MsRunTestSqlPage,
MsRunTestDubboPage
},
comments: {},
props: {
visible: {
type: Boolean,
default: false,
},
currentRow: {
type: Object,
}
},
data() {
return {
isHide: true,

View File

@ -82,6 +82,10 @@
<div v-for="(item,index) in apiCaseList" :key="index">
<el-card style="margin-top: 5px" @click.native="selectTestCase(item,$event)">
<el-row>
<el-col :span="1">
<el-checkbox v-if="visible" @change="caseChecked(item)"/>
</el-col>
<el-col :span="5">
<div class="el-step__icon is-text ms-api-col">
<div class="el-step__icon-inner">{{index+1}}</div>
@ -119,7 +123,7 @@
circle/>
</el-col>
<el-col :span="4">
<el-col :span="3">
<div v-if="item.type!='create'">{{getResult(item.execResult)}}</div>
<div v-if="item.type!='create'" style="color: #999999;font-size: 12px">
<span> {{item.updateTime | timestampFormatDate }}</span>
@ -132,7 +136,7 @@
<div v-if="item.active">
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
<ms-api-request-form :is-read-only="isReadOnly" :headers="item.request.hashTree[0].headers " :request="item.request" v-if="api.protocol==='HTTP'"/>
<ms-api-request-form :is-read-only="isReadOnly" :headers="item.request.headers " :request="item.request" v-if="api.protocol==='HTTP'"/>
<ms-tcp-basis-parameters :request="item.request" :currentProject="currentProject" v-if="api.protocol==='TCP'"/>
<ms-sql-basis-parameters :request="item.request" :currentProject="currentProject" v-if="api.protocol==='SQL'"/>
<ms-dubbo-basis-parameters :request="item.request" :currentProject="currentProject" v-if="api.protocol==='DUBBO'"/>
@ -186,9 +190,14 @@
api: {
type: Object
},
visible: {
type: Boolean,
default: false,
},
loaded: Boolean,
currentProject: {},
refreshSign: String,
currentRow: Object,
},
data() {
return {
@ -204,18 +213,29 @@
loading: false,
runData: [],
reportId: "",
checkedCases: new Set(),
}
},
watch: {
//
api() {
if (this.currentRow) {
this.currentRow.cases = [];
}
this.getApiTest();
},
currentProject() {
if (this.currentRow) {
this.currentRow.cases = [];
}
this.getEnvironments();
},
refreshSign() {
if (this.currentRow) {
this.currentRow.cases = [];
}
this.getApiTest();
}
},
@ -439,6 +459,18 @@
this.$emit('selectTestCase', item);
}
},
caseChecked(row) {
row.type = "CASE";
row.protocol = this.api.protocol;
row.hashTree = [];
if (this.checkedCases.has(row)) {
this.checkedCases.delete(row);
} else {
this.checkedCases.add(row)
}
let arr = Array.from(this.checkedCases);
this.currentRow.cases = arr;
}
}
}

View File

@ -2,17 +2,17 @@
<div class="card-container">
<!-- HTTP 请求参数 -->
<ms-edit-complete-http-api @runTest="runTest" @saveApi="saveApi" :request="request" :headers="headers" :response="response"
:basisData="currentApi" :moduleOptions="moduleOptions" :currentProject="currentProject" v-if="currentProtocol === 'HTTP'"/>
<ms-edit-complete-http-api @runTest="runTest" @saveApi="saveApi" :request="request" :response="response"
:basisData="currentApi" :moduleOptions="moduleOptions" :currentProject="currentProject" v-if="currentProtocol === 'HTTP'"/>
<!-- TCP -->
<ms-edit-complete-tcp-api :request="request" @runTest="runTest" @saveApi="saveApi" :currentProject="currentProject" :basisData="currentApi"
:moduleOptions="moduleOptions" v-if="currentProtocol === 'TCP'"/>
:moduleOptions="moduleOptions" v-if="currentProtocol === 'TCP'"/>
<!--DUBBO-->
<ms-edit-complete-dubbo-api :request="request" @runTest="runTest" @saveApi="saveApi" :currentProject="currentProject" :basisData="currentApi"
:moduleOptions="moduleOptions" v-if="currentProtocol === 'DUBBO'"/>
:moduleOptions="moduleOptions" v-if="currentProtocol === 'DUBBO'"/>
<!--SQL-->
<ms-edit-complete-sql-api :request="request" @runTest="runTest" @saveApi="saveApi" :currentProject="currentProject" :basisData="currentApi"
:moduleOptions="moduleOptions" v-if="currentProtocol === 'SQL'"/>
:moduleOptions="moduleOptions" v-if="currentProtocol === 'SQL'"/>
</div>
</template>
@ -39,7 +39,6 @@
request: Sampler,
config: {},
response: {},
headers: [],
maintainerOptions: [],
}
},
@ -74,7 +73,6 @@
this.reqUrl = "/api/definition/update";
} else {
this.reqUrl = "/api/definition/create";
this.currentApi.id = getUUID().substring(0, 8);
}
},
methods: {
@ -121,11 +119,8 @@
if (this.currentApi.request != undefined && this.currentApi.request != null) {
this.request = JSON.parse(this.currentApi.request);
this.currentApi.request = this.request;
this.headers = this.request.hashTree[0].headers;
} else {
let header = createComponent("HeaderManager");
this.request = createComponent("HTTPSamplerProxy");
this.request.hashTree = [header];
this.currentApi.request = this.request;
}
},
@ -140,12 +135,12 @@
},
setParameters(data) {
data.projectId = this.currentProject.id;
if (this.currentProtocol === 'HTTP') {
this.request.hashTree[0].headers = this.headers;
}
this.request.name = this.currentApi.name;
data.protocol = this.currentProtocol;
data.request = this.request;
data.request.name = data.name;
data.request.protocol = this.currentProtocol;
data.id = data.request.id;
data.response = this.response;
},
getBodyUploadFiles(data) {

View File

@ -86,7 +86,7 @@
<div id="svgResize"/>
<div id="svgDown">
<ms-bottom-container v-bind:enableAsideHidden="isHide">
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="initApiTable" :api="selectApi" :current-project="currentProject"/>
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="initApiTable" :visible="visible" :currentRow="currentRow" :api="selectApi" :current-project="currentProject"/>
</ms-bottom-container>
</div>
</div>
@ -142,7 +142,14 @@
props: {
currentProject: Object,
currentProtocol: String,
currentModule: Object
currentModule: Object,
visible: {
type: Boolean,
default: false,
},
currentRow: {
type: Object,
}
},
created: function () {
this.initApiTable();
@ -190,6 +197,8 @@
});
},
handleSelect(selection, row) {
row.type = "API";
row.hashTree = [];
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
@ -199,7 +208,9 @@
}
let arr = Array.from(this.selectRows);
if (this.currentRow) {
this.currentRow.apis = arr;
}
// 1
if (this.selectRows.size === 1) {
this.$set(arr[0], "showMore", false);
@ -212,9 +223,13 @@
handleSelectAll(selection) {
if (selection.length > 0) {
if (selection.length === 1) {
selection.type = "API";
selection.hashTree = [];
this.selectRows.add(selection[0]);
} else {
this.tableData.forEach(item => {
item.type = "API";
item.hashTree = [];
this.$set(item, "showMore", true);
this.selectRows.add(item);
});
@ -225,6 +240,10 @@
this.$set(row, "showMore", false);
})
}
if (this.currentRow) {
let arr = Array.from(this.selectRows);
this.currentRow.apis = arr;
}
},
search() {
this.initApiTable();

View File

@ -95,7 +95,7 @@
</el-tree>
<ms-add-basis-api :current-protocol="protocol" ref="basisApi"></ms-add-basis-api>
<api-import ref="apiImport" @refresh="refresh"/>
<api-import ref="apiImport" :project-id="currentProject.id" @refresh="refresh"/>
</div>

View File

@ -1,64 +1,66 @@
<template>
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100% ;margin-top: 20px" v-loading="loading">
<div>
<el-button class="ms-left-buttion" size="small" style="color: #A30014;background-color: #F7E6E9">{{$t('api_test.definition.request.assertions_rule')}}</el-button>
<el-button size="small" style="float: right;margin-top: 0px" @click="remove">移除</el-button>
</div>
<div class="assertion-add">
<el-row :gutter="10">
<el-col :span="4">
<el-select :disabled="isReadOnly" class="assertion-item" v-model="type"
:placeholder="$t('api_test.request.assertions.select_type')"
size="small">
<div :style="customizeStyle" v-loading="loading">
<el-card>
<div>
<el-button class="ms-left-buttion" size="small" style="color: #A30014;background-color: #F7E6E9">{{$t('api_test.definition.request.assertions_rule')}}</el-button>
<el-button size="small" style="float: right;margin-top: 0px" @click="remove">移除</el-button>
</div>
<div class="assertion-add">
<el-row :gutter="10">
<el-col :span="4">
<el-select :disabled="isReadOnly" class="assertion-item" v-model="type"
:placeholder="$t('api_test.request.assertions.select_type')"
size="small">
<!--
<el-option :label="$t('api_test.request.assertions.text')" :value="options.TEXT"/>
-->
<el-option :label="$t('api_test.request.assertions.regex')" :value="options.REGEX"/>
<el-option :label="'JSONPath'" :value="options.JSON_PATH"/>
<el-option :label="'XPath'" :value="options.XPATH2"/>
<el-option :label="$t('api_test.request.assertions.response_time')" :value="options.DURATION"/>
<el-option :label="$t('api_test.request.assertions.jsr223')" :value="options.JSR223"/>
</el-select>
</el-col>
<el-col :span="20">
<!--
<el-option :label="$t('api_test.request.assertions.text')" :value="options.TEXT"/>
<ms-api-assertion-text :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.TEXT"
:callback="after"/>
-->
<el-option :label="$t('api_test.request.assertions.regex')" :value="options.REGEX"/>
<el-option :label="'JSONPath'" :value="options.JSON_PATH"/>
<el-option :label="'XPath'" :value="options.XPATH2"/>
<el-option :label="$t('api_test.request.assertions.response_time')" :value="options.DURATION"/>
<el-option :label="$t('api_test.request.assertions.jsr223')" :value="options.JSR223"/>
</el-select>
</el-col>
<el-col :span="20">
<!--
<ms-api-assertion-text :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.TEXT"
:callback="after"/>
-->
<ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.REGEX"
:callback="after"/>
<ms-api-assertion-json-path :is-read-only="isReadOnly" :list="assertions.jsonPath"
v-if="type === options.JSON_PATH" :callback="after"/>
<ms-api-assertion-x-path2 :is-read-only="isReadOnly" :list="assertions.xpath2" v-if="type === options.XPATH2"
<ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.REGEX"
:callback="after"/>
<ms-api-assertion-duration :is-read-only="isReadOnly" v-model="time" :duration="assertions.duration"
v-if="type === options.DURATION" :callback="after"/>
<ms-api-assertion-jsr223 :is-read-only="isReadOnly" :list="assertions.jsr223" v-if="type === options.JSR223"
:callback="after"/>
<el-button v-if="!type" :disabled="true" type="primary" size="small">
{{ $t('api_test.request.assertions.add') }}
</el-button>
</el-col>
</el-row>
<ms-api-assertion-json-path :is-read-only="isReadOnly" :list="assertions.jsonPath"
v-if="type === options.JSON_PATH" :callback="after"/>
<ms-api-assertion-x-path2 :is-read-only="isReadOnly" :list="assertions.xpath2" v-if="type === options.XPATH2"
:callback="after"/>
<ms-api-assertion-duration :is-read-only="isReadOnly" v-model="time" :duration="assertions.duration"
v-if="type === options.DURATION" :callback="after"/>
<ms-api-assertion-jsr223 :is-read-only="isReadOnly" :list="assertions.jsr223" v-if="type === options.JSR223"
:callback="after"/>
<el-button v-if="!type" :disabled="true" type="primary" size="small">
{{ $t('api_test.request.assertions.add') }}
</el-button>
</el-col>
</el-row>
<!--<div v-if="!scenario">-->
<!--<el-row :gutter="10" class="json-path-suggest-button">-->
<!--<el-link size="small" type="primary" @click="suggestJsonOpen" style="margin-right: 20px">-->
<!--{{ $t('api_test.request.assertions.json_path_suggest') }}-->
<!--</el-link>-->
<!--<el-link size="small" type="danger" @click="clearJson">-->
<!--{{ $t('api_test.request.assertions.json_path_clear') }}-->
<!--</el-link>-->
<!--</el-row>-->
<!--</div>-->
</div>
<!--<div v-if="!scenario">-->
<!--<el-row :gutter="10" class="json-path-suggest-button">-->
<!--<el-link size="small" type="primary" @click="suggestJsonOpen" style="margin-right: 20px">-->
<!--{{ $t('api_test.request.assertions.json_path_suggest') }}-->
<!--</el-link>-->
<!--<el-link size="small" type="danger" @click="clearJson">-->
<!--{{ $t('api_test.request.assertions.json_path_clear') }}-->
<!--</el-link>-->
<!--</el-row>-->
<!--</div>-->
</div>
<!--<ms-api-jsonpath-suggest-list @addJsonpathSuggest="addJsonpathSuggest" :request="request"-->
<!--ref="jsonpathSuggestList"/>-->
<!--<ms-api-jsonpath-suggest-list @addJsonpathSuggest="addJsonpathSuggest" :request="request"-->
<!--ref="jsonpathSuggestList"/>-->
<ms-api-assertions-edit :is-read-only="isReadOnly" :assertions="assertions" :reloadData="reloadData" style="margin-bottom: 20px"/>
<ms-api-assertions-edit :is-read-only="isReadOnly" :assertions="assertions" :reloadData="reloadData" style="margin-bottom: 20px"/>
</el-card>
</div>
</template>
@ -87,7 +89,12 @@
props: {
assertions: {},
node: {},
request: {},
customizeStyle: {
type:String,
default: "margin-top: 10px"
},
scenario: Scenario,
isReadOnly: {
type: Boolean,
@ -125,7 +132,7 @@
})
},
remove() {
this.$emit('remove', this.assertions);
this.$emit('remove', this.assertions,this.node);
},
addJsonpathSuggest(jsonPathList) {
jsonPathList.forEach(jsonPath => {

View File

@ -111,14 +111,6 @@
})
},
setParameter() {
this.httpForm.bodyUploadIds = [];
this.httpForm.projectId = this.projectId;
this.httpForm.id = getUUID().substring(0, 8);
this.httpForm.protocol = this.currentProtocol;
if (this.currentModule != null) {
this.httpForm.modulePath = this.currentModule.method != undefined ? this.currentModule.method : null;
this.httpForm.moduleId = this.currentModule.id;
}
switch (this.currentProtocol) {
case Request.TYPES.SQL:
this.initSQL();
@ -133,12 +125,26 @@
this.initHTTP();
break;
}
this.httpForm.bodyUploadIds = [];
this.httpForm.projectId = this.projectId;
this.httpForm.id = this.httpForm.request.id;
this.httpForm.protocol = this.currentProtocol;
this.httpForm.request.name = this.httpForm.name;
this.httpForm.request.protocol = this.currentProtocol;
if (this.currentProtocol === 'HTTP') {
this.httpForm.request.method = this.httpForm.method;
this.httpForm.request.path = this.httpForm.path;
}
if (this.currentModule != null) {
this.httpForm.modulePath = this.currentModule.method != undefined ? this.currentModule.method : null;
this.httpForm.moduleId = this.currentModule.id;
}
},
initHTTP() {
let header = createComponent("HeaderManager");
let request = createComponent("HTTPSamplerProxy");
request.path = this.httpForm.path;
request.hashTree = [header];
this.httpForm.request = request;
},
initSQL() {

View File

@ -61,7 +61,7 @@
<!-- 请求参数 -->
<div>
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
<ms-api-request-form :request="request" :headers="headers" :isShowEnable="isShowEnable"/>
<ms-api-request-form :request="request" :headers="request.headers" :isShowEnable="isShowEnable"/>
</div>
</el-form>
@ -103,7 +103,7 @@
options: API_STATUS,
}
},
props: {moduleOptions: {}, currentProject: {}, headers: Array, request: {}, response: {}, basisData: {}},
props: {moduleOptions: {}, currentProject: {}, request: {}, response: {}, basisData: {}},
methods: {
runTest() {
if (this.currentProject === null) {

View File

@ -26,12 +26,12 @@
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
<!-- HTTP 请求参数 -->
<ms-api-request-form :headers="headers" :request="request"/>
<ms-api-request-form :headers="request.headers" :request="request"/>
</el-form>
<!-- HTTP 请求返回数据 -->
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
<ms-request-result-tail :response="responseData" ref="debugResult"/>
<ms-request-result-tail :response="responseData" ref="debugResult"/>
<!-- 执行组件 -->
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
@ -69,27 +69,13 @@
loading: false,
debugResultId: "",
runData: [],
headers: [],
reportId: "",
reqOptions: REQ_METHOD,
request: {},
}
},
created() {
switch (this.protocol) {
case Request.TYPES.SQL:
this.request = createComponent("SQL");
break;
case Request.TYPES.DUBBO:
this.request = createComponent("JDBCSampler");
break;
case Request.TYPES.TCP:
this.request = createComponent("TCPSampler");
break;
default:
this.createHttp();
break;
}
this.createHttp();
},
watch: {
debugResultId() {
@ -105,9 +91,7 @@
}
},
createHttp() {
let header = createComponent("HeaderManager");
this.request = createComponent("HTTPSamplerProxy");
this.request.hashTree = [header];
},
runDebug() {
this.$refs['debugForm'].validate((valid) => {
@ -115,7 +99,6 @@
this.loading = true;
this.request.url = this.debugForm.url;
this.request.method = this.debugForm.method;
this.request.hashTree[0].headers = this.headers;
this.request.name = getUUID().substring(0, 8);
this.runData = [];
this.runData.push(this.request);

View File

@ -1,32 +1,33 @@
<template>
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100% ;margin-top: 20px">
<el-button class="ms-left-buttion" size="small" style="color: #015478;background-color: #E6EEF2">{{$t('api_test.definition.request.extract_param')}}</el-button>
<el-button size="small" style="float: right;margin-top: 0px" @click="remove">移除</el-button>
<div :style="customizeStyle">
<el-card>
<el-button class="ms-left-buttion" size="small" style="color: #015478;background-color: #E6EEF2">{{$t('api_test.definition.request.extract_param')}}</el-button>
<el-button size="small" style="float: right;margin-top: 0px" @click="remove">移除</el-button>
<div style="margin: 20px">
<div class="extract-description">
{{$t('api_test.request.extract.description')}}
<div style="margin: 20px">
<div class="extract-description">
{{$t('api_test.request.extract.description')}}
</div>
<div class="extract-add">
<el-row :gutter="10">
<el-col :span="2">
<el-select :disabled="isReadOnly" class="extract-item" v-model="type" :placeholder="$t('api_test.request.extract.select_type')"
size="small">
<el-option :label="$t('api_test.request.extract.regex')" :value="options.REGEX"/>
<el-option label="JSONPath" :value="options.JSON_PATH"/>
<el-option label="XPath" :value="options.XPATH"/>
</el-select>
</el-col>
<el-col :span="22">
<ms-api-extract-common :is-read-only="isReadOnly" :extract-type="type" :list="list" v-if="type" :callback="after"/>
</el-col>
<el-button v-if="!type" :disabled="true" type="primary" size="small">Add</el-button>
</el-row>
</div>
<ms-api-extract-edit :is-read-only="isReadOnly" :reloadData="reloadData" :extract="extract"/>
</div>
<div class="extract-add">
<el-row :gutter="10">
<el-col :span="2">
<el-select :disabled="isReadOnly" class="extract-item" v-model="type" :placeholder="$t('api_test.request.extract.select_type')"
size="small">
<el-option :label="$t('api_test.request.extract.regex')" :value="options.REGEX"/>
<el-option label="JSONPath" :value="options.JSON_PATH"/>
<el-option label="XPath" :value="options.XPATH"/>
</el-select>
</el-col>
<el-col :span="22">
<ms-api-extract-common :is-read-only="isReadOnly" :extract-type="type" :list="list" v-if="type" :callback="after"/>
</el-col>
<el-button v-if="!type" :disabled="true" type="primary" size="small">Add</el-button>
</el-row>
</div>
<ms-api-extract-edit :is-read-only="isReadOnly" :reloadData="reloadData" :extract="extract"/>
</div>
</el-card>
</div>
</template>
@ -46,6 +47,11 @@
props: {
extract: {},
node: {},
customizeStyle: {
type: String,
default: "margin-top: 10px"
},
isReadOnly: {
type: Boolean,
default: false
@ -66,7 +72,7 @@
this.reloadData = getUUID().substring(0, 8);
},
remove() {
this.$emit('remove', this.extract);
this.$emit('remove', this.extract, this.node);
},
},

View File

@ -1,5 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="$t('api_test.api_import.title')" :visible.sync="visible" class="api-import" v-loading="result.loading" @close="close">
<el-dialog :close-on-click-modal="false" :title="$t('api_test.api_import.title')" width="30%"
:visible.sync="visible" class="api-import" v-loading="result.loading" @close="close">
<div class="header-bar">
<div>{{$t('api_test.api_import.data_format')}}</div>
@ -18,64 +19,35 @@
</div>
<el-form :model="formData" :rules="rules" label-width="100px" v-loading="result.loading" ref="form">
<el-row>
<el-col :span="11">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input size="small" class="name-input" v-model="formData.name" clearable show-word-limit/>
</el-form-item>
<el-form-item :label="$t('commons.project')" prop="projectId">
<el-select size="small" v-model="formData.projectId" class="project-select" clearable>
<el-option v-for="(project, index) in projects" :key="index" :label="project.name" :value="project.id"/>
</el-select>
</el-form-item>
<el-form-item v-if="useEnvironment || selectedPlatformValue == 'Swagger2'" :label="$t('api_test.environment.environment_config')" prop="environmentId">
<el-select v-if="showEnvironmentSelect" size="small" v-model="formData.environmentId" class="environment-select" clearable>
<el-option v-for="(environment, index) in environments" :key="index" :label="environment.name" :value="environment.id"/>
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">{{$t('api_test.environment.environment_config')}}</el-button>
<template v-slot:empty>
<div class="empty-environment">
<el-button :disabled="formData.projectId == ''" class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">{{$t('api_test.environment.environment_config')}}</el-button>
</div>
</template>
</el-select>
</el-form-item>
<el-form-item v-if="selectedPlatformValue != 'Swagger2'" prop="useEnvironment">
<el-checkbox v-model="useEnvironment">{{$t('api_test.environment.config_environment')}}</el-checkbox>
</el-form-item>
<el-form-item :label="'Swagger URL'" prop="wgerUrl" v-if="selectedPlatformValue == 'Swagger2' && swaggerUrlEable">
<el-input size="small" v-model="formData.swaggerUrl" clearable show-word-limit/>
</el-form-item>
<el-upload
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)"
class="api-upload"
drag
action=""
:http-request="upload"
:limit="1"
:beforeUpload="uploadValidate"
:on-remove="handleRemove"
:file-list="fileList"
:on-exceed="handleExceed"
multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text" v-html="$t('load_test.upload_tips')"></div>
<div class="el-upload__tip" slot="tip">{{$t('api_test.api_import.file_size_limit')}}</div>
</el-upload>
<el-form-item v-if="selectedPlatformValue == 'Swagger2'">
<el-switch
v-model="swaggerUrlEable"
:active-text="$t('api_test.api_import.swagger_url_import')">
</el-switch>
</el-form-item>
</el-col>
<el-form-item :label="'Swagger URL'" prop="wgerUrl" v-if="isSwagger2 && swaggerUrlEable" class="swagger-url">
<el-input size="small" v-model="formData.swaggerUrl" clearable show-word-limit/>
</el-form-item>
<el-form-item v-if="isSwagger2" class="swagger-enable" :class="{'swagger-url-disable': !swaggerUrlEable}">
<el-switch
v-model="swaggerUrlEable"
:active-text="$t('api_test.api_import.swagger_url_import')">
</el-switch>
</el-form-item>
<el-col :span="1" v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-divider direction="vertical"/>
</el-col>
<el-col :span="12" v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-upload
class="api-upload"
drag
action=""
:http-request="upload"
:limit="1"
:beforeUpload="uploadValidate"
:on-remove="handleRemove"
:file-list="fileList"
:on-exceed="handleExceed"
multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text" v-html="$t('load_test.upload_tips')"></div>
<div class="el-upload__tip" slot="tip">{{$t('api_test.api_import.file_size_limit')}}</div>
</el-upload>
</el-col>
</el-row>
</el-form>
<div class="format-tip">
@ -87,19 +59,16 @@
</div>
</div>
<api-environment-config ref="environmentConfig" @close="getEnvironments"/>
</el-dialog>
</template>
<script>
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
export default {
name: "ApiImport",
components: {ApiEnvironmentConfig, MsDialogFooter},
components: {MsDialogFooter},
data() {
return {
visible: false,
@ -135,31 +104,18 @@
environments: [],
useEnvironment: false,
formData: {
name: '',
environmentId: '',
projectId: '',
file: undefined,
swaggerUrl: ''
},
rules: {},
currentModule: {},
rules: {
name: [
{required: true, message: this.$t('commons.input_name'), trigger: 'blur'},
{max: 60, message: this.$t('commons.input_limit', [1, 60]), trigger: 'blur'}
],
environmentId: [
{required: true, message: this.$t('api_test.environment.select_environment'), trigger: 'blur'},
],
projectId: [
{required: true, message: this.$t('api_test.select_project'), trigger: 'blur'},
]
},
fileList: []
}
},
props: ['projectId'],
activated() {
this.selectedPlatform = this.platforms[0];
this.getProjects();
},
watch: {
selectedPlatformValue() {
@ -170,8 +126,10 @@
}
}
},
'formData.projectId'() {
this.getEnvironments();
},
computed: {
isSwagger2() {
return this.selectedPlatformValue === 'Swagger2';
}
},
methods: {
@ -195,63 +153,21 @@
this.$warning(this.$t('api_test.api_import.suffixFormatErr'));
return false;
}
if (file.size / 1024 / 1024 > 20) {
this.$warning(this.$t('test_track.case.import.upload_limit_size'));
return false;
}
return true;
},
getEnvironments() {
if (this.formData.projectId) {
this.$get('/api/environment/list/' + this.formData.projectId, response => {
this.environments = response.data;
let hasEnvironmentId = false;
this.environments.forEach(env => {
if (env.id === this.formData.environmentId) {
hasEnvironmentId = true;
}
});
if (!hasEnvironmentId) {
this.formData.environmentId = '';
}
});
} else {
this.environments = [];
this.formData.environmentId = '';
}
},
getProjects() {
this.result = this.$get("/project/listAll", response => {
this.projects = response.data;
})
},
openEnvironmentConfig() {
if (!this.formData.projectId) {
this.$error(this.$t('api_test.select_project'));
return;
}
this.showEnvironmentSelect = false;
this.$refs.environmentConfig.open(this.formData.projectId);
this.showEnvironmentSelect = true;
},
save() {
this.$refs.form.validate(valid => {
if (valid) {
let param = {};
Object.assign(param, this.formData);
param.platform = this.selectedPlatformValue;
param.useEnvironment = this.useEnvironment;
param.moduleId = this.currentModule.id;
param.modulePath = this.currentModule.path;
if ((this.selectedPlatformValue != 'Swagger2' || (this.selectedPlatformValue == 'Swagger2' && !this.swaggerUrlEable)) && !this.formData.file) {
this.$warning(this.$t('commons.please_upload'));
return;
}
if (!this.swaggerUrlEable) {
param.swaggerUrl = undefined;
}
this.result = this.$fileUpload('/api/definition/import', param.file, null, param, response => {
let param = this.buildParam();
this.result = this.$fileUpload('/api/definition/import', param.file, null, this.buildParam(), response => {
let res = response.data;
this.$success(this.$t('test_track.case.import.success'));
this.visible = false;
@ -262,11 +178,20 @@
}
});
},
buildParam() {
let param = {};
Object.assign(param, this.formData);
param.platform = this.selectedPlatformValue;
param.moduleId = this.currentModule.id;
param.modulePath = this.currentModule.path;
param.projectId = this.projectId;
if (!this.swaggerUrlEable) {
param.swaggerUrl = undefined;
}
return param;
},
close() {
this.formData = {
name: '',
environmentId: '',
projectId: '',
file: undefined,
swaggerUrl: ''
};
@ -280,6 +205,10 @@
<style scoped>
.api-import >>> .el-dialog {
min-width: 700px;
}
.format-tip {
background: #EDEDED;
}
@ -325,29 +254,18 @@
margin-left: 10px;
}
.environment-button {
margin-left: 20px;
padding: 7px;
}
.empty-environment {
padding: 10px 0px;
}
.el-form {
padding: 30px 10px;
}
.el-divider {
height: 200px;
}
.name-input {
max-width: 195px;
}
.dialog-footer {
float: right;
}
.swagger-url-disable {
margin-top: 10px;
margin-left: 80px;
}
</style>

View File

@ -36,6 +36,7 @@ export default class HTTPSamplerProxy extends Sampler {
this.arguments = [];
this.rest = [];
this.files = [];
this.headers = [];
}
}

View File

@ -35,7 +35,7 @@
</el-form-item>
<!-- 请求地址 -->
<el-form-item prop="url">
<el-form-item prop="path">
<el-input :placeholder="$t('api_test.definition.request.path_info')" v-model="api.request.path" class="ms-htt-width"
size="small" :disabled="false"/>
</el-form-item>
@ -59,7 +59,7 @@
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
<!-- HTTP 请求参数 -->
<ms-api-request-form :headers="api.request.hashTree[0].headers" :request="api.request"/>
<ms-api-request-form :headers="api.request.headers" :request="api.request"/>
</el-form>
<!--返回结果-->
@ -120,7 +120,7 @@
environments: [],
rules: {
method: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
url: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}],
path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}],
environmentId: [{required: true, message: this.$t('api_test.definition.request.run_env'), trigger: 'change'}],
},
runData: [],

View File

@ -34,8 +34,6 @@
:currentProject="currentProject" :loaded="loaded"
ref="caseList"/>
</el-drawer>
>
<!-- 环境 -->
<api-environment-config ref="environmentConfig" @close="environmentConfigClose"/>
<!-- 执行组件 -->

View File

@ -197,6 +197,16 @@ export class Test extends BaseConfig {
}
}
export class ScenarioObj extends BaseConfig {
constructor(options = {}) {
super();
this.id = undefined;
this.name = undefined;
this.type = "scenario";
this.hashTree = [];
}
}
export class Scenario extends BaseConfig {
constructor(options = {}) {
super();
@ -761,6 +771,7 @@ export class KeyValue extends BaseConfig {
export class Assertions extends BaseConfig {
constructor(options) {
super();
this.resourceId = uuid();
this.type = "Assertions";
this.text = [];
this.regex = [];
@ -830,6 +841,9 @@ export class BeanShellProcessor extends BaseConfig {
export class JSR223Processor extends BaseConfig {
constructor(options) {
super();
this.resourceId = uuid();
this.active = false;
this.type = "JSR223Processor";
this.script = undefined;
this.language = "beanshell";
this.set(options);
@ -901,6 +915,7 @@ export class Duration extends AssertionType {
export class Extract extends BaseConfig {
constructor(options) {
super();
this.resourceId = uuid();
this.type = "Extract";
this.regex = [];
this.json = [];
@ -968,6 +983,7 @@ export class Controller extends BaseConfig {
super();
this.type = type
options.id = options.id || uuid();
options.resourceId = options.resourceId || uuid();
options.enable = options.enable === undefined ? true : options.enable;
}
}
@ -975,10 +991,11 @@ export class Controller extends BaseConfig {
export class IfController extends Controller {
constructor(options = {}) {
super(Controller.TYPES.IF_CONTROLLER, options);
this.type = "IfController";
this.variable;
this.operator;
this.value;
this.hashTree = [];
this.set(options);
}
@ -1009,6 +1026,7 @@ export class Timer extends BaseConfig {
super();
this.type = type;
options.id = options.id || uuid();
options.resourceId = options.resourceId || uuid();
options.enable = options.enable === undefined ? true : options.enable;
}
}
@ -1017,7 +1035,8 @@ export class ConstantTimer extends Timer {
constructor(options = {}) {
super(Timer.TYPES.CONSTANT_TIMER, options);
this.delay;
this.type = "ConstantTimer";
this.hashTree = [];
this.set(options);
}

View File

@ -27,7 +27,6 @@
<el-form-item :label="$t('load_test.thread_num')">
<el-input-number
:disabled="isReadOnly"
:placeholder="$t('load_test.input_thread_num')"
v-model="threadGroup.threadNumber"
@change="calculateChart(threadGroup)"
:min="resourcePoolResourceLength"
@ -37,7 +36,6 @@
<el-form-item :label="$t('load_test.duration')">
<el-input-number
:disabled="isReadOnly"
:placeholder="$t('load_test.duration')"
v-model="threadGroup.duration"
:min="1"
@change="calculateChart(threadGroup)"
@ -49,7 +47,6 @@
&nbsp;
<el-input-number
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
:placeholder="$t('load_test.input_rps_limit')"
v-model="threadGroup.rpsLimit"
@change="calculateChart(threadGroup)"
:min="1"
@ -59,7 +56,6 @@
<el-form-item :label="$t('load_test.ramp_up_time_within')">
<el-input-number
:disabled="isReadOnly"
placeholder=""
:min="1"
:max="threadGroup.duration"
v-model="threadGroup.rampUpTime"
@ -69,7 +65,6 @@
<el-form-item :label="$t('load_test.ramp_up_time_minutes')">
<el-input-number
:disabled="isReadOnly"
placeholder=""
:min="1"
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
v-model="threadGroup.step"
@ -465,7 +460,13 @@ export default {
for (let i = 0; i < this.threadGroups.length; i++) {
if (!this.threadGroups[i].threadNumber || !this.threadGroups[i].duration
|| !this.threadGroups[i].rampUpTime || !this.threadGroups[i].step || !this.threadGroups[i].rpsLimit) {
|| !this.threadGroups[i].rampUpTime || !this.threadGroups[i].step) {
this.$warning(this.$t('load_test.pressure_config_params_is_empty'));
this.$emit('changeActive', '1');
return false;
}
if (this.threadGroups[i].rpsLimitEnable && !this.threadGroups[i].rpsLimit) {
this.$warning(this.$t('load_test.pressure_config_params_is_empty'));
this.$emit('changeActive', '1');
return false;

View File

@ -10,7 +10,7 @@
<img class="platform" src="../../../../assets/jira.png" alt="Jira"/>
</el-radio>
<el-radio label="Zentao">
<img class="platform" src="../../../../assets/zentao.jpg" alt="Zentao"/>
<img class="zentao_platform" src="../../../../assets/zentao.jpg" alt="Zentao"/>
</el-radio>
</el-radio-group>
</div>
@ -66,7 +66,12 @@ export default {
}
.platform {
height: 90px;
height: 80px;
vertical-align: middle
}
.zentao_platform {
height: 100px;
vertical-align: middle
}
</style>

View File

@ -2,8 +2,12 @@
<ms-container>
<ms-main-container>
<el-alert
:title="$t('organization.message.notes')"
type="info">
title="Notice:"
type="info"
show-icon>
<template v-slot:default>
{{ $t('organization.message.notes') }}
</template>
</el-alert>
<jenkins-notification :jenkins-receiver-options="jenkinsReceiverOptions"/>
<test-plan-task-notification :test-plan-receiver-options="testPlanReceiverOptions"/>

View File

@ -34,7 +34,6 @@ export default {
},
...requireContext.keys().map(key => requireContext(key).system),
...requireContext.keys().map(key => requireContext(key).license),
...requireContext.keys().map(key => requireContext(key).display),
{
path: 'organizationpmnmember',
component: () => import('@/business/components/settings/organization/OrganizationMember'),

View File

@ -11,6 +11,9 @@
<el-tab-pane :label="$t('system_parameter_setting.ldap_setting')" name="ldap">
<ldap-setting/>
</el-tab-pane>
<el-tab-pane v-if="hasLicense()" :label="$t('display.title')" name="display">
<ms-display/>
</el-tab-pane>
</el-tabs>
</el-card>
</template>
@ -19,17 +22,26 @@
import EmailSetting from "./EmailSetting";
import LdapSetting from "./LdapSetting";
import BaseSetting from "./BaseSetting";
import {hasLicense} from '@/common/js/utils';
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
export default {
name: "SystemParameterSetting",
components: {
BaseSetting,
EmailSetting, LdapSetting
EmailSetting,
LdapSetting,
"MsDisplay": display.default
},
data() {
return {
activeName: 'base'
activeName: 'base',
}
},
methods: {
hasLicense,
}
}
</script>

View File

@ -1,39 +1,25 @@
<template>
<ms-container>
<ms-aside-container>
<select-menu
:data="testPlans"
:current-data="currentPlan"
:title="$t('test_track.plan_view.plan')"
@dataChange="changePlan"/>
<node-tree class="node-tree"
v-loading="result.loading"
@nodeSelectEvent="nodeChange"
@refresh="refresh"
:tree-nodes="treeNodes"
:draggable="false"
ref="nodeTree"/>
</ms-aside-container>
<ms-main-container>
<test-plan-test-case-list
class="table-list"
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
ref="testPlanTestCaseList"/>
</ms-main-container>
<test-case-relevance
@refresh="refresh"
:plan-id="planId"
ref="testCaseRelevance"/>
</ms-container>
<div>
<ms-test-plan-header-bar>
<template v-slot:info>
<select-menu
:data="testPlans"
:current-data="currentPlan"
:title="$t('test_track.plan_view.plan')"
@dataChange="changePlan"/>
</template>
<template v-slot:menu>
<el-menu active-text-color="#6d317c" :default-active="activeIndex"
class="el-menu-demo header-menu" mode="horizontal" @select="handleSelect">
<el-menu-item index="functional">功能测试用例</el-menu-item>
<el-menu-item index="api">接口测试用例</el-menu-item>
</el-menu>
</template>
</ms-test-plan-header-bar>
<test-plan-functional v-if="activeIndex === 'functional'" :plan-id="planId"/>
<test-plan-api v-if="activeIndex === 'api'" :plan-id="planId"/>
</div>
</template>
@ -46,20 +32,23 @@
import MsContainer from "../../../common/components/MsContainer";
import MsAsideContainer from "../../../common/components/MsAsideContainer";
import MsMainContainer from "../../../common/components/MsMainContainer";
import MsTestPlanHeaderBar from "./comonents/head/TestPlanHeaderBar";
import TestPlanFunctional from "./comonents/functional/TestPlanFunctional";
import TestPlanApi from "./comonents/api/TestPlanApi";
export default {
name: "TestPlanView",
components: {
TestPlanApi,
TestPlanFunctional,
MsTestPlanHeaderBar,
MsMainContainer,
MsAsideContainer, MsContainer, NodeTree, TestPlanTestCaseList, TestCaseRelevance, SelectMenu},
data() {
return {
result: {},
testPlans: [],
currentPlan: {},
selectNodeIds: [],
selectParentNodes: [],
treeNodes: []
activeIndex: "functional"
}
},
computed: {
@ -68,33 +57,11 @@
}
},
mounted() {
this.initData();
this.openTestCaseEdit(this.$route.path);
},
watch: {
'$route'(to, from) {
this.openTestCaseEdit(to.path);
},
planId() {
this.initData();
}
this.getTestPlans();
},
methods: {
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId();
},
initData() {
this.getTestPlans();
this.getNodeTreeByPlanId();
},
openTestCaseRelevanceDialog() {
this.$refs.testCaseRelevance.openTestCaseRelevanceDialog();
},
getTestPlans() {
this.result = this.$post('/test/plan/list/all', {}, response => {
this.$post('/test/plan/list/all', {}, response => {
this.testPlans = response.data;
this.testPlans.forEach(plan => {
if (this.planId && plan.id === this.planId) {
@ -103,39 +70,36 @@
});
});
},
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
// node
this.$refs.testPlanTestCaseList.currentPage = 1;
this.$refs.testPlanTestCaseList.pageSize = 10;
},
changePlan(plan) {
this.currentPlan = plan;
this.$router.push('/track/plan/view/' + plan.id);
},
getNodeTreeByPlanId() {
if(this.planId){
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
this.treeNodes = response.data;
});
}
},
openTestCaseEdit(path) {
if (path.indexOf("/plan/view/edit") >= 0){
let caseId = this.$route.params.caseId;
this.$get('/test/plan/case/get/' + caseId, response => {
let testCase = response.data;
if (testCase) {
this.$refs.testPlanTestCaseList.handleEdit(testCase);
this.$router.push('/track/plan/view/' + testCase.planId);
}
});
}
handleSelect(key) {
this.activeIndex = key;
}
}
}
</script>
<style scoped>
.select-menu {
display: inline-block;
}
.ms-main-container {
height: calc(100vh - 80px - 50px);
}
.ms-aside-container {
height: calc(100vh - 80px - 51px);
margin-top: 1px;
}
.header-menu.el-menu--horizontal > li {
height: 49px;
line-height: 50px;
color: dimgray;
}
</style>

View File

@ -0,0 +1,29 @@
<template>
<ms-container>
<ms-aside-container>
<slot name="aside"></slot>
</ms-aside-container>
<ms-main-container>
<slot name="main"></slot>
</ms-main-container>
<slot></slot>
</ms-container>
</template>
<script>
import MsMainContainer from "../../../../common/components/MsMainContainer";
import MsAsideContainer from "../../../../common/components/MsAsideContainer";
import MsContainer from "../../../../common/components/MsContainer";
export default {
name: "MsTestPlanCommonComponent",
components: {MsContainer, MsAsideContainer, MsMainContainer}
}
</script>
<style scoped>
</style>

View File

@ -472,6 +472,7 @@ export default {
this.getTestCase(this.index);
},
getTestCase(index) {
this.testCase = {};
let testCase = this.testCases[index];
// id TestPlanTestCase id
this.result = this.$get('/test/plan/case/get/' + testCase.id, response => {
@ -495,11 +496,10 @@ export default {
this.testCase = item;
this.getRelatedTest();
this.initTest();
this.getIssues(item.caseId);
this.stepResultChange();
this.getFileMetaData(item);
})
this.getIssues(testCase.caseId);
this.stepResultChange();
this.getFileMetaData(testCase);
},
getFileMetaData(testCase) {
this.tableData = [];

View File

@ -0,0 +1,115 @@
<template>
<ms-test-plan-common-component>
<template v-slot:aside>
<node-tree class="node-tree"
v-loading="result.loading"
@nodeSelectEvent="nodeChange"
@refresh="refresh"
:tree-nodes="treeNodes"
:draggable="false"
ref="nodeTree"/>
</template>
<template v-slot:main>
<test-plan-test-case-list
class="table-list"
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
ref="testPlanTestCaseList"/>
</template>
<test-case-relevance
@refresh="refresh"
:plan-id="planId"
ref="testCaseRelevance"/>
</ms-test-plan-common-component>
</template>
<script>
import NodeTree from "../../../../common/NodeTree";
import TestPlanTestCaseList from "../TestPlanTestCaseList";
import TestCaseRelevance from "../TestCaseRelevance";
import MsTestPlanCommonComponent from "../TestPlanCommonComponent";
export default {
name: "TestPlanApi",
components: {
MsTestPlanCommonComponent,
TestCaseRelevance,
TestPlanTestCaseList,
NodeTree,
},
data() {
return {
result: {},
selectNodeIds: [],
selectParentNodes: [],
treeNodes: [],
}
},
props: [
'planId'
],
mounted() {
this.initData();
this.openTestCaseEdit(this.$route.path);
},
watch: {
'$route'(to, from) {
this.openTestCaseEdit(to.path);
},
planId() {
this.initData();
}
},
methods: {
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId();
},
initData() {
this.getNodeTreeByPlanId();
},
openTestCaseRelevanceDialog() {
this.$refs.testCaseRelevance.openTestCaseRelevanceDialog();
},
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
// node
this.$refs.testPlanTestCaseList.currentPage = 1;
this.$refs.testPlanTestCaseList.pageSize = 10;
},
getNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
this.treeNodes = response.data;
});
}
},
openTestCaseEdit(path) {
if (path.indexOf("/plan/view/edit") >= 0) {
let caseId = this.$route.params.caseId;
this.$get('/test/plan/case/get/' + caseId, response => {
let testCase = response.data;
if (testCase) {
this.$refs.testPlanTestCaseList.handleEdit(testCase);
this.$router.push('/track/plan/view/' + testCase.planId);
}
});
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,115 @@
<template>
<ms-test-plan-common-component>
<template v-slot:aside>
<node-tree class="node-tree"
v-loading="result.loading"
@nodeSelectEvent="nodeChange"
@refresh="refresh"
:tree-nodes="treeNodes"
:draggable="false"
ref="nodeTree"/>
</template>
<template v-slot:main>
<test-plan-test-case-list
class="table-list"
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
ref="testPlanTestCaseList"/>
</template>
<test-case-relevance
@refresh="refresh"
:plan-id="planId"
ref="testCaseRelevance"/>
</ms-test-plan-common-component>
</template>
<script>
import NodeTree from "../../../../common/NodeTree";
import TestPlanTestCaseList from "../TestPlanTestCaseList";
import TestCaseRelevance from "../TestCaseRelevance";
import MsTestPlanCommonComponent from "../TestPlanCommonComponent";
export default {
name: "TestPlanFunctional",
components: {
MsTestPlanCommonComponent,
TestCaseRelevance,
TestPlanTestCaseList,
NodeTree,
},
data() {
return {
result: {},
selectNodeIds: [],
selectParentNodes: [],
treeNodes: [],
}
},
props: [
'planId'
],
mounted() {
this.initData();
this.openTestCaseEdit(this.$route.path);
},
watch: {
'$route'(to, from) {
this.openTestCaseEdit(to.path);
},
planId() {
this.initData();
}
},
methods: {
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId();
},
initData() {
this.getNodeTreeByPlanId();
},
openTestCaseRelevanceDialog() {
this.$refs.testCaseRelevance.openTestCaseRelevanceDialog();
},
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
// node
this.$refs.testPlanTestCaseList.currentPage = 1;
this.$refs.testPlanTestCaseList.pageSize = 10;
},
getNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
this.treeNodes = response.data;
});
}
},
openTestCaseEdit(path) {
if (path.indexOf("/plan/view/edit") >= 0) {
let caseId = this.$route.params.caseId;
this.$get('/test/plan/case/get/' + caseId, response => {
let testCase = response.data;
if (testCase) {
this.$refs.testPlanTestCaseList.handleEdit(testCase);
this.$router.push('/track/plan/view/' + testCase.planId);
}
});
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,51 @@
<template>
<div class="test-plan-header-bar">
<div class="header-info">
<slot name="info"></slot>
</div>
<div class="menu-ul">
<slot name="menu"></slot>
</div>
</div>
</template>
<script>
import SelectMenu from "../../../../common/SelectMenu";
export default {
name: "MsTestPlanHeaderBar",
components: {SelectMenu},
data() {
return {
}
},
props: {
},
methods: {
}
}
</script>
<style scoped>
.test-plan-header-bar {
height: 50px;
background-color: white;
}
.header-info {
height: 50px;
width: 300px;
line-height: 50px;
vertical-align: top;
display: inline-block;
}
.menu-ul {
width: 500px;
display: inline-block;
}
</style>

View File

@ -102,10 +102,11 @@
<el-col class="test-detail" :span="20" :offset="1">
<el-tabs v-model="activeTab" type="border-card">
<el-tab-pane name="detail" :label="$t('test_track.plan_view.test_detail')">
<api-test-detail :is-read-only="true" v-if="testCase.type === 'api'" @runTest="testRun"
<api-test-detail :is-read-only="true" v-if="testCase.type === 'api'"
:id="testCase.testId" ref="apiTestDetail"/>
<performance-test-detail :is-read-only="true" v-if="testCase.type === 'performance'"
@runTest="testRun" :id="testCase.testId"
<performance-test-detail v-if="testCase.type === 'performance'"
:is-read-only="true"
:id="testCase.testId"
ref="performanceTestDetail"/>
</el-tab-pane>
</el-tabs>
@ -211,7 +212,6 @@
<test-case-attachment :table-data="tableData"
:read-only="false"
:is-delete="false"
@handleDelete="handleDelete"
/>
</div>
</el-col>
@ -338,20 +338,26 @@ export default {
this.getTestCase(this.index);
},
getTestCase(index) {
this.testCase = {};
let testCase = this.testCases[index];
let item = {};
Object.assign(item, testCase);
item.steps = JSON.parse(item.steps);
item.steptResults = [];
for (let i = 0; i < item.steps.length; i++) {
item.steps[i].actualResult = '';
item.steps[i].executeResult = '';
item.steptResults.push(item.steps[i]);
}
this.testCase = item;
this.getComments(item);
this.initTest();
this.getFileMetaData(testCase);
this.result = this.$get("/test/review/case/get/" + testCase.id, response => {
let item = {};
let data = response.data;
Object.assign(item, data);
item.steps = JSON.parse(item.steps);
item.steptResults = [];
for (let i = 0; i < item.steps.length; i++) {
item.steps[i].actualResult = '';
item.steps[i].executeResult = '';
item.steptResults.push(item.steps[i]);
}
this.testCase = item;
this.getRelatedTest();
this.getComments(item);
this.initTest();
this.getFileMetaData(data);
})
},
getFileMetaData(testCase) {
this.tableData = [];
@ -375,21 +381,16 @@ export default {
},
initTest() {
this.$nextTick(() => {
if (this.testCase.method === 'auto') {
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type === 'performance') {
this.$refs.performanceTestDetail.init();
if (this.testCase.testId && this.testCase.testId !== 'other') {
if (this.testCase.method === 'auto') {
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type === 'performance') {
this.$refs.performanceTestDetail.init();
}
}
}
});
},
testRun(reportId) {
this.testCase.reportId = reportId;
this.saveReport(reportId);
},
saveReport(reportId) {
},
getComments(testCase) {
let id = '';
@ -403,13 +404,12 @@ export default {
})
},
initData(testCase) {
this.result = this.$post('/test/review/case/list/all', this.searchParam, response => {
this.result = this.$post('/test/review/case/list/ids', this.searchParam, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
this.getRelatedTest();
}
}
});
@ -439,9 +439,6 @@ export default {
}).length > 0;
}
},
handleDelete() {
}
}
}
</script>

View File

@ -11,7 +11,7 @@ import YanProgress from 'yan-progress';
import './permission' // permission control
import i18n from "../i18n/i18n";
import store from "./store";
import {permission, roles} from './permission'
import {permission, roles, xpack} from './permission'
import chart from "../common/js/chart";
import CalendarHeatmap from "../common/js/calendar-heatmap";
import '../common/css/menu-header.css';
@ -37,6 +37,8 @@ Vue.directive('permission', permission);
// v-roles
Vue.directive('roles', roles);
Vue.directive('xpack', xpack);
new Vue({
el: '#app',
router,

View File

@ -1,6 +1,6 @@
import router from './components/common/router/router'
import {TokenKey} from '@/common/js/constants';
import {hasRolePermissions, hasRoles} from "@/common/js/utils";
import {hasLicense, hasRolePermissions, hasRoles} from "@/common/js/utils";
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
const whiteList = ['/login']; // no redirect whitelist
@ -19,6 +19,20 @@ export const roles = {
}
};
export const xpack = {
inserted(el, binding) {
checkLicense(el, binding);
}
};
function checkLicense(el, binding, type) {
let v = hasLicense()
if (v) {
el.parentNode && el.parentNode.removeChild(el)
}
}
function checkRolePermission(el, binding, type) {
const {value} = binding;
if (value && value instanceof Array && value.length > 0) {

View File

@ -1,12 +1,12 @@
import {
LicenseKey,
REFRESH_SESSION_USER_URL,
ROLE_ORG_ADMIN,
ROLE_ADMIN,
ROLE_ORG_ADMIN,
ROLE_TEST_MANAGER,
ROLE_TEST_USER,
ROLE_TEST_VIEWER,
TokenKey,
LicenseKey
TokenKey
} from "./constants";
import axios from "axios";
import {jsPDF} from "jspdf";
@ -45,6 +45,11 @@ export function hasRolePermission(role) {
return false
}
export function hasLicense() {
let v = localStorage.getItem(LicenseKey);
return v === 'valid';
}
//是否含有对应组织或工作空间的角色
export function hasRolePermissions(...roles) {
for (let role of roles) {
@ -238,7 +243,7 @@ export function exportPdf(name, canvasList) {
// html页面生成的canvas在pdf中图片的宽高
let imgWidth = a4Width;
let imgHeight = a4Width/contentWidth * contentHeight;
let imgHeight = a4Width / contentWidth * contentHeight;
let pageData = canvas.toDataURL('image/jpeg', 1.0);
@ -251,7 +256,7 @@ export function exportPdf(name, canvasList) {
if (leftHeight > blankHeight) {
//页面偏移
let position = 0;
while(leftHeight > 0) {
while (leftHeight > 0) {
// 本次添加占用的高度
let occupation = a4Height - currentHeight;
pdf.addImage(pageData, 'JPEG', 0, position + currentHeight, imgWidth, imgHeight);
@ -259,7 +264,7 @@ export function exportPdf(name, canvasList) {
leftHeight -= occupation;
position -= occupation;
//避免添加空白页
if(leftHeight > 0) {
if (leftHeight > 0) {
pdf.addPage();
currentHeight = 0;
}
@ -277,15 +282,15 @@ export function exportPdf(name, canvasList) {
export function windowPrint(id, zoom) {
//根据div标签ID拿到div中的局部内容
let bdhtml=window.document.body.innerHTML;
let bdhtml = window.document.body.innerHTML;
let el = document.getElementById(id);
var jubuData = el.innerHTML;
document.getElementsByTagName('body')[0].style.zoom=zoom;
document.getElementsByTagName('body')[0].style.zoom = zoom;
//把获取的 局部div内容赋给body标签, 相当于重置了 body里的内容
window.document.body.innerHTML= jubuData;
window.document.body.innerHTML = jubuData;
//调用打印功能
window.print();
window.document.body.innerHTML=bdhtml;//重新给页面内容赋值;
window.document.body.innerHTML = bdhtml;//重新给页面内容赋值;
return false;
}

View File

@ -236,7 +236,7 @@ export default {
mail: 'mail',
nail_robot: 'Nail robot',
enterprise_wechat_robot: 'Enterprise wechat robot',
notes: 'Note: 1. Nail and create a custom robot in the enterprise group, and then copy the webhook address on our platform;\n' +
notes: '1. Nail and create a custom robot in the enterprise group, and then copy the webhook address on our platform;\n' +
'\n' +
'2. Robots are selected as swarm robots, and "custom keyword" is selected for security verification: "task notification";\n' +
'\n' +
@ -526,9 +526,23 @@ export default {
post_script: "Postscript",
extract_param: "Extract parameters",
add_module: "Add module",
}
},
automation: {
follow_people: "Follow people",
create_tag: "Create tag",
scenario_step: "Scenario step",
step_total: "Step total",
scenario_total: "Scene public parameters",
api_list_import: "Interface list import",
external_import: "External import",
wait_controller: "Waiting for controller",
if_controller: "Condition controller",
scenario_import: "Scene import",
customize_script: "Custom script",
customize_req: "Custom request",
reference_info: "Please select interface or use case",
},
environment: {
name: "Environment Name",
socket: "Socket",

View File

@ -237,7 +237,7 @@ export default {
mail: '邮件',
nail_robot: '钉钉机器人',
enterprise_wechat_robot: '企业微信机器人',
notes: '注意:1.钉钉和企业群里新建一个自定义机器人,然后复制 webhook 地址在我们平台上;\n' +
notes: '1.钉钉和企业群里新建一个自定义机器人,然后复制 webhook 地址在我们平台上;\n' +
' 2.机器人选择为群机器人,安全验证选择“自定义关键词” "任务通知";\n' +
' 3.选择接收人时必须是你所建的群里包含的人,接收人手机号为必填项且为钉钉企业所使用的手机号,',
message: '事件,接收人,接收方式为必填项',
@ -527,10 +527,22 @@ export default {
post_script: "后置脚本",
extract_param: "提取参数",
add_module: "创建模块",
}
},
automation: {
follow_people: "关注人",
create_tag: "创建Tag",
scenario_step: "场景步骤",
step_total: "步骤总数",
scenario_total: "场景公共参数",
api_list_import: "接口列表导入",
external_import: "外部导入",
wait_controller: "等待控制器",
if_controller: "条件控制器",
scenario_import: "场景导入",
customize_script: "自定义脚本",
customize_req: "自定义请求",
reference_info: "请选择接口或用例",
scenario_test: "场景",
add_scenario: "创建场景",
scenario_name: "场景名称",

View File

@ -237,7 +237,7 @@ export default {
mail: '郵件',
nail_robot: '釘釘機器人',
enterprise_wechat_robot: '企業微信機器人',
notes: '註意: 1.事件,接收方式,接收人為必填項;\n' +
notes: '1.事件,接收方式,接收人為必填項;\n' +
' 2.接收方式除郵件外webhook為必填\n' +
' 3.機器人選擇為群機器人,安全驗證選擇“自定義關鍵詞” "任務通知"',
message: '事件,接收人,接收方式為必填項',
@ -529,6 +529,22 @@ export default {
add_module: "創建模塊",
}
},
automation: {
follow_people: "關註人",
create_tag: "創建Tag",
scenario_step: "場景步驟",
step_total: "步驟總數",
scenario_total: "場景公共參數",
api_list_import: "接口列表導入",
external_import: "外部導入",
wait_controller: "等待控制器",
if_controller: "條件控制器",
scenario_import: "場景導入",
customize_script: "自定義腳本",
customize_req: "自定義請求",
reference_info: "請選擇接口或用例"
},
environment: {
name: "環境名稱",
socket: "環境域名",