feat: 版本管理

This commit is contained in:
CaptainB 2021-11-30 18:29:57 +08:00 committed by 刘瑞斌
parent 0ee0a4b6b0
commit 22a21ac3dd
113 changed files with 5436 additions and 1655 deletions

View File

@ -174,7 +174,7 @@ public class ApiAutomationController {
}
@GetMapping("/getApiScenario/{id}")
public ApiScenarioWithBLOBs getScenarioDefinition(@PathVariable String id) {
public ApiScenarioDTO getScenarioDefinition(@PathVariable String id) {
return apiAutomationService.getApiScenario(id);
}
@ -381,5 +381,20 @@ public class ApiAutomationController {
public void saveFollows(@PathVariable String scenarioId, @RequestBody List<String> follows) {
apiAutomationService.saveFollows(scenarioId, follows);
}
@GetMapping("versions/{scenarioId}")
public List<ApiScenarioDTO> getApiScenarioVersions(@PathVariable String scenarioId) {
return apiAutomationService.getApiScenarioVersions(scenarioId);
}
@GetMapping("get/{version}/{refId}")
public ApiScenarioDTO getApiScenario(@PathVariable String version, @PathVariable String refId) {
return apiAutomationService.getApiScenarioByVersion(refId, version);
}
@GetMapping("delete/{version}/{refId}")
public void deleteApiScenario(@PathVariable String version, @PathVariable String refId) {
apiAutomationService.deleteApiScenarioByVersion(refId, version);
}
}

View File

@ -347,9 +347,24 @@ public class ApiDefinitionController {
apiDefinitionService.saveFollows(definitionId, follows);
}
@GetMapping("/getWorkerQueue")
public String getWorkerQueue() {
return execThreadPoolExecutor.getWorkerQueue();
}
@GetMapping("versions/{definitionId}")
public List<ApiDefinitionResult> getApiDefinitionVersions(@PathVariable String definitionId) {
return apiDefinitionService.getApiDefinitionVersions(definitionId);
}
@GetMapping("get/{version}/{refId}")
public ApiDefinitionResult getApiDefinition(@PathVariable String version, @PathVariable String refId) {
return apiDefinitionService.getApiDefinitionByVersion(refId, version);
}
@GetMapping("delete/{version}/{refId}")
public void deleteApiDefinition(@PathVariable String version, @PathVariable String refId) {
apiDefinitionService.deleteApiDefinitionByVersion(refId, version);
}
}

View File

@ -126,7 +126,7 @@ public class ApiTestCaseController {
}
@GetMapping("/get/{id}")
public ApiTestCaseWithBLOBs get(@PathVariable String id) {
public ApiTestCaseInfo get(@PathVariable String id) {
return apiTestCaseService.get(id);
}

View File

@ -17,6 +17,8 @@ public class ApiScenarioDTO extends ApiScenarioWithBLOBs {
private String principalName;
private List<String> tagNames;
private String deleteUser;
private String versionName;
private Boolean versionEnable;
/**
* 场景跨项目ID

View File

@ -23,6 +23,8 @@ public class ApiScenarioRequest extends BaseQueryRequest {
private String executeStatus;
private boolean notInTestPlan;
private String reviewId;
private String versionId;
private String refId;
//操作人
private String operator;

View File

@ -64,4 +64,5 @@ public class SaveApiScenarioRequest {
private String environmentJson;
private String environmentGroupId;
private String versionId;
}

View File

@ -21,6 +21,8 @@ public class ApiDefinitionRequest extends BaseQueryRequest {
private String status;
private String apiCaseCoverage;
private String reviewId;
private String refId;
private String versionId;
// 测试计划是否允许重复
private boolean repeatCase;

View File

@ -29,4 +29,8 @@ public class ApiDefinitionResult extends ApiDefinitionWithBLOBs {
private String scenarioType;
private String apiType;
private String versionName;
private Boolean versionEnable;
}

View File

@ -17,4 +17,5 @@ public class ApiTestCaseDTO extends ApiTestCase {
private String passRate;
private String projectName;
private String execResult;
private String versionName;
}

View File

@ -8,4 +8,6 @@ import lombok.Setter;
@Getter
public class ApiTestCaseInfo extends ApiTestCaseWithBLOBs {
private String apiMethod;
private String versionName;
private Boolean versionEnable;
}

View File

@ -33,6 +33,8 @@ public class ApiTestCaseRequest extends BaseQueryRequest {
private String reviewId;
private String deleteUserId;
private long deleteTime;
private String refId;
private String versionId;
/**
* 检查待更新的近三天有更新的或者状态为error的
*/

View File

@ -46,6 +46,8 @@ public class SaveApiDefinitionRequest {
private String remark;
private String versionId;
private Schedule schedule;
private String triggerMode;

View File

@ -23,6 +23,8 @@ public class SaveApiTestCaseRequest extends ApiTestCase {
private List<String> follows;
private String versionId;
//ESB参数 可为null
private String esbDataStruct;
private String backEsbDataStruct;

View File

@ -36,4 +36,7 @@ public class ApiDocumentInfoDTO {
private String responseCode;
private boolean sharePopoverVisible = false;
private String refId;
private String versionId;
}

View File

@ -21,4 +21,6 @@ public class ApiDocumentRequest {
private String orderCondition;
private List<String> apiIdList;
private boolean trashEnable;
private String refId;
private String versionId;
}

View File

@ -39,10 +39,7 @@ import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.api.AutomationReference;
import io.metersphere.plugin.core.MsTestElement;
import io.metersphere.service.EnvironmentGroupProjectService;
import io.metersphere.service.QuotaService;
import io.metersphere.service.RelationshipEdgeService;
import io.metersphere.service.ScheduleService;
import io.metersphere.service.*;
import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
@ -133,6 +130,8 @@ public class ApiAutomationService {
private EnvironmentGroupProjectService environmentGroupProjectService;
@Resource
private ApiScenarioExecuteService apiScenarioExecuteService;
@Resource
private ExtProjectVersionMapper extProjectVersionMapper;
private ThreadLocal<Long> currentScenarioOrder = new ThreadLocal<>();
@ -248,7 +247,7 @@ public class ApiAutomationService {
List<ApiMethodUrlDTO> useUrl = this.parseUrl(scenario);
scenario.setUseUrl(JSONArray.toJSONString(useUrl));
scenario.setOrder(ServiceUtils.getNextOrder(scenario.getProjectId(), extApiScenarioMapper::getLastOrder));
scenario.setRefId(request.getId());
//检查场景的请求步骤如果含有ESB请求步骤的话要做参数计算处理
esbApiParamService.checkScenarioRequests(request);
@ -353,7 +352,23 @@ public class ApiAutomationService {
deleteUpdateBodyFile(scenario, beforeScenario);
List<ApiMethodUrlDTO> useUrl = this.parseUrl(scenario);
scenario.setUseUrl(JSONArray.toJSONString(useUrl));
apiScenarioMapper.updateByPrimaryKeySelective(scenario);
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdEqualTo(scenario.getId()).andVersionIdEqualTo(request.getVersionId());
if (apiScenarioMapper.updateByExampleSelective(scenario, example) == 0) {
// 插入新版本的数据
scenario.setId(UUID.randomUUID().toString());
scenario.setVersionId(request.getVersionId());
scenario.setCreateTime(System.currentTimeMillis());
scenario.setUpdateTime(System.currentTimeMillis());
scenario.setCreateUser(SessionUtils.getUserId());
scenario.setOrder(beforeScenario.getOrder());
scenario.setNum(beforeScenario.getNum());
scenario.setRefId(beforeScenario.getRefId());
apiScenarioMapper.insertSelective(scenario);
}
apiScenarioReferenceIdService.saveByApiScenario(scenario);
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name同步到修改首页定时任务
uploadFiles(request, bodyFiles, scenarioFiles);
@ -439,6 +454,11 @@ public class ApiAutomationService {
}
}
saveFollows(scenario.getId(), request.getFollows());
if (StringUtils.isEmpty(request.getVersionId())) {
scenario.setVersionId(extProjectVersionMapper.getDefaultVersion(request.getProjectId()));
} else {
scenario.setVersionId(request.getVersionId());
}
return scenario;
}
@ -457,10 +477,19 @@ public class ApiAutomationService {
}
public void delete(String id) {
//及连删除外键表
this.preDelete(id);
testPlanScenarioCaseService.deleteByScenarioId(id);
apiScenarioMapper.deleteByPrimaryKey(id);
ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(id);
if (scenario == null) {
return;
}
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andRefIdEqualTo(scenario.getRefId());
List<ApiScenario> apiScenarios = apiScenarioMapper.selectByExample(example);
apiScenarios.forEach(s -> {
//及连删除外键表
this.preDelete(s.getId());
testPlanScenarioCaseService.deleteByScenarioId(s.getId());
apiScenarioMapper.deleteByPrimaryKey(s.getId());
});
}
private void deleteFollows(String id) {
@ -483,8 +512,7 @@ public class ApiAutomationService {
List<TestPlanApiScenario> testPlanApiScenarioList = testPlanApiScenarioMapper.selectByExample(example);
List<String> idList = new ArrayList<>(testPlanApiScenarioList.size());
for (TestPlanApiScenario api :
testPlanApiScenarioList) {
for (TestPlanApiScenario api : testPlanApiScenarioList) {
idList.add(api.getId());
}
example = new TestPlanApiScenarioExample();
@ -505,15 +533,6 @@ public class ApiAutomationService {
deleteBodyFile(scenarioDefinition);
}
public void deleteBodyFileByScenarioIds(List<String> ids) {
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(ids);
List<ApiScenarioWithBLOBs> apiScenarios = apiScenarioMapper.selectByExampleWithBLOBs(example);
apiScenarios.forEach((item) -> {
deleteBodyFile(item.getScenarioDefinition());
});
}
public void deleteBodyFile(String scenarioDefinition) {
MsTestElement msTestElement = GenerateHashTreeUtil.parseScenarioDefinition(scenarioDefinition);
List<MsHTTPSamplerProxy> httpSampleFromHashTree = MsHTTPSamplerProxy.findHttpSampleFromHashTree(msTestElement);
@ -539,59 +558,51 @@ public class ApiAutomationService {
}
}
public void preDeleteBatch(List<String> scenarioIds) {
deleteApiScenarioReport(scenarioIds);
List<String> testPlanApiScenarioIdList = new ArrayList<>();
for (String id : scenarioIds) {
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
example.createCriteria().andApiScenarioIdEqualTo(id);
List<TestPlanApiScenario> testPlanApiScenarioList = testPlanApiScenarioMapper.selectByExample(example);
for (TestPlanApiScenario api : testPlanApiScenarioList) {
if (!testPlanApiScenarioIdList.contains(api.getId())) {
testPlanApiScenarioIdList.add(api.getId());
}
}
scheduleService.deleteByResourceId(id, ScheduleGroup.API_SCENARIO_TEST.name());
deleteFollows(id);
}
if (!testPlanApiScenarioIdList.isEmpty()) {
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
example.createCriteria().andIdIn(testPlanApiScenarioIdList);
testPlanApiScenarioMapper.deleteByExample(example);
}
// 删除引用关系
relationshipEdgeService.delete(scenarioIds);
deleteBodyFileByScenarioIds(scenarioIds);
}
public void deleteBatch(List<String> ids) {
// 删除外键表
preDeleteBatch(ids);
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(ids);
apiScenarioMapper.deleteByExample(example);
List<ApiScenario> apiScenarios = apiScenarioMapper.selectByExample(example);
apiScenarios.forEach(apiScenario -> this.delete(apiScenario.getId()));
}
public void removeToGc(List<String> apiIds) {
ApiScenarioExampleWithOperation example = new ApiScenarioExampleWithOperation();
example.createCriteria().andIdIn(apiIds);
example.setOperator(SessionUtils.getUserId());
example.setOperationTime(System.currentTimeMillis());
extApiScenarioMapper.removeToGcByExample(example);
//将这些场景的定时任务删除掉
for (String id : apiIds) {
scheduleService.deleteByResourceId(id, ScheduleGroup.API_SCENARIO_TEST.name());
ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(id);
if (scenario == null) {
return;
}
ApiScenarioExampleWithOperation example = new ApiScenarioExampleWithOperation();
example.createCriteria().andRefIdEqualTo(scenario.getRefId());
example.setOperator(SessionUtils.getUserId());
example.setOperationTime(System.currentTimeMillis());
extApiScenarioMapper.removeToGcByExample(example);
ApiScenarioRequest request = new ApiScenarioRequest();
request.setRefId(scenario.getRefId());
List<String> scenarioIds = extApiScenarioMapper.selectIdsByQuery(request);
//将这些场景的定时任务删除掉
scenarioIds.forEach(scenarioId -> scheduleService.deleteByResourceId(scenarioId, ScheduleGroup.API_SCENARIO_TEST.name()));
}
}
public void reduction(List<String> ids) {
if (CollectionUtils.isNotEmpty(ids)) {
extApiScenarioMapper.checkOriginalStatusByIds(ids);
if (CollectionUtils.isEmpty(ids)) {
return;
}
ids.forEach(id -> {
ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(id);
if (scenario == null) {
return;
}
ApiScenarioRequest request = new ApiScenarioRequest();
request.setRefId(scenario.getRefId());
HashMap<String, List<String>> filters = new HashMap<>();
filters.put("status", Collections.singletonList(ScenarioStatus.Trash.name()));
request.setFilters(filters);
List<String> scenarioIds = extApiScenarioMapper.selectIdsByQuery(request);
extApiScenarioMapper.checkOriginalStatusByIds(scenarioIds);
//检查原来模块是否还在
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(ids);
example.createCriteria().andIdIn(scenarioIds);
List<ApiScenario> scenarioList = apiScenarioMapper.selectByExample(example);
Map<String, List<ApiScenario>> nodeMap = new HashMap<>();
for (ApiScenario api : scenarioList) {
@ -630,20 +641,28 @@ public class ApiAutomationService {
}
}
}
extApiScenarioMapper.reduction(ids);
}
extApiScenarioMapper.reduction(scenarioIds);
});
}
private void checkNameExist(SaveApiScenarioRequest request) {
if (StringUtils.isEmpty(request.getVersionId())) {
request.setVersionId(extProjectVersionMapper.getDefaultVersion(request.getProjectId()));
}
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andStatusNotEqualTo("Trash").andIdNotEqualTo(request.getId());
example.createCriteria().andNameEqualTo(request.getName())
.andProjectIdEqualTo(request.getProjectId())
.andStatusNotEqualTo("Trash")
.andIdNotEqualTo(request.getId())
.andVersionIdEqualTo(request.getVersionId());
if (apiScenarioMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("automation_name_already_exists"));
}
}
public ApiScenarioWithBLOBs getApiScenario(String id) {
return apiScenarioMapper.selectByPrimaryKey(id);
public ApiScenarioDTO getApiScenario(String id) {
return extApiScenarioMapper.selectById(id);
}
public String setDomain(ApiScenarioEnvRequest request) {
@ -1929,4 +1948,31 @@ public class ApiAutomationService {
public List<MsExecResponseDTO> run(RunScenarioRequest request) {
return apiScenarioExecuteService.run(request);
}
public List<ApiScenarioDTO> getApiScenarioVersions(String scenarioId) {
ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(scenarioId);
if (scenario == null) {
return new ArrayList<>();
}
ApiScenarioRequest request = new ApiScenarioRequest();
request.setRefId(scenario.getRefId());
return this.list(request);
}
public ApiScenarioDTO getApiScenarioByVersion(String refId, String versionId) {
ApiScenarioRequest request = new ApiScenarioRequest();
request.setRefId(refId);
request.setVersionId(versionId);
List<ApiScenarioDTO> list = this.list(request);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0);
}
public void deleteApiScenarioByVersion(String refId, String version) {
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
apiScenarioMapper.deleteByExample(example);
}
}

View File

@ -121,6 +121,8 @@ public class ApiDefinitionService {
@Resource
@Lazy
private TestPlanService testPlanService;
@Resource
private ExtProjectVersionMapper extProjectVersionMapper;
private ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
private ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
@ -277,7 +279,7 @@ public class ApiDefinitionService {
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
mockConfigService.updateMockReturnMsgByApi(returnModel);
FileUtils.createBodyFiles(request.getRequest().getId(), bodyFiles);
return getBLOBs(request.getId());
return getBLOBs(returnModel.getId());
}
private void checkQuota() {
@ -288,16 +290,25 @@ public class ApiDefinitionService {
}
public void delete(String apiId) {
apiTestCaseService.deleteTestCase(apiId);
deleteFileByTestId(apiId);
extApiDefinitionExecResultMapper.deleteByResourceId(apiId);
apiDefinitionMapper.deleteByPrimaryKey(apiId);
esbApiParamService.deleteByResourceId(apiId);
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
mockConfigService.deleteMockConfigByApiId(apiId);
relationshipEdgeService.delete(apiId); // 删除关系图
FileUtils.deleteBodyFiles(apiId);
deleteFollows(apiId);
ApiDefinition apiDefinition = get(apiId);
if (apiDefinition == null) {
return;
}
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andRefIdEqualTo(apiDefinition.getRefId());
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
apiDefinitions.forEach(api -> {
apiTestCaseService.deleteTestCase(api.getId());
deleteFileByTestId(api.getId());
extApiDefinitionExecResultMapper.deleteByResourceId(api.getId());
apiDefinitionMapper.deleteByPrimaryKey(api.getId());
esbApiParamService.deleteByResourceId(api.getId());
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
mockConfigService.deleteMockConfigByApiId(api.getId());
relationshipEdgeService.delete(api.getId()); // 删除关系图
FileUtils.deleteBodyFiles(api.getId());
deleteFollows(api.getId());
});
}
private void deleteFollows(String apiId) {
@ -324,90 +335,116 @@ public class ApiDefinitionService {
if (CollectionUtils.isEmpty(apiIds)) {
return;
}
ApiDefinitionExampleWithOperation example = new ApiDefinitionExampleWithOperation();
example.createCriteria().andIdIn(apiIds);
example.setOperator(SessionUtils.getUserId());
example.setOperationTime(System.currentTimeMillis());
extApiDefinitionMapper.removeToGcByExample(example);
apiIds.forEach(apiId -> {
// 把所有版本的api移到回收站
ApiDefinitionWithBLOBs api = apiDefinitionMapper.selectByPrimaryKey(apiId);
if (api == null) {
return;
}
ApiDefinitionExampleWithOperation example = new ApiDefinitionExampleWithOperation();
example.createCriteria().andRefIdEqualTo(api.getRefId());
example.setOperator(SessionUtils.getUserId());
example.setOperationTime(System.currentTimeMillis());
extApiDefinitionMapper.removeToGcByExample(example);
List<String> apiCaseIds = apiTestCaseService.selectCaseIdsByApiIds(apiIds);
if (CollectionUtils.isNotEmpty(apiCaseIds)) {
ApiTestBatchRequest apiTestBatchRequest = new ApiTestBatchRequest();
apiTestBatchRequest.setIds(apiCaseIds);
apiTestBatchRequest.setUnSelectIds(new ArrayList<>());
apiTestCaseService.deleteToGcByParam(apiTestBatchRequest);
}
ApiDefinitionRequest request = new ApiDefinitionRequest();
request.setRefId(api.getRefId());
List<String> ids = extApiDefinitionMapper.selectIds(request);
// 把所有版本的api case移到回收站
List<String> apiCaseIds = apiTestCaseService.selectCaseIdsByApiIds(ids);
if (CollectionUtils.isNotEmpty(apiCaseIds)) {
ApiTestBatchRequest apiTestBatchRequest = new ApiTestBatchRequest();
apiTestBatchRequest.setIds(apiCaseIds);
apiTestBatchRequest.setUnSelectIds(new ArrayList<>());
apiTestCaseService.deleteToGcByParam(apiTestBatchRequest);
}
});
}
public void reduction(ApiBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiDefinitionMapper.selectIds(query));
if (request.getIds() != null || !request.getIds().isEmpty()) {
//检查原来模块是否还在
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andIdIn(request.getIds());
List<ApiDefinition> reductionCaseList = apiDefinitionMapper.selectByExample(example);
Map<String, List<ApiDefinition>> nodeMap = new HashMap<>();
for (ApiDefinition api : reductionCaseList) {
//检查是否同名
SaveApiDefinitionRequest apiDefinitionRequest = new SaveApiDefinitionRequest();
apiDefinitionRequest.setProjectId(request.getProjectId());
apiDefinitionRequest.setMethod(api.getMethod());
apiDefinitionRequest.setProtocol(api.getProtocol());
apiDefinitionRequest.setPath(api.getPath());
apiDefinitionRequest.setName(api.getName());
apiDefinitionRequest.setId(api.getId());
checkNameExist(apiDefinitionRequest);
String moduleId = api.getModuleId();
if (StringUtils.isEmpty(moduleId)) {
moduleId = "";
request.getIds().forEach(apiId -> {
ApiDefinitionWithBLOBs api = apiDefinitionMapper.selectByPrimaryKey(apiId);
if (api == null) {
return;
}
if (nodeMap.containsKey(moduleId)) {
nodeMap.get(moduleId).add(api);
} else {
List<ApiDefinition> list = new ArrayList<>();
list.add(api);
nodeMap.put(moduleId, list);
}
}
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
for (Map.Entry<String, List<ApiDefinition>> entry : nodeMap.entrySet()) {
String nodeId = entry.getKey();
long nodeCount = apiModuleService.countById(nodeId);
if (nodeCount <= 0) {
String projectId = request.getProjectId();
ApiModule node = apiModuleService.getDefaultNode(projectId, request.getProtocol());
for (ApiDefinition apiDefinition : entry.getValue()) {
ApiDefinitionWithBLOBs updateCase = new ApiDefinitionWithBLOBs();
updateCase.setId(apiDefinition.getId());
updateCase.setModuleId(node.getId());
updateCase.setModulePath("/" + node.getName());
//检查原来模块是否还在
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andRefIdEqualTo(api.getRefId());
List<ApiDefinition> reductionCaseList = apiDefinitionMapper.selectByExample(example);
Map<String, List<ApiDefinition>> nodeMap = new HashMap<>();
List<String> reductionIds = new ArrayList<>();
for (ApiDefinition apiDefinition : reductionCaseList) {
//检查是否同名
SaveApiDefinitionRequest apiDefinitionRequest = new SaveApiDefinitionRequest();
apiDefinitionRequest.setProjectId(request.getProjectId());
apiDefinitionRequest.setMethod(apiDefinition.getMethod());
apiDefinitionRequest.setProtocol(apiDefinition.getProtocol());
apiDefinitionRequest.setPath(apiDefinition.getPath());
apiDefinitionRequest.setName(apiDefinition.getName());
apiDefinitionRequest.setId(apiDefinition.getId());
apiDefinitionRequest.setVersionId(extProjectVersionMapper.getDefaultVersion(request.getProjectId()));
checkNameExist(apiDefinitionRequest);
apiDefinitionMapper.updateByPrimaryKeySelective(updateCase);
String moduleId = apiDefinition.getModuleId();
if (StringUtils.isEmpty(moduleId)) {
moduleId = "";
}
if (nodeMap.containsKey(moduleId)) {
nodeMap.get(moduleId).add(apiDefinition);
} else {
List<ApiDefinition> list = new ArrayList<>();
list.add(apiDefinition);
nodeMap.put(moduleId, list);
}
reductionIds.add(apiDefinition.getId());
}
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
for (Map.Entry<String, List<ApiDefinition>> entry : nodeMap.entrySet()) {
String nodeId = entry.getKey();
long nodeCount = apiModuleService.countById(nodeId);
if (nodeCount <= 0) {
String projectId = request.getProjectId();
ApiModule node = apiModuleService.getDefaultNode(projectId, request.getProtocol());
for (ApiDefinition apiDefinition : entry.getValue()) {
ApiDefinitionWithBLOBs updateCase = new ApiDefinitionWithBLOBs();
updateCase.setId(apiDefinition.getId());
updateCase.setModuleId(node.getId());
updateCase.setModulePath("/" + node.getName());
apiDefinitionMapper.updateByPrimaryKeySelective(updateCase);
}
}
}
}
extApiDefinitionMapper.checkOriginalStatusByIds(request.getIds());
extApiDefinitionMapper.reduction(request.getIds());
extApiDefinitionMapper.checkOriginalStatusByIds(reductionIds);
extApiDefinitionMapper.reduction(reductionIds);
List<String> apiCaseIds = apiTestCaseService.selectCaseIdsByApiIds(reductionIds);
if (CollectionUtils.isNotEmpty(apiCaseIds)) {
ApiTestBatchRequest apiTestBatchRequest = new ApiTestBatchRequest();
apiTestBatchRequest.setIds(apiCaseIds);
apiTestBatchRequest.setUnSelectIds(new ArrayList<>());
apiTestCaseService.reduction(apiTestBatchRequest);
}
});
List<String> apiCaseIds = apiTestCaseService.selectCaseIdsByApiIds(request.getIds());
if (CollectionUtils.isNotEmpty(apiCaseIds)) {
ApiTestBatchRequest apiTestBatchRequest = new ApiTestBatchRequest();
apiTestBatchRequest.setIds(apiCaseIds);
apiTestBatchRequest.setUnSelectIds(new ArrayList<>());
apiTestCaseService.reduction(apiTestBatchRequest);
}
}
}
private void checkNameExist(SaveApiDefinitionRequest request) {
if (StringUtils.isEmpty(request.getVersionId())) {
request.setVersionId(extProjectVersionMapper.getDefaultVersion(request.getProjectId()));
}
ApiDefinitionExample example = new ApiDefinitionExample();
if (StringUtils.isNotEmpty(request.getProtocol()) && request.getProtocol().equals(RequestType.HTTP)) {
ApiDefinitionExample.Criteria criteria = example.createCriteria();
criteria.andMethodEqualTo(request.getMethod()).andStatusNotEqualTo("Trash")
.andProtocolEqualTo(request.getProtocol()).andPathEqualTo(request.getPath())
.andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
.andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId())
.andVersionIdEqualTo(request.getVersionId());
Project project = projectMapper.selectByPrimaryKey(request.getProjectId());
if (project != null && project.getRepeatable() != null && project.getRepeatable()) {
criteria.andNameEqualTo(request.getName());
@ -418,7 +455,7 @@ public class ApiDefinitionService {
} else {
example.createCriteria().andProtocolEqualTo(request.getProtocol()).andStatusNotEqualTo("Trash")
.andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId())
.andIdNotEqualTo(request.getId());
.andIdNotEqualTo(request.getId()).andVersionIdEqualTo(request.getVersionId());
if (apiDefinitionMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("load_test_already_exists"));
}
@ -502,7 +539,23 @@ public class ApiDefinitionService {
test.setTags("");
}
this.setModule(test);
apiDefinitionMapper.updateByPrimaryKeySelective(test);
// 更新数据
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andIdEqualTo(test.getId()).andVersionIdEqualTo(request.getVersionId());
if (apiDefinitionMapper.updateByExampleSelective(test, example) == 0) {
// 插入新版本的数据
ApiDefinitionWithBLOBs oldApi = apiDefinitionMapper.selectByPrimaryKey(test.getId());
test.setId(UUID.randomUUID().toString());
test.setNum(oldApi.getNum());
test.setVersionId(request.getVersionId());
test.setCreateTime(System.currentTimeMillis());
test.setUpdateTime(System.currentTimeMillis());
test.setCreateUser(SessionUtils.getUserId());
test.setOrder(oldApi.getOrder());
test.setRefId(oldApi.getRefId());
apiDefinitionMapper.insertSelective(test);
}
// 同步修改用例路径
if (StringUtils.equals(test.getProtocol(), "HTTP")) {
@ -550,6 +603,8 @@ public class ApiDefinitionService {
test.setModuleId(request.getModuleId());
test.setRemark(request.getRemark());
test.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extApiDefinitionMapper::getLastOrder));
test.setRefId(request.getId());
test.setVersionId(request.getVersionId());
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(test.getProjectId()).andProtocolEqualTo(test.getProtocol()).andNameEqualTo("未规划接口");
@ -624,6 +679,8 @@ public class ApiDefinitionService {
apiDefinition.setOrder(getImportNextOrder(apiTestImportRequest.getProjectId()));
String originId = apiDefinition.getId();
apiDefinition.setId(UUID.randomUUID().toString());
apiDefinition.setRefId(apiDefinition.getId());
apiDefinition.setVersionId(extProjectVersionMapper.getDefaultVersion(apiTestImportRequest.getProjectId()));
batchMapper.insert(apiDefinition);
String requestStr = setImportHashTree(apiDefinition);
reSetImportCasesApiId(cases, originId, apiDefinition.getId());
@ -663,6 +720,8 @@ public class ApiDefinitionService {
String originId = apiDefinition.getId();
if (CollectionUtils.isEmpty(sameRequest)) {
apiDefinition.setId(UUID.randomUUID().toString());
apiDefinition.setRefId(apiDefinition.getId());
apiDefinition.setVersionId(extProjectVersionMapper.getDefaultVersion(apiTestImportRequest.getProjectId()));
apiDefinition.setOrder(getImportNextOrder(apiTestImportRequest.getProjectId()));
reSetImportCasesApiId(cases, originId, apiDefinition.getId());
reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum());
@ -1696,4 +1755,31 @@ public class ApiDefinitionService {
}
return elements;
}
public List<ApiDefinitionResult> getApiDefinitionVersions(String definitionId) {
ApiDefinitionWithBLOBs definition = apiDefinitionMapper.selectByPrimaryKey(definitionId);
if (definition == null) {
return new ArrayList<>();
}
ApiDefinitionRequest request = new ApiDefinitionRequest();
request.setRefId(definition.getRefId());
return this.list(request);
}
public ApiDefinitionResult getApiDefinitionByVersion(String refId, String versionId) {
ApiDefinitionRequest request = new ApiDefinitionRequest();
request.setRefId(refId);
request.setVersionId(versionId);
List<ApiDefinitionResult> list = this.list(request);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0);
}
public void deleteApiDefinitionByVersion(String refId, String version) {
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
apiDefinitionMapper.deleteByExample(example);
}
}

View File

@ -552,6 +552,6 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
public long countTrashApiData(String projectId, String protocol) {
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andStatusEqualTo("Trash");
return apiDefinitionMapper.countByExample(example);
return extApiDefinitionMapper.countByExample(example);
}
}

View File

@ -210,7 +210,7 @@ public class ApiTestCaseService {
}
}
public ApiTestCaseWithBLOBs get(String id) {
public ApiTestCaseInfo get(String id) {
// ApiTestCaseWithBLOBs returnBlobs = apiTestCaseMapper.selectByPrimaryKey(id);
ApiTestCaseInfo model = extApiTestCaseMapper.selectApiCaseInfoByPrimaryKey(id);
if (model != null) {
@ -359,6 +359,7 @@ public class ApiTestCaseService {
test.setUpdateTime(System.currentTimeMillis());
test.setDescription(request.getDescription());
test.setVersion(request.getVersion() == null ? 0 : request.getVersion() + 1);
test.setVersionId(request.getVersionId());
if (StringUtils.equals("[]", request.getTags())) {
test.setTags("");
} else {
@ -413,6 +414,7 @@ public class ApiTestCaseService {
test.setDescription(request.getDescription());
test.setNum(getNextNum(request.getApiDefinitionId()));
test.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extApiTestCaseMapper::getLastOrder));
test.setVersionId(request.getVersionId());
if (StringUtils.equals("[]", request.getTags())) {
test.setTags("");
} else {

View File

@ -13,6 +13,10 @@ public class ApiDefinition implements Serializable {
private String method;
private String protocol;
private String path;
private String modulePath;
private String environmentId;
@ -29,10 +33,6 @@ public class ApiDefinition implements Serializable {
private Long updateTime;
private String protocol;
private String path;
private Integer num;
private String tags;
@ -53,5 +53,9 @@ public class ApiDefinition implements Serializable {
private Long order;
private String versionId;
private String refId;
private static final long serialVersionUID = 1L;
}

View File

@ -384,6 +384,146 @@ public class ApiDefinitionExample {
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 Criteria andModulePathIsNull() {
addCriterion("module_path is null");
return (Criteria) this;
@ -924,146 +1064,6 @@ public class ApiDefinitionExample {
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 Criteria andNumIsNull() {
addCriterion("num is null");
return (Criteria) this;
@ -1733,6 +1733,146 @@ public class ApiDefinitionExample {
addCriterion("`order` not between", value1, value2, "order");
return (Criteria) this;
}
public Criteria andVersionIdIsNull() {
addCriterion("version_id is null");
return (Criteria) this;
}
public Criteria andVersionIdIsNotNull() {
addCriterion("version_id is not null");
return (Criteria) this;
}
public Criteria andVersionIdEqualTo(String value) {
addCriterion("version_id =", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotEqualTo(String value) {
addCriterion("version_id <>", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThan(String value) {
addCriterion("version_id >", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThanOrEqualTo(String value) {
addCriterion("version_id >=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThan(String value) {
addCriterion("version_id <", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThanOrEqualTo(String value) {
addCriterion("version_id <=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLike(String value) {
addCriterion("version_id like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotLike(String value) {
addCriterion("version_id not like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdIn(List<String> values) {
addCriterion("version_id in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotIn(List<String> values) {
addCriterion("version_id not in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdBetween(String value1, String value2) {
addCriterion("version_id between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotBetween(String value1, String value2) {
addCriterion("version_id not between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andRefIdIsNull() {
addCriterion("ref_id is null");
return (Criteria) this;
}
public Criteria andRefIdIsNotNull() {
addCriterion("ref_id is not null");
return (Criteria) this;
}
public Criteria andRefIdEqualTo(String value) {
addCriterion("ref_id =", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotEqualTo(String value) {
addCriterion("ref_id <>", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdGreaterThan(String value) {
addCriterion("ref_id >", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdGreaterThanOrEqualTo(String value) {
addCriterion("ref_id >=", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLessThan(String value) {
addCriterion("ref_id <", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLessThanOrEqualTo(String value) {
addCriterion("ref_id <=", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLike(String value) {
addCriterion("ref_id like", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotLike(String value) {
addCriterion("ref_id not like", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdIn(List<String> values) {
addCriterion("ref_id in", values, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotIn(List<String> values) {
addCriterion("ref_id not in", values, "refId");
return (Criteria) this;
}
public Criteria andRefIdBetween(String value1, String value2) {
addCriterion("ref_id between", value1, value2, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotBetween(String value1, String value2) {
addCriterion("ref_id not between", value1, value2, "refId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -27,6 +27,8 @@ public class ApiDefinitionExecResult implements Serializable {
private String triggerMode;
private String versionId;
private String content;
private static final long serialVersionUID = 1L;

View File

@ -843,6 +843,76 @@ public class ApiDefinitionExecResultExample {
addCriterion("trigger_mode not between", value1, value2, "triggerMode");
return (Criteria) this;
}
public Criteria andVersionIdIsNull() {
addCriterion("version_id is null");
return (Criteria) this;
}
public Criteria andVersionIdIsNotNull() {
addCriterion("version_id is not null");
return (Criteria) this;
}
public Criteria andVersionIdEqualTo(String value) {
addCriterion("version_id =", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotEqualTo(String value) {
addCriterion("version_id <>", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThan(String value) {
addCriterion("version_id >", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThanOrEqualTo(String value) {
addCriterion("version_id >=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThan(String value) {
addCriterion("version_id <", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThanOrEqualTo(String value) {
addCriterion("version_id <=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLike(String value) {
addCriterion("version_id like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotLike(String value) {
addCriterion("version_id not like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdIn(List<String> values) {
addCriterion("version_id in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotIn(List<String> values) {
addCriterion("version_id not in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdBetween(String value1, String value2) {
addCriterion("version_id between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotBetween(String value1, String value2) {
addCriterion("version_id not between", value1, value2, "versionId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -61,5 +61,9 @@ public class ApiScenario implements Serializable {
private String environmentGroupId;
private String versionId;
private String refId;
private static final long serialVersionUID = 1L;
}

View File

@ -1983,6 +1983,146 @@ public class ApiScenarioExample {
addCriterion("environment_group_id not between", value1, value2, "environmentGroupId");
return (Criteria) this;
}
public Criteria andVersionIdIsNull() {
addCriterion("version_id is null");
return (Criteria) this;
}
public Criteria andVersionIdIsNotNull() {
addCriterion("version_id is not null");
return (Criteria) this;
}
public Criteria andVersionIdEqualTo(String value) {
addCriterion("version_id =", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotEqualTo(String value) {
addCriterion("version_id <>", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThan(String value) {
addCriterion("version_id >", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThanOrEqualTo(String value) {
addCriterion("version_id >=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThan(String value) {
addCriterion("version_id <", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThanOrEqualTo(String value) {
addCriterion("version_id <=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLike(String value) {
addCriterion("version_id like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotLike(String value) {
addCriterion("version_id not like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdIn(List<String> values) {
addCriterion("version_id in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotIn(List<String> values) {
addCriterion("version_id not in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdBetween(String value1, String value2) {
addCriterion("version_id between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotBetween(String value1, String value2) {
addCriterion("version_id not between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andRefIdIsNull() {
addCriterion("ref_id is null");
return (Criteria) this;
}
public Criteria andRefIdIsNotNull() {
addCriterion("ref_id is not null");
return (Criteria) this;
}
public Criteria andRefIdEqualTo(String value) {
addCriterion("ref_id =", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotEqualTo(String value) {
addCriterion("ref_id <>", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdGreaterThan(String value) {
addCriterion("ref_id >", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdGreaterThanOrEqualTo(String value) {
addCriterion("ref_id >=", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLessThan(String value) {
addCriterion("ref_id <", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLessThanOrEqualTo(String value) {
addCriterion("ref_id <=", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLike(String value) {
addCriterion("ref_id like", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotLike(String value) {
addCriterion("ref_id not like", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdIn(List<String> values) {
addCriterion("ref_id in", values, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotIn(List<String> values) {
addCriterion("ref_id not in", values, "refId");
return (Criteria) this;
}
public Criteria andRefIdBetween(String value1, String value2) {
addCriterion("ref_id between", value1, value2, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotBetween(String value1, String value2) {
addCriterion("ref_id not between", value1, value2, "refId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -43,5 +43,7 @@ public class ApiTestCase implements Serializable {
private String caseStatus;
private String versionId;
private static final long serialVersionUID = 1L;
}

View File

@ -1373,6 +1373,76 @@ public class ApiTestCaseExample {
addCriterion("case_status not between", value1, value2, "caseStatus");
return (Criteria) this;
}
public Criteria andVersionIdIsNull() {
addCriterion("version_id is null");
return (Criteria) this;
}
public Criteria andVersionIdIsNotNull() {
addCriterion("version_id is not null");
return (Criteria) this;
}
public Criteria andVersionIdEqualTo(String value) {
addCriterion("version_id =", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotEqualTo(String value) {
addCriterion("version_id <>", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThan(String value) {
addCriterion("version_id >", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThanOrEqualTo(String value) {
addCriterion("version_id >=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThan(String value) {
addCriterion("version_id <", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThanOrEqualTo(String value) {
addCriterion("version_id <=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLike(String value) {
addCriterion("version_id like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotLike(String value) {
addCriterion("version_id not like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdIn(List<String> values) {
addCriterion("version_id in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotIn(List<String> values) {
addCriterion("version_id not in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdBetween(String value1, String value2) {
addCriterion("version_id between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotBetween(String value1, String value2) {
addCriterion("version_id not between", value1, value2, "versionId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -1,8 +1,9 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTest implements Serializable {
private String id;
@ -33,5 +34,9 @@ public class LoadTest implements Serializable {
private Long order;
private String versionId;
private String refId;
private static final long serialVersionUID = 1L;
}

View File

@ -1033,6 +1033,146 @@ public class LoadTestExample {
addCriterion("`order` not between", value1, value2, "order");
return (Criteria) this;
}
public Criteria andVersionIdIsNull() {
addCriterion("version_id is null");
return (Criteria) this;
}
public Criteria andVersionIdIsNotNull() {
addCriterion("version_id is not null");
return (Criteria) this;
}
public Criteria andVersionIdEqualTo(String value) {
addCriterion("version_id =", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotEqualTo(String value) {
addCriterion("version_id <>", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThan(String value) {
addCriterion("version_id >", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThanOrEqualTo(String value) {
addCriterion("version_id >=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThan(String value) {
addCriterion("version_id <", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThanOrEqualTo(String value) {
addCriterion("version_id <=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLike(String value) {
addCriterion("version_id like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotLike(String value) {
addCriterion("version_id not like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdIn(List<String> values) {
addCriterion("version_id in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotIn(List<String> values) {
addCriterion("version_id not in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdBetween(String value1, String value2) {
addCriterion("version_id between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotBetween(String value1, String value2) {
addCriterion("version_id not between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andRefIdIsNull() {
addCriterion("ref_id is null");
return (Criteria) this;
}
public Criteria andRefIdIsNotNull() {
addCriterion("ref_id is not null");
return (Criteria) this;
}
public Criteria andRefIdEqualTo(String value) {
addCriterion("ref_id =", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotEqualTo(String value) {
addCriterion("ref_id <>", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdGreaterThan(String value) {
addCriterion("ref_id >", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdGreaterThanOrEqualTo(String value) {
addCriterion("ref_id >=", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLessThan(String value) {
addCriterion("ref_id <", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLessThanOrEqualTo(String value) {
addCriterion("ref_id <=", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLike(String value) {
addCriterion("ref_id like", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotLike(String value) {
addCriterion("ref_id not like", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdIn(List<String> values) {
addCriterion("ref_id in", values, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotIn(List<String> values) {
addCriterion("ref_id not in", values, "refId");
return (Criteria) this;
}
public Criteria andRefIdBetween(String value1, String value2) {
addCriterion("ref_id between", value1, value2, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotBetween(String value1, String value2) {
addCriterion("ref_id not between", value1, value2, "refId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -33,13 +33,15 @@ public class LoadTestReport implements Serializable {
private String testName;
private String testResourcePoolId;
private Long testStartTime;
private Long testEndTime;
private Long testDuration;
private String testResourcePoolId;
private String versionId;
private static final long serialVersionUID = 1L;
}

View File

@ -1064,6 +1064,76 @@ public class LoadTestReportExample {
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIsNull() {
addCriterion("test_resource_pool_id is null");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIsNotNull() {
addCriterion("test_resource_pool_id is not null");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdEqualTo(String value) {
addCriterion("test_resource_pool_id =", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotEqualTo(String value) {
addCriterion("test_resource_pool_id <>", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdGreaterThan(String value) {
addCriterion("test_resource_pool_id >", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdGreaterThanOrEqualTo(String value) {
addCriterion("test_resource_pool_id >=", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLessThan(String value) {
addCriterion("test_resource_pool_id <", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLessThanOrEqualTo(String value) {
addCriterion("test_resource_pool_id <=", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLike(String value) {
addCriterion("test_resource_pool_id like", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotLike(String value) {
addCriterion("test_resource_pool_id not like", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIn(List<String> values) {
addCriterion("test_resource_pool_id in", values, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotIn(List<String> values) {
addCriterion("test_resource_pool_id not in", values, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdBetween(String value1, String value2) {
addCriterion("test_resource_pool_id between", value1, value2, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotBetween(String value1, String value2) {
addCriterion("test_resource_pool_id not between", value1, value2, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestStartTimeIsNull() {
addCriterion("test_start_time is null");
return (Criteria) this;
@ -1244,73 +1314,73 @@ public class LoadTestReportExample {
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIsNull() {
addCriterion("test_resource_pool_id is null");
public Criteria andVersionIdIsNull() {
addCriterion("version_id is null");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIsNotNull() {
addCriterion("test_resource_pool_id is not null");
public Criteria andVersionIdIsNotNull() {
addCriterion("version_id is not null");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdEqualTo(String value) {
addCriterion("test_resource_pool_id =", value, "testResourcePoolId");
public Criteria andVersionIdEqualTo(String value) {
addCriterion("version_id =", value, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotEqualTo(String value) {
addCriterion("test_resource_pool_id <>", value, "testResourcePoolId");
public Criteria andVersionIdNotEqualTo(String value) {
addCriterion("version_id <>", value, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdGreaterThan(String value) {
addCriterion("test_resource_pool_id >", value, "testResourcePoolId");
public Criteria andVersionIdGreaterThan(String value) {
addCriterion("version_id >", value, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdGreaterThanOrEqualTo(String value) {
addCriterion("test_resource_pool_id >=", value, "testResourcePoolId");
public Criteria andVersionIdGreaterThanOrEqualTo(String value) {
addCriterion("version_id >=", value, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLessThan(String value) {
addCriterion("test_resource_pool_id <", value, "testResourcePoolId");
public Criteria andVersionIdLessThan(String value) {
addCriterion("version_id <", value, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLessThanOrEqualTo(String value) {
addCriterion("test_resource_pool_id <=", value, "testResourcePoolId");
public Criteria andVersionIdLessThanOrEqualTo(String value) {
addCriterion("version_id <=", value, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLike(String value) {
addCriterion("test_resource_pool_id like", value, "testResourcePoolId");
public Criteria andVersionIdLike(String value) {
addCriterion("version_id like", value, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotLike(String value) {
addCriterion("test_resource_pool_id not like", value, "testResourcePoolId");
public Criteria andVersionIdNotLike(String value) {
addCriterion("version_id not like", value, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIn(List<String> values) {
addCriterion("test_resource_pool_id in", values, "testResourcePoolId");
public Criteria andVersionIdIn(List<String> values) {
addCriterion("version_id in", values, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotIn(List<String> values) {
addCriterion("test_resource_pool_id not in", values, "testResourcePoolId");
public Criteria andVersionIdNotIn(List<String> values) {
addCriterion("version_id not in", values, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdBetween(String value1, String value2) {
addCriterion("test_resource_pool_id between", value1, value2, "testResourcePoolId");
public Criteria andVersionIdBetween(String value1, String value2) {
addCriterion("version_id between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotBetween(String value1, String value2) {
addCriterion("test_resource_pool_id not between", value1, value2, "testResourcePoolId");
public Criteria andVersionIdNotBetween(String value1, String value2) {
addCriterion("version_id not between", value1, value2, "versionId");
return (Criteria) this;
}
}

View File

@ -45,13 +45,15 @@ public class Project implements Serializable {
private String azureFilterId;
private String apiQuick;
private Boolean casePublic;
private Boolean versionEnable;
private String platform;
private Boolean thirdPartTemplate;
private Boolean casePublic;
private String apiQuick;
private static final long serialVersionUID = 1L;
}

View File

@ -1434,133 +1434,63 @@ public class ProjectExample {
return (Criteria) this;
}
public Criteria andApiQuickIsNull() {
addCriterion("api_quick is null");
public Criteria andVersionEnableIsNull() {
addCriterion("version_enable is null");
return (Criteria) this;
}
public Criteria andApiQuickIsNotNull() {
addCriterion("api_quick is not null");
public Criteria andVersionEnableIsNotNull() {
addCriterion("version_enable is not null");
return (Criteria) this;
}
public Criteria andApiQuickEqualTo(String value) {
addCriterion("api_quick =", value, "apiQuick");
public Criteria andVersionEnableEqualTo(Boolean value) {
addCriterion("version_enable =", value, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickNotEqualTo(String value) {
addCriterion("api_quick <>", value, "apiQuick");
public Criteria andVersionEnableNotEqualTo(Boolean value) {
addCriterion("version_enable <>", value, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThan(String value) {
addCriterion("api_quick >", value, "apiQuick");
public Criteria andVersionEnableGreaterThan(Boolean value) {
addCriterion("version_enable >", value, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThanOrEqualTo(String value) {
addCriterion("api_quick >=", value, "apiQuick");
public Criteria andVersionEnableGreaterThanOrEqualTo(Boolean value) {
addCriterion("version_enable >=", value, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickLessThan(String value) {
addCriterion("api_quick <", value, "apiQuick");
public Criteria andVersionEnableLessThan(Boolean value) {
addCriterion("version_enable <", value, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickLessThanOrEqualTo(String value) {
addCriterion("api_quick <=", value, "apiQuick");
public Criteria andVersionEnableLessThanOrEqualTo(Boolean value) {
addCriterion("version_enable <=", value, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickLike(String value) {
addCriterion("api_quick like", value, "apiQuick");
public Criteria andVersionEnableIn(List<Boolean> values) {
addCriterion("version_enable in", values, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickNotLike(String value) {
addCriterion("api_quick not like", value, "apiQuick");
public Criteria andVersionEnableNotIn(List<Boolean> values) {
addCriterion("version_enable not in", values, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickIn(List<String> values) {
addCriterion("api_quick in", values, "apiQuick");
public Criteria andVersionEnableBetween(Boolean value1, Boolean value2) {
addCriterion("version_enable between", value1, value2, "versionEnable");
return (Criteria) this;
}
public Criteria andApiQuickNotIn(List<String> values) {
addCriterion("api_quick not in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickBetween(String value1, String value2) {
addCriterion("api_quick between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotBetween(String value1, String value2) {
addCriterion("api_quick not between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andCasePublicIsNull() {
addCriterion("case_public is null");
return (Criteria) this;
}
public Criteria andCasePublicIsNotNull() {
addCriterion("case_public is not null");
return (Criteria) this;
}
public Criteria andCasePublicEqualTo(Boolean value) {
addCriterion("case_public =", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotEqualTo(Boolean value) {
addCriterion("case_public <>", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThan(Boolean value) {
addCriterion("case_public >", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThanOrEqualTo(Boolean value) {
addCriterion("case_public >=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThan(Boolean value) {
addCriterion("case_public <", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThanOrEqualTo(Boolean value) {
addCriterion("case_public <=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicIn(List<Boolean> values) {
addCriterion("case_public in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotIn(List<Boolean> values) {
addCriterion("case_public not in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicBetween(Boolean value1, Boolean value2) {
addCriterion("case_public between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotBetween(Boolean value1, Boolean value2) {
addCriterion("case_public not between", value1, value2, "casePublic");
public Criteria andVersionEnableNotBetween(Boolean value1, Boolean value2) {
addCriterion("version_enable not between", value1, value2, "versionEnable");
return (Criteria) this;
}
@ -1693,6 +1623,136 @@ public class ProjectExample {
addCriterion("third_part_template not between", value1, value2, "thirdPartTemplate");
return (Criteria) this;
}
public Criteria andCasePublicIsNull() {
addCriterion("case_public is null");
return (Criteria) this;
}
public Criteria andCasePublicIsNotNull() {
addCriterion("case_public is not null");
return (Criteria) this;
}
public Criteria andCasePublicEqualTo(Boolean value) {
addCriterion("case_public =", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotEqualTo(Boolean value) {
addCriterion("case_public <>", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThan(Boolean value) {
addCriterion("case_public >", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicGreaterThanOrEqualTo(Boolean value) {
addCriterion("case_public >=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThan(Boolean value) {
addCriterion("case_public <", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicLessThanOrEqualTo(Boolean value) {
addCriterion("case_public <=", value, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicIn(List<Boolean> values) {
addCriterion("case_public in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotIn(List<Boolean> values) {
addCriterion("case_public not in", values, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicBetween(Boolean value1, Boolean value2) {
addCriterion("case_public between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andCasePublicNotBetween(Boolean value1, Boolean value2) {
addCriterion("case_public not between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andApiQuickIsNull() {
addCriterion("api_quick is null");
return (Criteria) this;
}
public Criteria andApiQuickIsNotNull() {
addCriterion("api_quick is not null");
return (Criteria) this;
}
public Criteria andApiQuickEqualTo(String value) {
addCriterion("api_quick =", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotEqualTo(String value) {
addCriterion("api_quick <>", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThan(String value) {
addCriterion("api_quick >", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickGreaterThanOrEqualTo(String value) {
addCriterion("api_quick >=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLessThan(String value) {
addCriterion("api_quick <", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLessThanOrEqualTo(String value) {
addCriterion("api_quick <=", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickLike(String value) {
addCriterion("api_quick like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotLike(String value) {
addCriterion("api_quick not like", value, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickIn(List<String> values) {
addCriterion("api_quick in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotIn(List<String> values) {
addCriterion("api_quick not in", values, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickBetween(String value1, String value2) {
addCriterion("api_quick between", value1, value2, "apiQuick");
return (Criteria) this;
}
public Criteria andApiQuickNotBetween(String value1, String value2) {
addCriterion("api_quick not between", value1, value2, "apiQuick");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -0,0 +1,31 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ProjectVersion implements Serializable {
private String id;
private String projectId;
private String name;
private String description;
private String status;
private Long publishTime;
private Long startTime;
private Long endTime;
private Long createTime;
private String createUser;
private Boolean latest;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,920 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ProjectVersionExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ProjectVersionExample() {
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 andProjectIdIsNull() {
addCriterion("project_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
return (Criteria) this;
}
public Criteria andDescriptionIsNotNull() {
addCriterion("description is not null");
return (Criteria) this;
}
public Criteria andDescriptionEqualTo(String value) {
addCriterion("description =", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotEqualTo(String value) {
addCriterion("description <>", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThan(String value) {
addCriterion("description >", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
addCriterion("description >=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThan(String value) {
addCriterion("description <", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThanOrEqualTo(String value) {
addCriterion("description <=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLike(String value) {
addCriterion("description like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotLike(String value) {
addCriterion("description not like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionIn(List<String> values) {
addCriterion("description in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotIn(List<String> values) {
addCriterion("description not in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionBetween(String value1, String value2) {
addCriterion("description between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotBetween(String value1, String value2) {
addCriterion("description not between", value1, value2, "description");
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 andPublishTimeIsNull() {
addCriterion("publish_time is null");
return (Criteria) this;
}
public Criteria andPublishTimeIsNotNull() {
addCriterion("publish_time is not null");
return (Criteria) this;
}
public Criteria andPublishTimeEqualTo(Long value) {
addCriterion("publish_time =", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeNotEqualTo(Long value) {
addCriterion("publish_time <>", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeGreaterThan(Long value) {
addCriterion("publish_time >", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeGreaterThanOrEqualTo(Long value) {
addCriterion("publish_time >=", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeLessThan(Long value) {
addCriterion("publish_time <", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeLessThanOrEqualTo(Long value) {
addCriterion("publish_time <=", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeIn(List<Long> values) {
addCriterion("publish_time in", values, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeNotIn(List<Long> values) {
addCriterion("publish_time not in", values, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeBetween(Long value1, Long value2) {
addCriterion("publish_time between", value1, value2, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeNotBetween(Long value1, Long value2) {
addCriterion("publish_time not between", value1, value2, "publishTime");
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 Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andLatestIsNull() {
addCriterion("latest is null");
return (Criteria) this;
}
public Criteria andLatestIsNotNull() {
addCriterion("latest is not null");
return (Criteria) this;
}
public Criteria andLatestEqualTo(Boolean value) {
addCriterion("latest =", value, "latest");
return (Criteria) this;
}
public Criteria andLatestNotEqualTo(Boolean value) {
addCriterion("latest <>", value, "latest");
return (Criteria) this;
}
public Criteria andLatestGreaterThan(Boolean value) {
addCriterion("latest >", value, "latest");
return (Criteria) this;
}
public Criteria andLatestGreaterThanOrEqualTo(Boolean value) {
addCriterion("latest >=", value, "latest");
return (Criteria) this;
}
public Criteria andLatestLessThan(Boolean value) {
addCriterion("latest <", value, "latest");
return (Criteria) this;
}
public Criteria andLatestLessThanOrEqualTo(Boolean value) {
addCriterion("latest <=", value, "latest");
return (Criteria) this;
}
public Criteria andLatestIn(List<Boolean> values) {
addCriterion("latest in", values, "latest");
return (Criteria) this;
}
public Criteria andLatestNotIn(List<Boolean> values) {
addCriterion("latest not in", values, "latest");
return (Criteria) this;
}
public Criteria andLatestBetween(Boolean value1, Boolean value2) {
addCriterion("latest between", value1, value2, "latest");
return (Criteria) this;
}
public Criteria andLatestNotBetween(Boolean value1, Boolean value2) {
addCriterion("latest not between", value1, value2, "latest");
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

@ -2,9 +2,8 @@ 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;
import org.apache.ibatis.annotations.Param;
public interface ApiDefinitionExecResultMapper {
long countByExample(ApiDefinitionExecResultExample example);

View File

@ -13,6 +13,7 @@
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="actuator" jdbcType="VARCHAR" property="actuator" />
<result column="trigger_mode" jdbcType="VARCHAR" property="triggerMode" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionExecResult">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
@ -77,7 +78,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, resource_id, `status`, user_id, start_time, end_time, create_time, `type`,
actuator, trigger_mode
actuator, trigger_mode, version_id
</sql>
<sql id="Blob_Column_List">
content
@ -134,13 +135,13 @@
insert into api_definition_exec_result (id, `name`, resource_id,
`status`, user_id, start_time,
end_time, create_time, `type`,
actuator, trigger_mode, content
)
actuator, trigger_mode, version_id,
content)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
#{endTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR},
#{actuator,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}
)
#{actuator,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
insert into api_definition_exec_result
@ -178,6 +179,9 @@
<if test="triggerMode != null">
trigger_mode,
</if>
<if test="versionId != null">
version_id,
</if>
<if test="content != null">
content,
</if>
@ -216,6 +220,9 @@
<if test="triggerMode != null">
#{triggerMode,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
@ -263,6 +270,9 @@
<if test="record.triggerMode != null">
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR},
</if>
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
@ -284,6 +294,7 @@
`type` = #{record.type,jdbcType=VARCHAR},
actuator = #{record.actuator,jdbcType=VARCHAR},
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -301,7 +312,8 @@
create_time = #{record.createTime,jdbcType=BIGINT},
`type` = #{record.type,jdbcType=VARCHAR},
actuator = #{record.actuator,jdbcType=VARCHAR},
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR}
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -339,6 +351,9 @@
<if test="triggerMode != null">
trigger_mode = #{triggerMode,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
@ -357,6 +372,7 @@
`type` = #{type,jdbcType=VARCHAR},
actuator = #{actuator,jdbcType=VARCHAR},
trigger_mode = #{triggerMode,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -371,7 +387,8 @@
create_time = #{createTime,jdbcType=BIGINT},
`type` = #{type,jdbcType=VARCHAR},
actuator = #{actuator,jdbcType=VARCHAR},
trigger_mode = #{triggerMode,jdbcType=VARCHAR}
trigger_mode = #{triggerMode,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -6,6 +6,8 @@
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="method" jdbcType="VARCHAR" property="method" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
<result column="path" jdbcType="VARCHAR" property="path" />
<result column="module_path" jdbcType="VARCHAR" property="modulePath" />
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
<result column="schedule" jdbcType="VARCHAR" property="schedule" />
@ -14,8 +16,6 @@
<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" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="original_state" jdbcType="VARCHAR" property="originalState" />
@ -26,6 +26,8 @@
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
<result column="order" jdbcType="BIGINT" property="order" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="ref_id" jdbcType="VARCHAR" property="refId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
<result column="description" jdbcType="LONGVARCHAR" property="description" />
@ -92,10 +94,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, `method`, module_path, environment_id, schedule, `status`,
module_id, user_id, create_time, update_time, protocol, `path`, num, tags, original_state,
id, project_id, `name`, `method`, protocol, `path`, module_path, environment_id,
schedule, `status`, module_id, user_id, create_time, update_time, num, tags, original_state,
create_user, case_total, case_status, case_passing_rate, delete_time, delete_user_id,
`order`
`order`, version_id, ref_id
</sql>
<sql id="Blob_Column_List">
description, request, response, remark
@ -150,25 +152,27 @@
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition (id, project_id, `name`,
`method`, module_path, environment_id,
schedule, `status`, module_id,
user_id, create_time, update_time,
protocol, `path`, num,
`method`, protocol, `path`,
module_path, environment_id, schedule,
`status`, module_id, user_id,
create_time, update_time, num,
tags, original_state, create_user,
case_total, case_status, case_passing_rate,
delete_time, delete_user_id, `order`,
description, request, response,
remark)
version_id, ref_id, description,
request, response, remark
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{modulePath,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}, #{num,jdbcType=INTEGER},
#{method,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR},
#{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{schedule,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{num,jdbcType=INTEGER},
#{tags,jdbcType=VARCHAR}, #{originalState,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{caseTotal,jdbcType=VARCHAR}, #{caseStatus,jdbcType=VARCHAR}, #{casePassingRate,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
#{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR},
#{remark,jdbcType=LONGVARCHAR})
#{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
#{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition
@ -185,6 +189,12 @@
<if test="method != null">
`method`,
</if>
<if test="protocol != null">
protocol,
</if>
<if test="path != null">
`path`,
</if>
<if test="modulePath != null">
module_path,
</if>
@ -209,12 +219,6 @@
<if test="updateTime != null">
update_time,
</if>
<if test="protocol != null">
protocol,
</if>
<if test="path != null">
`path`,
</if>
<if test="num != null">
num,
</if>
@ -245,6 +249,12 @@
<if test="order != null">
`order`,
</if>
<if test="versionId != null">
version_id,
</if>
<if test="refId != null">
ref_id,
</if>
<if test="description != null">
description,
</if>
@ -271,6 +281,12 @@
<if test="method != null">
#{method,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
#{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
#{modulePath,jdbcType=VARCHAR},
</if>
@ -295,12 +311,6 @@
<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="num != null">
#{num,jdbcType=INTEGER},
</if>
@ -331,6 +341,12 @@
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
#{refId,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
@ -366,6 +382,12 @@
<if test="record.method != null">
`method` = #{record.method,jdbcType=VARCHAR},
</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.modulePath != null">
module_path = #{record.modulePath,jdbcType=VARCHAR},
</if>
@ -390,12 +412,6 @@
<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.num != null">
num = #{record.num,jdbcType=INTEGER},
</if>
@ -426,6 +442,12 @@
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.refId != null">
ref_id = #{record.refId,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
@ -449,6 +471,8 @@
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`method` = #{record.method,jdbcType=VARCHAR},
protocol = #{record.protocol,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
schedule = #{record.schedule,jdbcType=VARCHAR},
@ -457,8 +481,6 @@
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},
num = #{record.num,jdbcType=INTEGER},
tags = #{record.tags,jdbcType=VARCHAR},
original_state = #{record.originalState,jdbcType=VARCHAR},
@ -469,6 +491,8 @@
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
request = #{record.request,jdbcType=LONGVARCHAR},
response = #{record.response,jdbcType=LONGVARCHAR},
@ -483,6 +507,8 @@
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`method` = #{record.method,jdbcType=VARCHAR},
protocol = #{record.protocol,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
schedule = #{record.schedule,jdbcType=VARCHAR},
@ -491,8 +517,6 @@
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},
num = #{record.num,jdbcType=INTEGER},
tags = #{record.tags,jdbcType=VARCHAR},
original_state = #{record.originalState,jdbcType=VARCHAR},
@ -502,7 +526,9 @@
case_passing_rate = #{record.casePassingRate,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT}
`order` = #{record.order,jdbcType=BIGINT},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -519,6 +545,12 @@
<if test="method != null">
`method` = #{method,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
protocol = #{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
module_path = #{modulePath,jdbcType=VARCHAR},
</if>
@ -543,12 +575,6 @@
<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="num != null">
num = #{num,jdbcType=INTEGER},
</if>
@ -579,6 +605,12 @@
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
ref_id = #{refId,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
@ -599,6 +631,8 @@
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR},
schedule = #{schedule,jdbcType=VARCHAR},
@ -607,8 +641,6 @@
user_id = #{userId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
num = #{num,jdbcType=INTEGER},
tags = #{tags,jdbcType=VARCHAR},
original_state = #{originalState,jdbcType=VARCHAR},
@ -619,6 +651,8 @@
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
request = #{request,jdbcType=LONGVARCHAR},
response = #{response,jdbcType=LONGVARCHAR},
@ -630,6 +664,8 @@
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR},
schedule = #{schedule,jdbcType=VARCHAR},
@ -638,8 +674,6 @@
user_id = #{userId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
num = #{num,jdbcType=INTEGER},
tags = #{tags,jdbcType=VARCHAR},
original_state = #{originalState,jdbcType=VARCHAR},
@ -649,7 +683,9 @@
case_passing_rate = #{casePassingRate,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT}
`order` = #{order,jdbcType=BIGINT},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -30,6 +30,8 @@
<result column="order" jdbcType="BIGINT" property="order" />
<result column="environment_type" jdbcType="VARCHAR" property="environmentType" />
<result column="environment_group_id" jdbcType="VARCHAR" property="environmentGroupId" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="ref_id" jdbcType="VARCHAR" property="refId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiScenarioWithBLOBs">
<result column="scenario_definition" jdbcType="LONGVARCHAR" property="scenarioDefinition" />
@ -99,7 +101,7 @@
id, project_id, tags, user_id, api_scenario_module_id, module_path, `name`, `level`,
`status`, principal, step_total, schedule, create_time, update_time, pass_rate, last_result,
report_id, num, original_state, custom_num, create_user, version, delete_time, delete_user_id,
execute_times, `order`, environment_type, environment_group_id
execute_times, `order`, environment_type, environment_group_id, version_id, ref_id
</sql>
<sql id="Blob_Column_List">
scenario_definition, description, use_url, environment_json
@ -162,9 +164,9 @@
original_state, custom_num, create_user,
version, delete_time, delete_user_id,
execute_times, `order`, environment_type,
environment_group_id, scenario_definition,
description, use_url, environment_json
)
environment_group_id, version_id, ref_id,
scenario_definition, description,
use_url, environment_json)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{apiScenarioModuleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
@ -174,9 +176,9 @@
#{originalState,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{version,jdbcType=INTEGER}, #{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR},
#{executeTimes,jdbcType=INTEGER}, #{order,jdbcType=BIGINT}, #{environmentType,jdbcType=VARCHAR},
#{environmentGroupId,jdbcType=VARCHAR}, #{scenarioDefinition,jdbcType=LONGVARCHAR},
#{description,jdbcType=LONGVARCHAR}, #{useUrl,jdbcType=LONGVARCHAR}, #{environmentJson,jdbcType=LONGVARCHAR}
)
#{environmentGroupId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
#{scenarioDefinition,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR},
#{useUrl,jdbcType=LONGVARCHAR}, #{environmentJson,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
insert into api_scenario
@ -265,6 +267,12 @@
<if test="environmentGroupId != null">
environment_group_id,
</if>
<if test="versionId != null">
version_id,
</if>
<if test="refId != null">
ref_id,
</if>
<if test="scenarioDefinition != null">
scenario_definition,
</if>
@ -363,6 +371,12 @@
<if test="environmentGroupId != null">
#{environmentGroupId,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
#{refId,jdbcType=VARCHAR},
</if>
<if test="scenarioDefinition != null">
#{scenarioDefinition,jdbcType=LONGVARCHAR},
</if>
@ -470,6 +484,12 @@
<if test="record.environmentGroupId != null">
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
</if>
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.refId != null">
ref_id = #{record.refId,jdbcType=VARCHAR},
</if>
<if test="record.scenarioDefinition != null">
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
</if>
@ -517,6 +537,8 @@
`order` = #{record.order,jdbcType=BIGINT},
environment_type = #{record.environmentType,jdbcType=VARCHAR},
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR},
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
use_url = #{record.useUrl,jdbcType=LONGVARCHAR},
@ -554,7 +576,9 @@
execute_times = #{record.executeTimes,jdbcType=INTEGER},
`order` = #{record.order,jdbcType=BIGINT},
environment_type = #{record.environmentType,jdbcType=VARCHAR},
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR}
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -643,6 +667,12 @@
<if test="environmentGroupId != null">
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
ref_id = #{refId,jdbcType=VARCHAR},
</if>
<if test="scenarioDefinition != null">
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
</if>
@ -687,6 +717,8 @@
`order` = #{order,jdbcType=BIGINT},
environment_type = #{environmentType,jdbcType=VARCHAR},
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR},
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
use_url = #{useUrl,jdbcType=LONGVARCHAR},
@ -721,7 +753,9 @@
execute_times = #{executeTimes,jdbcType=INTEGER},
`order` = #{order,jdbcType=BIGINT},
environment_type = #{environmentType,jdbcType=VARCHAR},
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR}
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -21,6 +21,7 @@
<result column="version" jdbcType="INTEGER" property="version" />
<result column="order" jdbcType="BIGINT" property="order" />
<result column="case_status" jdbcType="VARCHAR" property="caseStatus" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
<result column="description" jdbcType="LONGVARCHAR" property="description" />
@ -87,7 +88,7 @@
<sql id="Base_Column_List">
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
create_time, update_time, num, tags, last_result_id, `status`, original_status, delete_time,
delete_user_id, version, `order`, case_status
delete_user_id, version, `order`, case_status, version_id
</sql>
<sql id="Blob_Column_List">
description, request
@ -147,16 +148,16 @@
num, tags, last_result_id,
`status`, original_status, delete_time,
delete_user_id, version, `order`,
case_status, description, request
)
case_status, version_id, description,
request)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{lastResultId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
#{deleteUserId,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{order,jdbcType=BIGINT},
#{caseStatus,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}
)
#{caseStatus,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
#{request,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
insert into api_test_case
@ -218,6 +219,9 @@
<if test="caseStatus != null">
case_status,
</if>
<if test="versionId != null">
version_id,
</if>
<if test="description != null">
description,
</if>
@ -283,6 +287,9 @@
<if test="caseStatus != null">
#{caseStatus,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
@ -357,6 +364,9 @@
<if test="record.caseStatus != null">
case_status = #{record.caseStatus,jdbcType=VARCHAR},
</if>
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
@ -389,6 +399,7 @@
version = #{record.version,jdbcType=INTEGER},
`order` = #{record.order,jdbcType=BIGINT},
case_status = #{record.caseStatus,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
request = #{record.request,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
@ -415,7 +426,8 @@
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
version = #{record.version,jdbcType=INTEGER},
`order` = #{record.order,jdbcType=BIGINT},
case_status = #{record.caseStatus,jdbcType=VARCHAR}
case_status = #{record.caseStatus,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -477,6 +489,9 @@
<if test="caseStatus != null">
case_status = #{caseStatus,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
@ -506,6 +521,7 @@
version = #{version,jdbcType=INTEGER},
`order` = #{order,jdbcType=BIGINT},
case_status = #{caseStatus,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
request = #{request,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
@ -529,7 +545,8 @@
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
version = #{version,jdbcType=INTEGER},
`order` = #{order,jdbcType=BIGINT},
case_status = #{caseStatus,jdbcType=VARCHAR}
case_status = #{caseStatus,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -16,6 +16,8 @@
<result column="scenario_version" jdbcType="INTEGER" property="scenarioVersion" />
<result column="scenario_id" jdbcType="VARCHAR" property="scenarioId" />
<result column="order" jdbcType="BIGINT" property="order" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="ref_id" jdbcType="VARCHAR" property="refId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestWithBLOBs">
<result column="load_configuration" jdbcType="LONGVARCHAR" property="loadConfiguration" />
@ -81,7 +83,7 @@
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, description, create_time, update_time, `status`, test_resource_pool_id,
user_id, num, create_user, scenario_version, scenario_id, `order`
user_id, num, create_user, scenario_version, scenario_id, `order`, version_id, ref_id
</sql>
<sql id="Blob_Column_List">
load_configuration, advanced_configuration
@ -139,14 +141,16 @@
description, create_time, update_time,
`status`, test_resource_pool_id, user_id,
num, create_user, scenario_version,
scenario_id, `order`, load_configuration,
advanced_configuration)
scenario_id, `order`, version_id,
ref_id, load_configuration, advanced_configuration
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{status,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{num,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR}, #{scenarioVersion,jdbcType=INTEGER},
#{scenarioId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{loadConfiguration,jdbcType=LONGVARCHAR},
#{advancedConfiguration,jdbcType=LONGVARCHAR})
#{scenarioId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{versionId,jdbcType=VARCHAR},
#{refId,jdbcType=VARCHAR}, #{loadConfiguration,jdbcType=LONGVARCHAR}, #{advancedConfiguration,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
insert into load_test
@ -193,6 +197,12 @@
<if test="order != null">
`order`,
</if>
<if test="versionId != null">
version_id,
</if>
<if test="refId != null">
ref_id,
</if>
<if test="loadConfiguration != null">
load_configuration,
</if>
@ -243,6 +253,12 @@
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
#{refId,jdbcType=VARCHAR},
</if>
<if test="loadConfiguration != null">
#{loadConfiguration,jdbcType=LONGVARCHAR},
</if>
@ -302,6 +318,12 @@
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.refId != null">
ref_id = #{record.refId,jdbcType=VARCHAR},
</if>
<if test="record.loadConfiguration != null">
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
</if>
@ -329,6 +351,8 @@
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR},
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
advanced_configuration = #{record.advancedConfiguration,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
@ -350,7 +374,9 @@
create_user = #{record.createUser,jdbcType=VARCHAR},
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT}
`order` = #{record.order,jdbcType=BIGINT},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -397,6 +423,12 @@
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
ref_id = #{refId,jdbcType=VARCHAR},
</if>
<if test="loadConfiguration != null">
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
</if>
@ -421,6 +453,8 @@
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
scenario_id = #{scenarioId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR},
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
advanced_configuration = #{advancedConfiguration,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
@ -439,7 +473,9 @@
create_user = #{createUser,jdbcType=VARCHAR},
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
scenario_id = #{scenarioId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT}
`order` = #{order,jdbcType=BIGINT},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -16,10 +16,11 @@
<result column="tps" jdbcType="VARCHAR" property="tps" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="test_name" jdbcType="VARCHAR" property="testName" />
<result column="test_resource_pool_id" jdbcType="VARCHAR" property="testResourcePoolId" />
<result column="test_start_time" jdbcType="BIGINT" property="testStartTime" />
<result column="test_end_time" jdbcType="BIGINT" property="testEndTime" />
<result column="test_duration" jdbcType="BIGINT" property="testDuration" />
<result column="test_resource_pool_id" jdbcType="VARCHAR" property="testResourcePoolId" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportWithBLOBs">
<result column="description" jdbcType="LONGVARCHAR" property="description" />
@ -87,8 +88,8 @@
</sql>
<sql id="Base_Column_List">
id, test_id, `name`, create_time, update_time, `status`, user_id, trigger_mode, file_id,
max_users, avg_response_time, tps, project_id, test_name, test_start_time, test_end_time,
test_duration, test_resource_pool_id
max_users, avg_response_time, tps, project_id, test_name, test_resource_pool_id,
test_start_time, test_end_time, test_duration, version_id
</sql>
<sql id="Blob_Column_List">
description, load_configuration, jmx_content, advanced_configuration
@ -146,18 +147,18 @@
create_time, update_time, `status`,
user_id, trigger_mode, file_id,
max_users, avg_response_time, tps,
project_id, test_name, test_start_time,
test_end_time, test_duration, test_resource_pool_id,
description, load_configuration,
project_id, test_name, test_resource_pool_id,
test_start_time, test_end_time, test_duration,
version_id, description, load_configuration,
jmx_content, advanced_configuration
)
values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{fileId,jdbcType=VARCHAR},
#{maxUsers,jdbcType=VARCHAR}, #{avgResponseTime,jdbcType=VARCHAR}, #{tps,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{testName,jdbcType=VARCHAR}, #{testStartTime,jdbcType=BIGINT},
#{testEndTime,jdbcType=BIGINT}, #{testDuration,jdbcType=BIGINT}, #{testResourcePoolId,jdbcType=VARCHAR},
#{description,jdbcType=LONGVARCHAR}, #{loadConfiguration,jdbcType=LONGVARCHAR},
#{projectId,jdbcType=VARCHAR}, #{testName,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR},
#{testStartTime,jdbcType=BIGINT}, #{testEndTime,jdbcType=BIGINT}, #{testDuration,jdbcType=BIGINT},
#{versionId,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR}, #{loadConfiguration,jdbcType=LONGVARCHAR},
#{jmxContent,jdbcType=LONGVARCHAR}, #{advancedConfiguration,jdbcType=LONGVARCHAR}
)
</insert>
@ -206,6 +207,9 @@
<if test="testName != null">
test_name,
</if>
<if test="testResourcePoolId != null">
test_resource_pool_id,
</if>
<if test="testStartTime != null">
test_start_time,
</if>
@ -215,8 +219,8 @@
<if test="testDuration != null">
test_duration,
</if>
<if test="testResourcePoolId != null">
test_resource_pool_id,
<if test="versionId != null">
version_id,
</if>
<if test="description != null">
description,
@ -274,6 +278,9 @@
<if test="testName != null">
#{testName,jdbcType=VARCHAR},
</if>
<if test="testResourcePoolId != null">
#{testResourcePoolId,jdbcType=VARCHAR},
</if>
<if test="testStartTime != null">
#{testStartTime,jdbcType=BIGINT},
</if>
@ -283,8 +290,8 @@
<if test="testDuration != null">
#{testDuration,jdbcType=BIGINT},
</if>
<if test="testResourcePoolId != null">
#{testResourcePoolId,jdbcType=VARCHAR},
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
@ -351,6 +358,9 @@
<if test="record.testName != null">
test_name = #{record.testName,jdbcType=VARCHAR},
</if>
<if test="record.testResourcePoolId != null">
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
</if>
<if test="record.testStartTime != null">
test_start_time = #{record.testStartTime,jdbcType=BIGINT},
</if>
@ -360,8 +370,8 @@
<if test="record.testDuration != null">
test_duration = #{record.testDuration,jdbcType=BIGINT},
</if>
<if test="record.testResourcePoolId != null">
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
@ -396,10 +406,11 @@
tps = #{record.tps,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
test_name = #{record.testName,jdbcType=VARCHAR},
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
test_start_time = #{record.testStartTime,jdbcType=BIGINT},
test_end_time = #{record.testEndTime,jdbcType=BIGINT},
test_duration = #{record.testDuration,jdbcType=BIGINT},
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
jmx_content = #{record.jmxContent,jdbcType=LONGVARCHAR},
@ -424,10 +435,11 @@
tps = #{record.tps,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
test_name = #{record.testName,jdbcType=VARCHAR},
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
test_start_time = #{record.testStartTime,jdbcType=BIGINT},
test_end_time = #{record.testEndTime,jdbcType=BIGINT},
test_duration = #{record.testDuration,jdbcType=BIGINT},
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR}
version_id = #{record.versionId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -474,6 +486,9 @@
<if test="testName != null">
test_name = #{testName,jdbcType=VARCHAR},
</if>
<if test="testResourcePoolId != null">
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
</if>
<if test="testStartTime != null">
test_start_time = #{testStartTime,jdbcType=BIGINT},
</if>
@ -483,8 +498,8 @@
<if test="testDuration != null">
test_duration = #{testDuration,jdbcType=BIGINT},
</if>
<if test="testResourcePoolId != null">
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
@ -516,10 +531,11 @@
tps = #{tps,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
test_name = #{testName,jdbcType=VARCHAR},
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
test_start_time = #{testStartTime,jdbcType=BIGINT},
test_end_time = #{testEndTime,jdbcType=BIGINT},
test_duration = #{testDuration,jdbcType=BIGINT},
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
jmx_content = #{jmxContent,jdbcType=LONGVARCHAR},
@ -541,10 +557,11 @@
tps = #{tps,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
test_name = #{testName,jdbcType=VARCHAR},
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
test_start_time = #{testStartTime,jdbcType=BIGINT},
test_end_time = #{testEndTime,jdbcType=BIGINT},
test_duration = #{testDuration,jdbcType=BIGINT},
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR}
version_id = #{versionId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -2,30 +2,31 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ProjectMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.Project">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
<result column="tapd_id" jdbcType="VARCHAR" property="tapdId"/>
<result column="jira_key" jdbcType="VARCHAR" property="jiraKey"/>
<result column="zentao_id" jdbcType="VARCHAR" property="zentaoId"/>
<result column="azure_devops_id" jdbcType="VARCHAR" property="azureDevopsId"/>
<result column="repeatable" jdbcType="BIT" property="repeatable"/>
<result column="case_template_id" jdbcType="VARCHAR" property="caseTemplateId"/>
<result column="issue_template_id" jdbcType="VARCHAR" property="issueTemplateId"/>
<result column="custom_num" jdbcType="BIT" property="customNum"/>
<result column="scenario_custom_num" jdbcType="BIT" property="scenarioCustomNum"/>
<result column="create_user" jdbcType="VARCHAR" property="createUser"/>
<result column="system_id" jdbcType="VARCHAR" property="systemId"/>
<result column="mock_tcp_port" jdbcType="INTEGER" property="mockTcpPort"/>
<result column="is_mock_tcp_open" jdbcType="BIT" property="isMockTcpOpen"/>
<result column="azure_filter_id" jdbcType="VARCHAR" property="azureFilterId"/>
<result column="api_quick" jdbcType="VARCHAR" property="apiQuick"/>
<result column="case_public" jdbcType="BIT" property="casePublic"/>
<result column="platform" jdbcType="VARCHAR" property="platform"/>
<result column="third_part_template" jdbcType="BIT" property="thirdPartTemplate"/>
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="tapd_id" jdbcType="VARCHAR" property="tapdId" />
<result column="jira_key" jdbcType="VARCHAR" property="jiraKey" />
<result column="zentao_id" jdbcType="VARCHAR" property="zentaoId" />
<result column="azure_devops_id" jdbcType="VARCHAR" property="azureDevopsId" />
<result column="repeatable" jdbcType="BIT" property="repeatable" />
<result column="case_template_id" jdbcType="VARCHAR" property="caseTemplateId" />
<result column="issue_template_id" jdbcType="VARCHAR" property="issueTemplateId" />
<result column="custom_num" jdbcType="BIT" property="customNum" />
<result column="scenario_custom_num" jdbcType="BIT" property="scenarioCustomNum" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="system_id" jdbcType="VARCHAR" property="systemId" />
<result column="mock_tcp_port" jdbcType="INTEGER" property="mockTcpPort" />
<result column="is_mock_tcp_open" jdbcType="BIT" property="isMockTcpOpen" />
<result column="azure_filter_id" jdbcType="VARCHAR" property="azureFilterId" />
<result column="version_enable" jdbcType="BIT" property="versionEnable" />
<result column="platform" jdbcType="VARCHAR" property="platform" />
<result column="third_part_template" jdbcType="BIT" property="thirdPartTemplate" />
<result column="case_public" jdbcType="BIT" property="casePublic" />
<result column="api_quick" jdbcType="VARCHAR" property="apiQuick" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -86,11 +87,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id
, workspace_id, `name`, description, create_time, update_time, tapd_id, jira_key,
id, workspace_id, `name`, description, create_time, update_time, tapd_id, jira_key,
zentao_id, azure_devops_id, `repeatable`, case_template_id, issue_template_id, custom_num,
scenario_custom_num, create_user, system_id, mock_tcp_port, is_mock_tcp_open, azure_filter_id,
api_quick, case_public, platform, third_part_template
version_enable, platform, third_part_template, case_public, api_quick
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultMap="BaseResultMap">
select
@ -124,21 +124,23 @@
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Project">
insert into project (id, workspace_id, `name`,
description, create_time, update_time,
tapd_id, jira_key, zentao_id,
azure_devops_id, `repeatable`, case_template_id,
issue_template_id, custom_num, scenario_custom_num,
create_user, system_id, mock_tcp_port,
is_mock_tcp_open, azure_filter_id, api_quick,
case_public, platform, third_part_template)
description, create_time, update_time,
tapd_id, jira_key, zentao_id,
azure_devops_id, `repeatable`, case_template_id,
issue_template_id, custom_num, scenario_custom_num,
create_user, system_id, mock_tcp_port,
is_mock_tcp_open, azure_filter_id, version_enable,
platform, third_part_template, case_public,
api_quick)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{tapdId,jdbcType=VARCHAR}, #{jiraKey,jdbcType=VARCHAR}, #{zentaoId,jdbcType=VARCHAR},
#{azureDevopsId,jdbcType=VARCHAR}, #{repeatable,jdbcType=BIT}, #{caseTemplateId,jdbcType=VARCHAR},
#{issueTemplateId,jdbcType=VARCHAR}, #{customNum,jdbcType=BIT}, #{scenarioCustomNum,jdbcType=BIT},
#{createUser,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, #{mockTcpPort,jdbcType=INTEGER},
#{isMockTcpOpen,jdbcType=BIT}, #{azureFilterId,jdbcType=VARCHAR}, #{apiQuick,jdbcType=VARCHAR},
#{casePublic,jdbcType=BIT}, #{platform,jdbcType=VARCHAR}, #{thirdPartTemplate,jdbcType=BIT})
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{tapdId,jdbcType=VARCHAR}, #{jiraKey,jdbcType=VARCHAR}, #{zentaoId,jdbcType=VARCHAR},
#{azureDevopsId,jdbcType=VARCHAR}, #{repeatable,jdbcType=BIT}, #{caseTemplateId,jdbcType=VARCHAR},
#{issueTemplateId,jdbcType=VARCHAR}, #{customNum,jdbcType=BIT}, #{scenarioCustomNum,jdbcType=BIT},
#{createUser,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, #{mockTcpPort,jdbcType=INTEGER},
#{isMockTcpOpen,jdbcType=BIT}, #{azureFilterId,jdbcType=VARCHAR}, #{versionEnable,jdbcType=BIT},
#{platform,jdbcType=VARCHAR}, #{thirdPartTemplate,jdbcType=BIT}, #{casePublic,jdbcType=BIT},
#{apiQuick,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Project">
insert into project
@ -203,11 +205,8 @@
<if test="azureFilterId != null">
azure_filter_id,
</if>
<if test="apiQuick != null">
api_quick,
</if>
<if test="casePublic != null">
case_public,
<if test="versionEnable != null">
version_enable,
</if>
<if test="platform != null">
platform,
@ -215,6 +214,12 @@
<if test="thirdPartTemplate != null">
third_part_template,
</if>
<if test="casePublic != null">
case_public,
</if>
<if test="apiQuick != null">
api_quick,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -277,11 +282,8 @@
<if test="azureFilterId != null">
#{azureFilterId,jdbcType=VARCHAR},
</if>
<if test="apiQuick != null">
#{apiQuick,jdbcType=VARCHAR},
</if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
<if test="versionEnable != null">
#{versionEnable,jdbcType=BIT},
</if>
<if test="platform != null">
#{platform,jdbcType=VARCHAR},
@ -289,6 +291,12 @@
<if test="thirdPartTemplate != null">
#{thirdPartTemplate,jdbcType=BIT},
</if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
</if>
<if test="apiQuick != null">
#{apiQuick,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultType="java.lang.Long">
@ -360,11 +368,8 @@
<if test="record.azureFilterId != null">
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
</if>
<if test="record.apiQuick != null">
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
</if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
<if test="record.versionEnable != null">
version_enable = #{record.versionEnable,jdbcType=BIT},
</if>
<if test="record.platform != null">
platform = #{record.platform,jdbcType=VARCHAR},
@ -372,6 +377,12 @@
<if test="record.thirdPartTemplate != null">
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
</if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
</if>
<if test="record.apiQuick != null">
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -380,31 +391,32 @@
<update id="updateByExample" parameterType="map">
update project
set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
tapd_id = #{record.tapdId,jdbcType=VARCHAR},
jira_key = #{record.jiraKey,jdbcType=VARCHAR},
zentao_id = #{record.zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{record.azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{record.repeatable,jdbcType=BIT},
case_template_id = #{record.caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{record.issueTemplateId,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=BIT},
scenario_custom_num = #{record.scenarioCustomNum,jdbcType=BIT},
create_user = #{record.createUser,jdbcType=VARCHAR},
system_id = #{record.systemId,jdbcType=VARCHAR},
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
api_quick = #{record.apiQuick,jdbcType=VARCHAR},
case_public = #{record.casePublic,jdbcType=BIT},
platform = #{record.platform,jdbcType=VARCHAR},
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT}
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
tapd_id = #{record.tapdId,jdbcType=VARCHAR},
jira_key = #{record.jiraKey,jdbcType=VARCHAR},
zentao_id = #{record.zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{record.azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{record.repeatable,jdbcType=BIT},
case_template_id = #{record.caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{record.issueTemplateId,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=BIT},
scenario_custom_num = #{record.scenarioCustomNum,jdbcType=BIT},
create_user = #{record.createUser,jdbcType=VARCHAR},
system_id = #{record.systemId,jdbcType=VARCHAR},
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
version_enable = #{record.versionEnable,jdbcType=BIT},
platform = #{record.platform,jdbcType=VARCHAR},
third_part_template = #{record.thirdPartTemplate,jdbcType=BIT},
case_public = #{record.casePublic,jdbcType=BIT},
api_quick = #{record.apiQuick,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.Project">
@ -467,11 +479,8 @@
<if test="azureFilterId != null">
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
</if>
<if test="apiQuick != null">
api_quick = #{apiQuick,jdbcType=VARCHAR},
</if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
<if test="versionEnable != null">
version_enable = #{versionEnable,jdbcType=BIT},
</if>
<if test="platform != null">
platform = #{platform,jdbcType=VARCHAR},
@ -479,34 +488,41 @@
<if test="thirdPartTemplate != null">
third_part_template = #{thirdPartTemplate,jdbcType=BIT},
</if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
</if>
<if test="apiQuick != null">
api_quick = #{apiQuick,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Project">
update project
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
tapd_id = #{tapdId,jdbcType=VARCHAR},
jira_key = #{jiraKey,jdbcType=VARCHAR},
zentao_id = #{zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{repeatable,jdbcType=BIT},
case_template_id = #{caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{issueTemplateId,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=BIT},
scenario_custom_num = #{scenarioCustomNum,jdbcType=BIT},
create_user = #{createUser,jdbcType=VARCHAR},
system_id = #{systemId,jdbcType=VARCHAR},
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
api_quick = #{apiQuick,jdbcType=VARCHAR},
case_public = #{casePublic,jdbcType=BIT},
platform = #{platform,jdbcType=VARCHAR},
third_part_template = #{thirdPartTemplate,jdbcType=BIT}
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
tapd_id = #{tapdId,jdbcType=VARCHAR},
jira_key = #{jiraKey,jdbcType=VARCHAR},
zentao_id = #{zentaoId,jdbcType=VARCHAR},
azure_devops_id = #{azureDevopsId,jdbcType=VARCHAR},
`repeatable` = #{repeatable,jdbcType=BIT},
case_template_id = #{caseTemplateId,jdbcType=VARCHAR},
issue_template_id = #{issueTemplateId,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=BIT},
scenario_custom_num = #{scenarioCustomNum,jdbcType=BIT},
create_user = #{createUser,jdbcType=VARCHAR},
system_id = #{systemId,jdbcType=VARCHAR},
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
version_enable = #{versionEnable,jdbcType=BIT},
platform = #{platform,jdbcType=VARCHAR},
third_part_template = #{thirdPartTemplate,jdbcType=BIT},
case_public = #{casePublic,jdbcType=BIT},
api_quick = #{apiQuick,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

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

View File

@ -0,0 +1,306 @@
<?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.ProjectVersionMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ProjectVersion">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="publish_time" jdbcType="BIGINT" property="publishTime" />
<result column="start_time" jdbcType="BIGINT" property="startTime" />
<result column="end_time" jdbcType="BIGINT" property="endTime" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="latest" jdbcType="BIT" property="latest" />
</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`, description, `status`, publish_time, start_time, end_time,
create_time, create_user, latest
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectVersionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from project_version
<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 project_version
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from project_version
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ProjectVersionExample">
delete from project_version
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ProjectVersion">
insert into project_version (id, project_id, `name`,
description, `status`, publish_time,
start_time, end_time, create_time,
create_user, latest)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{publishTime,jdbcType=BIGINT},
#{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{latest,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ProjectVersion">
insert into project_version
<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="description != null">
description,
</if>
<if test="status != null">
`status`,
</if>
<if test="publishTime != null">
publish_time,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="latest != null">
latest,
</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="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="publishTime != null">
#{publishTime,jdbcType=BIGINT},
</if>
<if test="startTime != null">
#{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
#{endTime,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="latest != null">
#{latest,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ProjectVersionExample" resultType="java.lang.Long">
select count(*) from project_version
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update project_version
<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.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.publishTime != null">
publish_time = #{record.publishTime,jdbcType=BIGINT},
</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.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.latest != null">
latest = #{record.latest,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update project_version
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
publish_time = #{record.publishTime,jdbcType=BIGINT},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
latest = #{record.latest,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ProjectVersion">
update project_version
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="publishTime != null">
publish_time = #{publishTime,jdbcType=BIGINT},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="latest != null">
latest = #{latest,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ProjectVersion">
update project_version
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
publish_time = #{publishTime,jdbcType=BIGINT},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
latest = #{latest,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -7,6 +7,7 @@ import io.metersphere.api.dto.definition.ApiDefinitionResult;
import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO;
import io.metersphere.api.dto.scenario.Scenario;
import io.metersphere.base.domain.ApiDefinition;
import io.metersphere.base.domain.ApiDefinitionExample;
import io.metersphere.base.domain.ApiDefinitionExampleWithOperation;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.dto.RelationshipGraphData;
@ -78,4 +79,6 @@ public interface ExtApiDefinitionMapper {
List<RelationshipGraphData.Node> getForGraph(@Param("ids") Set<String> ids);
int countByIds(@Param("ids") List<String> ids);
long countByExample(ApiDefinitionExample example);
}

View File

@ -246,11 +246,13 @@
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,deleteUser.name AS delete_user,api_definition.delete_time, api_definition.remark
project_name, user.name as user_name,deleteUser.name AS delete_user,api_definition.delete_time, api_definition.remark, api_definition.version_id,
project_version.name as version_name, api_definition.ref_id, project.version_enable
from api_definition
left join project on api_definition.project_id = project.id
left join user on api_definition.user_id = user.id
left join user deleteUser on api_definition.delete_user_id = deleteUser.id
LEFT JOIN project_version on project.id = project_version.project_id AND project_version.id = api_definition.version_id
<include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0">
order by
@ -602,6 +604,12 @@
#{value}
</foreach>
</when>
<when test="key=='version_id'">
and api_definition.version_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
@ -672,6 +680,32 @@
and api_definition.id in
(SELECT api_definition_id FROM api_test_case)
</if>
<if test="request.refId != null">
AND ref_id = #{request.refId}
</if>
<if test="request.versionId != null">
AND version_id = #{request.versionId}
</if>
<if test="request.versionId == null and request.refId == null and request.id == null">
AND (
version_id = (SELECT project_version.id
FROM api_definition tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
WHERE ref_id = api_definition.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
FROM api_definition tmp
JOIN project_version ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id
WHERE ref_id = api_definition.ref_id
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
LIMIT 1)
)
</if>
</where>
</sql>
@ -741,4 +775,10 @@
and api_definition.status != 'Trash';
</select>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample" resultType="java.lang.Long">
select count(DISTINCT ref_id) from api_definition
<if test="_parameter != null">
<include refid="io.metersphere.base.mapper.ApiDefinitionMapper.Example_Where_Clause" />
</if>
</select>
</mapper>

View File

@ -87,4 +87,5 @@ public interface ExtApiScenarioMapper {
void setScenarioEnvGroupIdNull(@Param("environmentGroupId") String environmentGroupId);
ApiScenarioDTO selectById(@Param("id") String id);
}

View File

@ -154,6 +154,7 @@
<select id="list" resultMap="BaseResultMap">
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
api_scenario.custom_num, api_scenario.version, api_scenario.environment_type, api_scenario.environment_group_id,
api_scenario.version_id, api_scenario.ref_id, project_version.name as version_name,
<if test="request.selectEnvironment == true">
api_scenario.environment_json as env,
</if>
@ -168,6 +169,7 @@
left join user on api_scenario.user_id = user.id
left join user deleteUser on api_scenario.delete_user_id = deleteUser.id
left join user u2 on api_scenario.principal = u2.id
left join project_version on api_scenario.project_id = project_version.project_id AND project_version.id = api_scenario.version_id
<include refid="queryWhereCondition"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
@ -287,6 +289,12 @@
</foreach>
</when>
<when test="key=='version_id'">
and api_scenario.version_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
@ -310,6 +318,32 @@
where pc.test_plan_id = #{request.planId}
)
</if>
<if test="request.refId != null">
AND ref_id = #{request.refId}
</if>
<if test="request.versionId != null">
AND version_id = #{request.versionId}
</if>
<if test="request.versionId == null and request.refId == null and request.id == null">
AND (
version_id = (SELECT project_version.id
FROM api_scenario tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
WHERE ref_id = api_scenario.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
FROM api_scenario tmp
JOIN project_version ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id
WHERE ref_id = api_scenario.ref_id
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
LIMIT 1)
)
</if>
</where>
</sql>
@ -460,7 +494,7 @@
WHERE use_url IS NULL
</select>
<select id="selectTrash" resultType="java.lang.Integer">
select count(1)
select count(DISTINCT ref_id)
from api_scenario
where project_id = #{projectId}
and status = 'Trash'
@ -622,4 +656,11 @@
and api_scenario.status != 'Trash';
</select>
<select id="selectById" resultMap="BaseResultMap">
select api_scenario.*, project_version.name as version_name, project.version_enable
from api_scenario
LEFT JOIN project_version on project_version.project_id = api_scenario.project_id and project_version.id = version_id
LEFT JOIN project on api_scenario.project_id = project.id
WHERE api_scenario.id = #{id}
</select>
</mapper>

View File

@ -278,10 +278,12 @@
<select id="selectApiCaseInfoByPrimaryKey" resultType="io.metersphere.api.dto.definition.ApiTestCaseInfo">
SELECT
t1.*,
a.method AS apiMethod
a.method AS apiMethod, project_version.name as version_name, project.version_enable
FROM
api_test_case t1
inner join api_definition a on t1.api_definition_id = a.id
LEFT JOIN project_version on a.project_id = project_version.project_id AND project_version.id = t1.version_id
LEFT JOIN project on a.project_id = project.id
WHERE t1.id = #{0}
</select>
@ -314,13 +316,14 @@
select
t1.id, t1.project_id, t1.name,t1.case_status, t1.api_definition_id, t1.priority, t1.description, t1.create_user_id, t1.update_user_id, t1.create_time, t1.update_time, t1.num,
a.module_id, a.path, a.protocol, t1.tags,t1.status,t2.STATUS AS execResult, t1.last_result_id as lastResultId, project.name as project_name,
t1.delete_time, deleteUser.name AS deleteUser,CONCAT(FORMAT(SUM(IF (t2.`status`='success',1,0))/COUNT(t2.id)*100,2),'%') passRate
t1.delete_time, deleteUser.name AS deleteUser,CONCAT(FORMAT(SUM(IF (t2.`status`='success',1,0))/COUNT(t2.id)*100,2),'%') passRate, project_version.name as version_name
from
api_test_case t1
LEFT JOIN api_definition_exec_result t2 ON t1.id = t2.resource_id
LEFT JOIN user deleteUser ON t1.delete_user_id = deleteUser.id
LEFT JOIN api_definition a on t1.api_definition_id = a.id
LEFT JOIN project ON t1.project_id = project.id
LEFT JOIN project_version on project.id = project_version.project_id AND project_version.id = t1.version_id
WHERE 1=1
<if test="request.protocol != null and request.protocol!=''">
and a.protocol = #{request.protocol}
@ -410,6 +413,9 @@
<if test="request.toUpdate !=null and request.toUpdate == true">
and (t1.update_time >= #{request.updateTime} or t2.status = 'error')
</if>
<if test="request.versionId != null">
AND t1.version_id = #{request.versionId}
</if>
GROUP BY t1.id,
t1.project_id,
t1.name,

View File

@ -101,10 +101,11 @@
<select id="list" resultMap="BaseResultMap"
parameterType="io.metersphere.performance.request.QueryTestPlanRequest">
SELECT load_test.*, project.name AS project_name, user.name AS user_name
SELECT load_test.*, project.name AS project_name, user.name AS user_name, project_version.name as version_name
FROM load_test
LEFT JOIN project ON load_test.project_id = project.id
LEFT JOIN user ON load_test.user_id = user.id
LEFT JOIN project_version on project.id = project_version.project_id AND project_version.id = load_test.version_id
<where>
<if test="request.combine != null">
<include refid="combine">
@ -149,10 +150,42 @@
#{value}
</foreach>
</when>
<when test="key=='version_id'">
and load_test.version_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
<if test="request.refId != null">
AND ref_id = #{request.refId}
</if>
<if test="request.versionId != null">
AND version_id = #{request.versionId}
</if>
<if test="request.versionId == null and request.refId == null and request.id == null">
AND (
version_id = (SELECT project_version.id
FROM load_test tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
WHERE ref_id = load_test.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
FROM load_test tmp
JOIN project_version ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id
WHERE ref_id = load_test.ref_id
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
LIMIT 1)
)
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
ORDER BY

View File

@ -70,11 +70,12 @@
ltr.description, user.name as userName, project.name as
projectName, ltr.trigger_mode,
ltr.create_time as createTime, ltr.update_time as updateTime, ltr.status as status, ltr.test_name as testName,
project.id as projectId
project.id as projectId, project_version.name as version_name
from load_test_report ltr
left join load_test lt on ltr.test_id = lt.id
join user on ltr.user_id = user.id
join project on project.id = ltr.project_id
JOIN project_version on project.id = project_version.project_id AND ltr.version_id = project_version.id
<where>
<if test="reportRequest.combine != null">
<include refid="combine">

View File

@ -0,0 +1,19 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.controller.request.ProjectVersionRequest;
import io.metersphere.dto.ProjectVersionDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtProjectVersionMapper {
List<ProjectVersionDTO> selectProjectVersionList(@Param("request") ProjectVersionRequest request);
String getDefaultVersion(@Param("projectId") String projectId);
void updateLatestToFalse(@Param("projectId") String projectId);
boolean isVersionEnable(@Param("projectId") String projectId);
void changeVersionEnable(@Param("projectId") String projectId, @Param("status") boolean status);
}

View File

@ -0,0 +1,68 @@
<?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.ExtProjectVersionMapper">
<select id="selectProjectVersionList" resultType="io.metersphere.dto.ProjectVersionDTO">
SELECT DISTINCT project_version.*, user.name AS createUserName
FROM project_version
LEFT JOIN user ON user.id = project_version.create_user
<where>
<if test="request.projectId != null and request.projectId != ''">
AND project_version.project_id = #{request.projectId, jdbcType=VARCHAR}
</if>
<if test="request.name != null and request.name != ''">
AND project_version.name LIKE #{request.name, jdbcType=VARCHAR}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key == 'create_user'">
AND project_version.create_user IN
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key == 'project_id'">
AND project_version.project_id IN
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key == 'status'">
AND project_version.status IN
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
ORDER BY
<foreach collection="request.orders" separator="," item="order">
project_version.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="getDefaultVersion" resultType="java.lang.String">
SELECT id
FROM project_version
WHERE project_id = #{projectId} AND status = 'open' AND latest = TRUE
LIMIT 1
</select>
<update id="updateLatestToFalse">
UPDATE project_version set latest = FALSE where project_id = #{projectId}
</update>
<select id="isVersionEnable" resultType="boolean">
select version_enable from project where id = #{projectId}
</select>
<update id="changeVersionEnable">
update project set version_enable = #{status} where id = #{projectId}
</update>
</mapper>

View File

@ -30,6 +30,21 @@
#{apiId}
</foreach>
</if>
<if test="request.refId != null">
AND api.ref_id = #{request.refId}
</if>
<if test="request.versionId != null">
AND api.version_id = #{request.versionId}
</if>
<if test="request.versionId == null and request.refId == null">
AND api.version_id = (SELECT project_version.id
FROM api_definition tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id
WHERE ref_id = api.ref_id
ORDER BY project_version.create_time DESC
LIMIT 1)
</if>
<if test="request.orderCondition == 'createTimeDesc'">
ORDER BY api.create_time DESC
</if>

View File

@ -141,4 +141,9 @@ public class ProjectController {
public String genTcpMockPort(@PathVariable String id){
return projectService.genTcpMockPort(id);
}
@GetMapping("version/enable/{projectId}")
public boolean isVersionEnable(@PathVariable String projectId) {
return projectService.isVersionEnable(projectId);
}
}

View File

@ -15,6 +15,7 @@ import io.metersphere.service.ProjectService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.service.UserService;
import io.metersphere.service.WorkspaceService;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
@ -26,7 +27,7 @@ import java.util.List;
@RequestMapping(value = "/system")
public class SystemParameterController {
@Resource
private SystemParameterService SystemParameterService;
private SystemParameterService systemParameterService;
@Resource
private Environment env;
@Resource
@ -39,22 +40,22 @@ public class SystemParameterController {
@PostMapping("/edit/email")
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "邮件设置", beforeEvent = "#msClass.getMailLogDetails()", content = "#msClass.getMailLogDetails()", msClass = SystemParameterService.class)
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.editMail(systemParameter);
systemParameterService.editMail(systemParameter);
}
@PostMapping("/testConnection")
public void testConnection(@RequestBody HashMap<String, String> hashMap) {
SystemParameterService.testConnection(hashMap);
systemParameterService.testConnection(hashMap);
}
@GetMapping("/version")
public String getVersion() {
return SystemParameterService.getVersion();
return systemParameterService.getVersion();
}
@GetMapping("/theme")
public String getTheme() {
return SystemParameterService.getValue("ui.theme");
return systemParameterService.getValue("ui.theme");
}
@GetMapping("timeout")
@ -64,50 +65,50 @@ public class SystemParameterController {
@GetMapping("/mail/info")
public MailInfo mailInfo() {
return SystemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue());
return systemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue());
}
@GetMapping("/base/info")
public BaseSystemConfigDTO getBaseInfo() {
return SystemParameterService.getBaseInfo();
return systemParameterService.getBaseInfo();
}
@PostMapping("/system/header")
public SystemHeader getHeader(@RequestBody SystemHeader systemHeader) {
return SystemParameterService.getHeader(systemHeader.getType());
return systemParameterService.getHeader(systemHeader.getType());
}
@PostMapping("/save/base")
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getBaseLogDetails()", content = "#msClass.getBaseLogDetails()", msClass = SystemParameterService.class)
public void saveBaseInfo(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.saveBaseInfo(systemParameter);
systemParameterService.saveBaseInfo(systemParameter);
}
@GetMapping("/save/baseurl")
public void saveBaseurl(@RequestParam("baseurl") String baseurl) {
SystemParameterService.saveBaseurl(baseurl);
systemParameterService.saveBaseurl(baseurl);
}
@PostMapping("/save/ldap")
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails()", content = "#msClass.getLogDetails()", msClass = SystemParameterService.class)
public void saveLdap(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.saveLdap(systemParameter);
systemParameterService.saveLdap(systemParameter);
}
@GetMapping("/ldap/info")
public LdapInfo getLdapInfo() {
return SystemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
return systemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
}
@PostMapping("save/header")
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "显示设置")
public void saveHeader(@RequestBody UserHeader userHeader) {
SystemParameterService.saveHeader(userHeader);
systemParameterService.saveHeader(userHeader);
}
@PostMapping("/header/info")
public UserHeader getHeaderInfo(@RequestBody HeaderRequest headerRequest) {
return SystemParameterService.queryUserHeader(headerRequest);
return systemParameterService.queryUserHeader(headerRequest);
}
@GetMapping("/statistics/data")
@ -124,12 +125,12 @@ public class SystemParameterController {
@GetMapping("/get/info/{key}")
public SystemParameter getInfo(@PathVariable String key) {
return SystemParameterService.getInfo(key);
return systemParameterService.getInfo(key);
}
@PostMapping("/edit/info")
public SystemParameter editInfo(@RequestBody SystemParameter systemParameter) {
SystemParameterService.editInfo(systemParameter);
systemParameterService.editInfo(systemParameter);
return systemParameter;
}

View File

@ -0,0 +1,18 @@
package io.metersphere.controller.request;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
import java.util.Map;
@Setter
@Getter
public class ProjectVersionRequest {
private String name;
private String projectId;
private String createUser;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
private Map<String, Object> combine;
}

View File

@ -12,6 +12,7 @@ import java.util.List;
public class LoadTestDTO extends LoadTest {
private String projectName;
private String userName;
private String versionName;
private Schedule schedule;
private Boolean isNeedUpdate;
private List<String> follows;

View File

@ -0,0 +1,11 @@
package io.metersphere.dto;
import io.metersphere.base.domain.ProjectVersion;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ProjectVersionDTO extends ProjectVersion {
private String createUserName;
}

View File

@ -26,4 +26,5 @@ public class ReportDTO {
private long testStartTime;
private long testEndTime;
private long testDuration;
private String versionName;
}

View File

@ -258,4 +258,19 @@ public class PerformanceTestController {
public List<LoadModuleDTO> getNodeByPlanId(@PathVariable String planId) {
return performanceTestService.getNodeByPlanId(planId);
}
@GetMapping("versions/{loadTestId}")
public List<LoadTestDTO> getLoadTestVersions(@PathVariable String loadTestId) {
return performanceTestService.getLoadTestVersions(loadTestId);
}
@GetMapping("get/{version}/{refId}")
public LoadTestDTO getLoadTestByVersion(@PathVariable String version, @PathVariable String refId) {
return performanceTestService.getLoadTestByVersion(version,refId);
}
@GetMapping("delete/{version}/{refId}")
public void deleteLoadTestByVersion(@PathVariable String version, @PathVariable String refId) {
performanceTestService.deleteLoadTestByVersion(version, refId);
}
}

View File

@ -1,7 +1,6 @@
package io.metersphere.performance.request;
import io.metersphere.controller.request.OrderRequest;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

View File

@ -32,6 +32,10 @@ public class TestPlanRequest {
private String testResourcePoolId;
private String refId;
private String versionId;
private List<String> follows;
private static final long serialVersionUID = 1L;

View File

@ -13,6 +13,7 @@ import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestReportDetailMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
import io.metersphere.base.mapper.ext.ExtProjectVersionMapper;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
@ -120,6 +121,8 @@ public class PerformanceTestService {
private TestPlanProjectService testPlanProjectService;
@Resource
private ProjectMapper projectMapper;
@Resource
private ExtProjectVersionMapper extProjectVersionMapper;
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders()));
@ -172,6 +175,7 @@ public class PerformanceTestService {
public LoadTest save(SaveTestPlanRequest request, List<MultipartFile> files) {
checkQuota(request, true);
LoadTestWithBLOBs loadTest = saveLoadTest(request);
List<FileMetadata> importFiles = request.getUpdatedFileList();
@ -236,11 +240,14 @@ public class PerformanceTestService {
}
private void checkExist(TestPlanRequest request) {
if (StringUtils.isEmpty(request.getVersionId())) {
request.setVersionId(extProjectVersionMapper.getDefaultVersion(request.getProjectId()));
}
if (request.getName() != null) {
LoadTestExample example = new LoadTestExample();
LoadTestExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(request.getName())
.andProjectIdEqualTo(request.getProjectId());
.andProjectIdEqualTo(request.getProjectId()).andVersionIdEqualTo(request.getVersionId());
if (StringUtils.isNotBlank(request.getId())) {
criteria.andIdNotEqualTo(request.getId());
}
@ -267,6 +274,8 @@ public class PerformanceTestService {
loadTest.setStatus(PerformanceTestStatus.Saved.name());
loadTest.setNum(getNextNum(request.getProjectId()));
loadTest.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extLoadTestMapper::getLastOrder));
loadTest.setVersionId(request.getVersionId());
loadTest.setRefId(request.getId());
List<ApiLoadTest> apiList = request.getApiList();
apiPerformanceService.add(apiList, loadTest.getId());
loadTestMapper.insert(loadTest);
@ -304,8 +313,7 @@ public class PerformanceTestService {
// 导入项目里其他的文件
List<String> addFileIds = ListUtils.subtract(updatedFileIds, originFileIds);
this.importFiles(addFileIds, testId, request.getFileSorts());
this.importFiles(addFileIds, loadTest.getId(), request.getFileSorts());
// 处理新上传的文件
this.saveUploadFiles(files, loadTest, request.getFileSorts());
@ -316,9 +324,24 @@ public class PerformanceTestService {
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
loadTest.setTestResourcePoolId(request.getTestResourcePoolId());
loadTest.setStatus(PerformanceTestStatus.Saved.name());
//saveFollows(loadTest.getId(), request.getFollows());
loadTestMapper.updateByPrimaryKeySelective(loadTest);
// 更新数据
LoadTestExample example = new LoadTestExample();
example.createCriteria().andIdEqualTo(loadTest.getId()).andVersionIdEqualTo(request.getVersionId());
if (loadTestMapper.updateByExampleSelective(loadTest, example) == 0) {
// 插入新版本的数据
LoadTestWithBLOBs oldLoadTest = loadTestMapper.selectByPrimaryKey(loadTest.getId());
loadTest.setId(UUID.randomUUID().toString());
loadTest.setNum(oldLoadTest.getNum());
loadTest.setVersionId(request.getVersionId());
loadTest.setCreateTime(System.currentTimeMillis());
loadTest.setUpdateTime(System.currentTimeMillis());
loadTest.setCreateUser(SessionUtils.getUserId());
loadTest.setOrder(oldLoadTest.getOrder());
loadTest.setRefId(oldLoadTest.getRefId());
//插入文件
copyLoadTestFiles(testId, loadTest.getId());
loadTestMapper.insertSelective(loadTest);
}
return loadTest;
}
@ -392,6 +415,7 @@ public class PerformanceTestService {
testReport.setTestId(loadTest.getId());
testReport.setName(loadTest.getName());
testReport.setTriggerMode(request.getTriggerMode());
testReport.setVersionId(loadTest.getVersionId());
if (SessionUtils.getUser() == null) {
testReport.setUserId(loadTest.getUserId());
} else {
@ -538,7 +562,6 @@ public class PerformanceTestService {
if (StringUtils.length(copyName) > 30) {
MSException.throwException(Translator.get("load_test_name_length"));
}
copy.setId(UUID.randomUUID().toString());
copy.setName(copyName);
copy.setCreateTime(System.currentTimeMillis());
@ -548,16 +571,20 @@ public class PerformanceTestService {
copy.setNum(getNextNum(copy.getProjectId()));
loadTestMapper.insert(copy);
// copy test file
copyLoadTestFiles(request.getId(), copy.getId());
request.setId(copy.getId());
}
private void copyLoadTestFiles(String oldLoadTestId, String newLoadTestId) {
LoadTestFileExample loadTestFileExample = new LoadTestFileExample();
loadTestFileExample.createCriteria().andTestIdEqualTo(request.getId());
loadTestFileExample.createCriteria().andTestIdEqualTo(oldLoadTestId);
List<LoadTestFile> loadTestFiles = loadTestFileMapper.selectByExample(loadTestFileExample);
if (!CollectionUtils.isEmpty(loadTestFiles)) {
loadTestFiles.forEach(loadTestFile -> {
loadTestFile.setTestId(copy.getId());
loadTestFile.setTestId(newLoadTestId);
loadTestFileMapper.insert(loadTestFile);
});
}
request.setId(copy.getId());
}
public void updateSchedule(Schedule request) {
@ -964,4 +991,34 @@ public class PerformanceTestService {
return list;
}
public List<LoadTestDTO> getLoadTestVersions(String loadTestId) {
LoadTestWithBLOBs loadTestWithBLOBs = loadTestMapper.selectByPrimaryKey(loadTestId);
if(loadTestWithBLOBs==null){
return new ArrayList<>();
}
QueryTestPlanRequest request = new QueryTestPlanRequest() ;
request.setRefId(loadTestWithBLOBs.getRefId());
return this.list(request);
}
public LoadTestDTO getLoadTestByVersion(String versionId,String refId) {
QueryTestPlanRequest request = new QueryTestPlanRequest() ;
request.setRefId(refId);
request.setVersionId(versionId);
List<LoadTestDTO> list = this.list(request);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0);
}
public void deleteLoadTestByVersion(String version,String refId) {
LoadTestExample loadTestExample = new LoadTestExample();
loadTestExample.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
List<LoadTest> loadTests = loadTestMapper.selectByExample(loadTestExample);
LoadTest loadTest = loadTests.get(0);
DeleteTestPlanRequest request = new DeleteTestPlanRequest();
request.setId(loadTest.getId());
this.delete(request);
}
}

View File

@ -10,6 +10,7 @@ import io.metersphere.api.tcp.TCPPool;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtProjectVersionMapper;
import io.metersphere.base.mapper.ext.ExtUserGroupMapper;
import io.metersphere.base.mapper.ext.ExtUserMapper;
import io.metersphere.commons.constants.IssuesManagePlatform;
@ -94,6 +95,8 @@ public class ProjectService {
private String tcpMockPorts;
@Resource
private EnvironmentGroupProjectService environmentGroupProjectService;
@Resource
private ExtProjectVersionMapper extProjectVersionMapper;
public Project addProject(Project project) {
if (StringUtils.isBlank(project.getName())) {
@ -131,6 +134,20 @@ public class ProjectService {
// 创建新项目检查当前用户 last_project_id
extUserMapper.updateLastProjectIdIfNull(project.getId(), SessionUtils.getUserId());
ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);
if (projectVersionService != null) {
ProjectVersion projectVersion = new ProjectVersion();
projectVersion.setId(UUID.randomUUID().toString());
projectVersion.setName("v1.0.0");
projectVersion.setProjectId(project.getId());
projectVersion.setCreateTime(System.currentTimeMillis());
projectVersion.setCreateTime(System.currentTimeMillis());
projectVersion.setStartTime(System.currentTimeMillis());
projectVersion.setPublishTime(System.currentTimeMillis());
projectVersion.setLatest(true);
projectVersion.setStatus("open");
projectVersionService.addProjectVersion(projectVersion);
}
return project;
}
@ -753,4 +770,8 @@ public class ProjectService {
public int getProjectBugSize(String projectId) {
return extProjectMapper.getProjectPlanBugSize(projectId);
}
public boolean isVersionEnable(String projectId) {
return extProjectVersionMapper.isVersionEnable(projectId);
}
}

View File

@ -0,0 +1,23 @@
package io.metersphere.service;
import io.metersphere.base.domain.ProjectVersion;
import io.metersphere.controller.request.ProjectVersionRequest;
import io.metersphere.dto.ProjectVersionDTO;
import java.util.List;
public interface ProjectVersionService {
List<ProjectVersionDTO> getVersionList(ProjectVersionRequest request);
ProjectVersion addProjectVersion(ProjectVersion projectVersion);
ProjectVersion getProjectVersion(String id);
ProjectVersion editProjectVersion(ProjectVersion projectVersion);
void deleteProjectVersion(String id);
List<ProjectVersionDTO> getProjectVersions(String projectId);
void changeStatus(String id, String status);
}

@ -1 +1 @@
Subproject commit 74baaf6b8934e2c825921574be6c688ab50cbd6b
Subproject commit 0915a42053dce41c3ed701063ae35512d3818c93

View File

@ -0,0 +1,143 @@
-- version
CREATE TABLE IF NOT EXISTS `project_version`
(
`id` varchar(50) NOT NULL,
`project_id` varchar(50) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`description` varchar(200) DEFAULT NULL,
`status` varchar(20) DEFAULT NULL,
`latest` tinyint(1) DEFAULT NULL,
`publish_time` bigint(13) DEFAULT NULL,
`start_time` bigint(13) DEFAULT NULL,
`end_time` bigint(13) DEFAULT NULL,
`create_time` bigint(13) DEFAULT NULL,
`create_user` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `project_version_project_id_index` (`project_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
ALTER TABLE project
ADD version_enable TINYINT(1) DEFAULT 1 NULL;
INSERT INTO project_version (id, name, description, status, latest, publish_time, start_time, end_time, create_time,
create_user, project_id)
SELECT UUID(),
'v1.0.0',
'系统默认版本',
'open',
TRUE,
UNIX_TIMESTAMP() * 1000,
UNIX_TIMESTAMP() * 1000,
UNIX_TIMESTAMP() * 1000,
UNIX_TIMESTAMP() * 1000,
'admin',
id
FROM project;
-- api definition
ALTER TABLE api_definition
ADD version_id VARCHAR(50) NULL;
ALTER TABLE api_definition
ADD ref_id VARCHAR(50) NULL;
ALTER TABLE api_definition_exec_result
ADD version_id VARCHAR(50) NULL;
CREATE INDEX api_definition_exec_result_version_id_index
ON api_definition_exec_result(version_id);
CREATE INDEX api_definition_ref_id_index
ON api_definition (ref_id);
CREATE INDEX api_definition_version_id_index
ON api_definition (version_id);
UPDATE api_definition
SET ref_id = id;
UPDATE api_definition
INNER JOIN project_version ON project_version.project_id = api_definition.project_id
SET version_id = project_version.id;
-- api test case
ALTER TABLE api_test_case
ADD version_id VARCHAR(50) NULL;
CREATE INDEX api_test_case_version_id_index
ON api_test_case (version_id);
UPDATE api_test_case
INNER JOIN project_version ON project_version.project_id = api_test_case.project_id
SET version_id = project_version.id;
UPDATE api_definition_exec_result
JOIN api_test_case ON resource_id = api_test_case.id
set api_definition_exec_result.version_id = api_test_case.version_id;
UPDATE api_definition_exec_result
JOIN api_definition ON resource_id = api_definition.id
set api_definition_exec_result.version_id = api_definition.version_id;
-- load_test
ALTER TABLE load_test
ADD version_id VARCHAR(50) NULL;
ALTER TABLE load_test
ADD ref_id VARCHAR(50) NULL;
ALTER TABLE load_test_report
ADD version_id VARCHAR(50) NULL;
CREATE INDEX load_test_report_version_id_index
ON load_test_report(version_id);
CREATE INDEX load_test_ref_id_index
ON load_test (ref_id);
CREATE INDEX load_test_version_id_index
ON load_test (version_id);
UPDATE load_test
SET ref_id = id;
UPDATE load_test
INNER JOIN project_version ON project_version.project_id = load_test.project_id
SET version_id = project_version.id;
UPDATE load_test_report
INNER JOIN project_version ON project_version.project_id = load_test_report.project_id
SET version_id = project_version.id;
-- api scenario
ALTER TABLE api_scenario
ADD version_id VARCHAR(50) NULL;
ALTER TABLE api_scenario
ADD ref_id VARCHAR(50) NULL;
ALTER TABLE api_scenario_report
ADD version_id VARCHAR(50) NULL;
CREATE INDEX api_scenario_report_version_id_index
ON api_scenario_report(version_id);
CREATE INDEX api_scenario_ref_id_index
ON api_scenario (ref_id);
CREATE INDEX api_scenario_version_id_index
ON api_scenario (version_id);
UPDATE api_scenario
SET ref_id = id;
UPDATE api_scenario
INNER JOIN project_version ON project_version.project_id = api_scenario.project_id
SET version_id = project_version.id;
UPDATE api_scenario_report
INNER JOIN project_version ON project_version.project_id = api_scenario_report.project_id
SET version_id = project_version.id;

View File

@ -39,7 +39,11 @@
:custom-num="customNum"
:init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="apiTrashScenarioList"/>
ref="apiTrashScenarioList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
</ms-api-scenario-list>
</el-tab-pane>
<el-tab-pane name="default" :label="$t('api_test.automation.scenario_list')">
<ms-api-scenario-list
@ -58,7 +62,11 @@
:custom-num="customNum"
:init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="apiScenarioList"/>
ref="apiScenarioList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
</ms-api-scenario-list>
</el-tab-pane>
@ -100,9 +108,13 @@
import {getCurrentProjectID, getCurrentUser, getUUID, hasPermission} from "@/common/js/utils";
import {PROJECT_ID} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "ApiAutomation",
components: {
'VersionSelect': VersionSelect.default,
MsApiScenarioModule: () => import("@/business/components/api/automation/scenario/ApiScenarioModule"),
MsApiScenarioList: () => import("@/business/components/api/automation/scenario/ApiScenarioList"),
MsMainContainer: () => import("@/business/components/common/components/MsMainContainer"),
@ -152,14 +164,14 @@ export default {
},
created() {
let projectId = this.$route.params.projectId;
if(projectId){
if (projectId) {
sessionStorage.setItem(PROJECT_ID, projectId);
}
},
mounted() {
this.getProject();
this.getTrashCase();
this.init()
this.init();
},
watch: {
redirectID() {
@ -313,7 +325,7 @@ export default {
if (t && this.$store.state.scenarioMap.has(t.currentScenario.id) && this.$store.state.scenarioMap.get(t.currentScenario.id) > 1) {
message += t.currentScenario.name + "";
}
})
});
if (message !== "") {
this.$alert(this.$t('commons.scenario') + " [ " + message.substr(0, message.length - 1) + " ] " + this.$t('commons.confirm_info'), '', {
confirmButtonText: this.$t('commons.confirm'),
@ -430,7 +442,7 @@ export default {
init() {
let scenarioData = this.$route.params.scenarioData;
if (scenarioData) {
this.editScenario(scenarioData)
this.editScenario(scenarioData);
}
},
editScenario(row) {
@ -484,6 +496,15 @@ export default {
},
updateInitApiTableOpretion(param) {
this.initApiTableOpretion = param;
},
changeVersion(currentVersion) {
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.condition.versionId = currentVersion || null;
}
if (this.$refs.apiTrashScenarioList) {
this.$refs.apiTrashScenarioList.condition.versionId = currentVersion || null;
}
this.refresh();
}
}
};

View File

@ -1,12 +1,15 @@
<template>
<div>
<el-card class="table-card-nopadding" v-loading="result.loading">
<ms-table-header :condition.sync="condition" @search="selectByParam" title=""
:show-create="false" :tip="$t('commons.search_by_id_name_tag')"/>
<slot name="version"></slot>
<ms-table-search-bar :condition.sync="condition" @change="search" class="search-input"
:tip="$t('commons.search_by_id_name_tag')"/>
<ms-table-adv-search-bar :condition.sync="condition" @search="search" class="adv-search-bar"/>
<ms-table
:data="tableData"
:screen-height="isRelate ? 'calc(100vh - 300px)' : screenHeight"
:screen-height="isRelate ? 'calc(100vh - 400px)' : screenHeight"
:condition="condition"
:page-size="pageSize"
:operators="isRelate ? [] : operators"
@ -117,6 +120,18 @@
</template>
</ms-table-column>
<ms-table-column
:label="$t('project.version.name')"
:field="item"
:fields-width="fieldsWidth"
:filters="versionFilters"
min-width="100px"
prop="versionId">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column prop="principalName"
min-width="120px"
:label="$t('api_test.definition.api_principal')"
@ -141,9 +156,9 @@
<div v-if="row.environmentMap">
<span v-for="(k, v, index) in row.environmentMap" :key="index">
<span v-if="index===0">
<span class="project-name" :title="v">{{v}}</span>:
<span class="project-name" :title="v">{{ v }}</span>:
<el-tag type="success" size="mini" effect="plain">
<span class="project-env">{{k}}</span>
<span class="project-env">{{ k }}</span>
</el-tag>
<br/>
</span>
@ -152,8 +167,8 @@
width="350"
trigger="click">
<div v-for="(k, v, index) in row.environmentMap" :key="index">
<span class="plan-case-env">{{v}}:
<el-tag type="success" size="mini" effect="plain">{{k}}</el-tag><br/>
<span class="plan-case-env">{{ v }}:
<el-tag type="success" size="mini" effect="plain">{{ k }}</el-tag><br/>
</span>
</div>
<el-link v-if="index === 1" slot="reference" type="info" :underline="false" icon="el-icon-more"/>
@ -251,7 +266,8 @@
<el-drawer :visible.sync="showReportVisible" :destroy-on-close="true" direction="ltr" :withHeader="true"
:modal="false"
size="90%">
<ms-api-report-detail @invisible="showReportVisible = false" @refresh="search" :infoDb="infoDb" :show-cancel-button="false"
<ms-api-report-detail @invisible="showReportVisible = false" @refresh="search" :infoDb="infoDb"
:show-cancel-button="false"
:report-id="showReportId" :currentProjectId="projectId"/>
</el-drawer>
<!--测试计划-->
@ -277,7 +293,7 @@
</template>
<script>
import {downloadFile, getCurrentProjectID, getUUID, objToStrMap, strMapToObj} from "@/common/js/utils";
import {downloadFile, getCurrentProjectID, getUUID, hasLicense, objToStrMap, strMapToObj} from "@/common/js/utils";
import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import {API_SCENARIO_LIST} from "../../../../../common/js/constants";
@ -295,15 +311,18 @@ import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOpe
import {editApiScenarioCaseOrder} from "@/business/components/api/automation/api-automation";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import axios from "axios";
import {getGraphByCondition} from "@/network/graph";
import MsTableSearchBar from "@/business/components/common/components/MsTableSearchBar";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {};
import {getGraphByCondition} from "@/network/graph";
export default {
name: "MsApiScenarioList",
components: {
MsTableAdvSearchBar,
MsTableSearchBar,
MsTable,
MsTableColumn,
HeaderLabelOperate,
@ -379,7 +398,7 @@ export default {
type: API_SCENARIO_LIST,
fields: getCustomTableHeader('API_SCENARIO'),
fieldsWidth: getCustomTableWidth('API_SCENARIO'),
screenHeight: 'calc(100vh - 228px)',//,
screenHeight: 'calc(100vh - 220px)',//,
condition: {
components: API_SCENARIO_CONFIGS
},
@ -405,6 +424,7 @@ export default {
selectDataSize: 0,
selectAll: false,
userFilters: [],
versionFilters: [],
operators: [],
selectRows: new Set(),
isStop: false,
@ -570,6 +590,13 @@ export default {
this.search();
this.getPrincipalOptions([]);
this.getVersionOptions();
if (this.isRelate) {
this.checkVersionEnable(this.selectProjectId);
} else {
this.checkVersionEnable(this.projectId);
}
//
if (this.$route.query.resourceId) {
@ -604,7 +631,7 @@ export default {
batchReportId() {
this.result.loading = true;
this.getReport();
}
},
},
computed: {
isNotRunning() {
@ -777,6 +804,27 @@ export default {
});
});
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
checkVersionEnable(projectId) {
if (!projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + projectId, response => {
if (!response.data) {
this.fields = this.fields.filter(f => f.id !== 'versionId');
}
});
}
},
getEnvsOptions(option) {
this.$get('/api/environment/list/' + this.projectId, response => {
option.push(...response.data);
@ -940,8 +988,8 @@ export default {
resolve();
}
}
})
})
});
});
},
sort(stepArray) {
for (let i in stepArray) {
@ -1017,7 +1065,7 @@ export default {
this.reportId = getUUID().substring(0, 8);
this.runVisible = true;
this.$set(row, "isStop", true);
})
});
}
});
},
@ -1262,7 +1310,7 @@ export default {
vertical-align: middle;
}
.project-env{
.project-env {
display: inline-block;
white-space: nowrap;
overflow: hidden;
@ -1271,4 +1319,15 @@ export default {
vertical-align: middle;
}
.search-input {
float: right;
width: 250px;
}
.adv-search-bar {
float: right;
margin-top: 5px;
margin-right: 10px;
}
</style>

View File

@ -6,13 +6,18 @@
<!--操作按钮-->
<div class="ms-opt-btn">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-right: 15px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow"/>
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-right: 5px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow"/>
</el-tooltip>
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 15px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow"/>
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 5px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="path === '/api/automation/update'">{{ $t('operating_log.change_history') }}</el-link>
<el-link type="primary" style="margin-right: 5px" @click="openHis" v-if="path === '/api/automation/update'">{{ $t('operating_log.change_history') }}</el-link>
<!-- 版本历史 -->
<ms-version-history v-xpack
ref="versionHistory"
:version-data="versionData"
:current-id="currentScenario.id"
@compare="compare" @checkout="checkout" @create="create" @del="del"/>
<el-button id="inputDelay" type="primary" size="small" v-prevent-re-click @click="editScenario"
title="ctrl + s" v-permission="['PROJECT_API_SCENARIO:READ+EDIT', 'PROJECT_API_SCENARIO:READ+CREATE', 'PROJECT_API_SCENARIO:READ+COPY']">
{{ $t('commons.save') }}
@ -64,20 +69,20 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
<el-form-item :label="$t('api_test.automation.tag')" prop="tags">
<ms-input-tag :currentScenario="currentScenario" ref="tag"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
<el-form-item :label="$t('commons.description')" prop="description">
<el-input class="ms-http-textarea"
v-model="currentScenario.description"
type="textarea"
:autosize="{ minRows: 2, maxRows: 10}"
:rows="2" size="small"/>
:autosize="{ minRows: 1, maxRows: 10}"
:rows="1" size="small"/>
</el-form-item>
</el-col>
<el-col :span="7" v-if="customNum">
@ -129,7 +134,7 @@
<el-checkbox v-model="onSampleError"><span style="font-size: 13px;">{{ $t('commons.failure_continues') }}</span></el-checkbox>
</el-col>
<el-col :span="8">
<el-col :span="7">
<div style="float: right;width: 300px">
<env-popover :disabled="scenarioDefinition.length < 1" :env-map="projectEnvMap"
:project-ids="projectIds" :result="envResult"
@ -331,23 +336,28 @@
import {API_STATUS, PRIORITY} from "../../definition/model/JsonData";
import {buttons, setComponent} from './menu/Menu';
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
import {ELEMENT_TYPE, STEP, TYPE_TO_C, PLUGIN_ELEMENTS} from "./Setting";
import {ELEMENT_TYPE, STEP, TYPE_TO_C} from "./Setting";
import {KeyValue} from "@/business/components/api/definition/model/ApiTestModel";
import {
getUUID,
objToStrMap,
strMapToObj,
handleCtrlSEvent,
getCurrentProjectID,
handleCtrlREvent, hasLicense, getCurrentUser
getCurrentUser,
getUUID,
handleCtrlREvent,
handleCtrlSEvent,
hasLicense,
objToStrMap,
strMapToObj
} from "@/common/js/utils";
import "@/common/css/material-icons.css"
import "@/common/css/material-icons.css";
import OutsideClick from "@/common/js/outside-click";
import {savePreciseEnvProjectIds, saveScenario} from "@/business/components/api/automation/api-automation";
import MsComponentConfig from "./component/ComponentConfig";
import {ENV_TYPE} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
let jsonPath = require('jsonpath');
export default {
name: "EditApiScenario",
@ -361,6 +371,7 @@ export default {
}
},
components: {
'MsVersionHistory': versionHistory.default,
MsComponentConfig,
MsVariableList: () => import("./variable/VariableList"),
ScenarioRelevance: () => import("./api/ScenarioRelevance"),
@ -465,7 +476,8 @@ export default {
runScenario: undefined,
showFollow: false,
envGroupId: "",
environmentType: ENV_TYPE.JSON
environmentType: ENV_TYPE.JSON,
versionData: []
}
},
watch: {
@ -504,6 +516,10 @@ export default {
this.getPlugins().then(() => {
this.initPlugins();
});
if (hasLicense()) {
this.getVersionHistory();
}
},
mounted() {
this.$nextTick(() => {
@ -1265,6 +1281,11 @@ export default {
this.$refs['currentScenario'].validate(async (valid) => {
if (valid) {
await this.setParameter();
if (!this.currentScenario.versionId) {
if (this.$refs.versionHistory) {
this.currentScenario.versionId = this.$refs.versionHistory.currentVersion.id;
}
}
saveScenario(this.path, this.currentScenario, this.scenarioDefinition, this, (response) => {
this.$success(this.$t('commons.save_success'));
this.$store.state.scenarioMap.delete(this.currentScenario.id);
@ -1273,6 +1294,8 @@ export default {
if (response.data) {
this.currentScenario.id = response.data.id;
}
//
this.getVersionHistory();
if (this.currentScenario.tags instanceof String) {
this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
}
@ -1624,6 +1647,48 @@ export default {
}
}
},
getVersionHistory() {
this.$get('/api/automation/versions/' + this.currentScenario.id, response => {
this.versionData = response.data;
});
},
compare(row) {
// console.log(row);
},
checkout(row) {
let api = this.versionData.filter(v => v.versionId === row.id)[0];
if (api.tags && api.tags.length > 0) {
api.tags = JSON.parse(api.tags);
}
Object.assign(this.currentScenario, api);
this.getApiScenario();
this.getVersionHistory();
},
create(row) {
//
this.currentScenario.versionId = row.id;
this.loading = true;
this.editScenario()
.then(() => {
this.loading = false;
})
.catch(() => {
this.loading = false;
});
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('/api/automation/delete/' + row.id + '/' + this.currentScenario.refId, () => {
this.$success(this.$t('commons.delete_success'));
this.getVersionHistory();
});
}
}
});
}
}
}
</script>

View File

@ -133,6 +133,7 @@
let obj = {apiDefinitionId: api.id, name: api.name, priority: 'P0', active: true, uuid: getUUID(), request: api.request};
obj.projectId = getCurrentProjectID();
obj.id = obj.uuid;
obj.versionId = api.versionId;
let url = "/api/testcase/create";
let bodyFiles = this.getBodyUploadFiles(obj);
this.$fileUpload(url, null, bodyFiles, obj, (response) => {

View File

@ -17,20 +17,34 @@
<scenario-relevance-api-list
v-if="isApiListEnable"
:project-id="projectId"
:version-filters="versionFilters"
:current-version="currentVersion"
:current-protocol="currentProtocol"
:select-node-ids="selectNodeIds"
:is-api-list-enable="isApiListEnable"
@isApiListEnableChange="isApiListEnableChange"
ref="apiList"/>
ref="apiList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" :default-version="currentVersion"
@changeVersion="currentVersionChange"/>
</template>
</scenario-relevance-api-list>
<scenario-relevance-case-list
v-if="!isApiListEnable"
:project-id="projectId"
:version-filters="versionFilters"
:current-version="currentVersion"
:current-protocol="currentProtocol"
:select-node-ids="selectNodeIds"
:is-api-list-enable="isApiListEnable"
@isApiListEnableChange="isApiListEnableChange"
ref="apiCaseList"/>
ref="apiCaseList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" :default-version="currentVersion"
@changeVersion="currentVersionChange"/>
</template>
</scenario-relevance-case-list>
<template v-slot:headerBtn>
<el-button type="primary" @click="copy" :loading="buttonIsWorking" @keydown.enter.native.prevent size="mini">
@ -53,11 +67,14 @@ import MsMainContainer from "../../../../common/components/MsMainContainer";
import ScenarioRelevanceApiList from "./RelevanceApiList";
import RelevanceDialog from "../../../../track/plan/view/comonents/base/RelevanceDialog";
import TestCaseRelevanceBase from "@/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase";
import {getUUID} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "ApiRelevance",
components: {
'VersionSelect': VersionSelect.default,
TestCaseRelevanceBase,
RelevanceDialog,
ScenarioRelevanceApiList,
@ -65,15 +82,17 @@ export default {
},
data() {
return {
buttonIsWorking:false,
buttonIsWorking: false,
result: {},
currentProtocol: null,
saveOtherPageData: false,
selectNodeIds: [],
moduleOptions: {},
isApiListEnable: true,
projectId: ""
}
projectId: "",
versionFilters: [],
currentVersion: null,
};
},
watch: {
projectId() {
@ -82,7 +101,7 @@ export default {
}
},
methods: {
changeButtonLoadingType(){
changeButtonLoadingType() {
this.refresh();
this.buttonIsWorking = false;
},
@ -103,14 +122,14 @@ export default {
let params = this.$refs.apiList.getConditions();
this.result = this.$post("/api/definition/list/batch", params, (response) => {
let apis = response.data;
if(apis.length === 0){
if (apis.length === 0) {
this.$warning('请选择接口');
this.buttonIsWorking = false;
}else {
} else {
this.$emit('save', apis, 'API', reference);
this.$refs.baseRelevance.close();
}
},(error) => {
}, (error) => {
this.buttonIsWorking = false;
});
@ -118,14 +137,14 @@ export default {
let params = this.$refs.apiCaseList.getConditions();
this.result = this.$post("/api/testcase/get/caseBLOBs/request", params, (response) => {
let apiCases = response.data;
if(apiCases.length === 0) {
if (apiCases.length === 0) {
this.$warning('请选择案例');
this.buttonIsWorking = false;
}else{
} else {
this.$emit('save', apiCases, 'CASE', reference);
this.$refs.baseRelevance.close();
}
},(error) => {
}, (error) => {
this.buttonIsWorking = false;
});
}
@ -142,6 +161,9 @@ export default {
isApiListEnableChange(data) {
this.isApiListEnable = data;
},
currentVersionChange(currentVersion) {
this.currentVersion = currentVersion || null;
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
@ -162,11 +184,14 @@ export default {
this.projectId = projectId;
},
}
}
};
</script>
<style scoped>
/deep/ .filter-input {
width: 140px !important;
}
.version-select {
padding-left: 10px;
}
</style>

View File

@ -4,8 +4,14 @@
:is-api-list-enable="isApiListEnable"
@isApiListEnableChange="isApiListEnableChange">
<template>
<slot name="version"></slot>
</template>
<api-table-list
:table-data="tableData"
:version-filters="versionFilters"
:project-id="projectId"
:condition="condition"
:select-node-ids="selectNodeIds"
:result="result"
@ -32,104 +38,111 @@
<script>
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
import {buildBatchParam} from "@/common/js/tableUtils";
import {
TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS,
} from "@/business/components/common/components/search/search-components";
import ApiTableList from "@/business/components/api/definition/components/complete/ApiTableList";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
import {buildBatchParam} from "@/common/js/tableUtils";
import {
TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS,
} from "@/business/components/common/components/search/search-components";
import ApiTableList from "@/business/components/api/definition/components/complete/ApiTableList";
export default {
name: "RelevanceApiList",
components: {
ApiTableList,
TableSelectCountBar,
MsEnvironmentSelect,
ApiListContainer,
export default {
name: "RelevanceApiList",
components: {
ApiTableList,
TableSelectCountBar,
MsEnvironmentSelect,
ApiListContainer,
},
data() {
return {
condition: {
components: TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS
},
result: {},
screenHeight: 'calc(100vh - 400px)',//,
tableData: [],
environmentId: "",
total: 0,
selectRows: new Set()
};
},
props: {
currentProtocol: String,
selectNodeIds: Array,
versionFilters: Array,
currentVersion: String,
visible: {
type: Boolean,
default: false,
},
data() {
return {
condition: {
components: TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS
},
result: {},
screenHeight: 'calc(100vh - 300px)',//,
tableData: [],
environmentId: "",
total: 0,
selectRows: new Set()
}
isApiListEnable: {
type: Boolean,
default: false,
},
props: {
currentProtocol: String,
selectNodeIds: Array,
visible: {
type: Boolean,
default: false,
},
isApiListEnable: {
type: Boolean,
default: false,
},
isReadOnly: {
type: Boolean,
default: false
},
isCaseRelevance: {
type: Boolean,
default: false,
},
projectId: String,
planId: String,
isTestPlan: Boolean,
isReadOnly: {
type: Boolean,
default: false
},
created: function () {
isCaseRelevance: {
type: Boolean,
default: false,
},
projectId: String,
planId: String,
isTestPlan: Boolean,
},
created() {
this.condition.versionId = this.currentVersion;
this.initTable();
},
watch: {
selectNodeIds() {
this.initTable();
},
watch: {
selectNodeIds() {
this.initTable();
},
currentProtocol() {
this.initTable();
},
projectId() {
this.initTable();
}
currentProtocol() {
this.initTable();
},
methods: {
setSelectRow(setSelectRow) {
this.selectRows = setSelectRow;
},
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
initTable(projectId) {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
this.condition.moduleIds = [];
}
if (projectId != null && typeof projectId === 'string') {
this.condition.projectId = projectId;
} else if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
projectId() {
this.initTable();
},
currentVersion() {
this.condition.versionId = this.currentVersion;
this.initTable();
}
},
methods: {
setSelectRow(setSelectRow) {
this.selectRows = setSelectRow;
},
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
initTable(projectId) {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
this.condition.moduleIds = [];
}
if (projectId != null && typeof projectId === 'string') {
this.condition.projectId = projectId;
} else if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
} else {
this.condition.protocol = "HTTP";
}
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
} else {
this.condition.protocol = "HTTP";
}
let url = '/api/definition/list/';
if (this.isTestPlan) {
url = '/api/definition/list/relevance/';
this.condition.planId = this.planId;
}
let url = '/api/definition/list/';
if (this.isTestPlan) {
url = '/api/definition/list/relevance/';
this.condition.planId = this.planId;
}
this.$nextTick(() => {
this.result = this.$post(url + this.$refs.apitable.currentPage + "/" + this.$refs.apitable.pageSize, this.condition, response => {

View File

@ -4,6 +4,10 @@
:is-api-list-enable="isApiListEnable"
@isApiListEnableChange="isApiListEnableChange">
<template>
<slot name="version"></slot>
</template>
<ms-environment-select :project-id="projectId" v-if="isTestPlan" :is-read-only="isReadOnly"
@setEnvironment="setEnvironment" ref="msEnvironmentSelect"/>
@ -53,6 +57,17 @@
</template>
</ms-table-column>
<ms-table-column
v-if="versionEnable"
:label="$t('project.version.name')"
:filters="versionFilters"
min-width="100px"
prop="versionId">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column
prop="createUser"
:label="'创建人'"/>
@ -96,6 +111,7 @@ import TableSelectCountBar from "./TableSelectCountBar";
import {_filter, _sort, buildBatchParam} from "@/common/js/tableUtils";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {TEST_PLAN_RELEVANCE_API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import {hasLicense} from "@/common/js/utils";
export default {
name: "RelevanceCaseList",
@ -136,17 +152,20 @@ export default {
priority: CASE_PRIORITY,
},
methodColorMap: new Map(API_METHOD_COLOUR),
screenHeight: 'calc(100vh - 300px)',//
screenHeight: 'calc(100vh - 400px)',//
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
environmentId: ""
}
environmentId: "",
versionEnable: false,
};
},
props: {
currentProtocol: String,
selectNodeIds: Array,
versionFilters: Array,
currentVersion: String,
visible: {
type: Boolean,
default: false,
@ -167,8 +186,10 @@ export default {
planId: String,
isTestPlan: Boolean
},
created: function () {
created() {
this.condition.versionId = this.currentVersion;
this.initTable();
this.checkVersionEnable();
},
watch: {
selectNodeIds() {
@ -179,6 +200,11 @@ export default {
},
projectId() {
this.initTable();
this.checkVersionEnable();
},
currentVersion() {
this.condition.versionId = this.currentVersion;
this.initTable();
}
},
computed: {
@ -292,9 +318,19 @@ export default {
}
param.ids = Array.from(sampleSelectRows).map(row => row.id);
return param;
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
});
}
}
},
}
};
</script>
<style scoped>
@ -314,9 +350,7 @@ export default {
.search-input {
float: right;
width: 300px;
/*margin-bottom: 20px;*/
margin-right: 20px;
width: 200px;
}
.adv-search-bar {

View File

@ -15,6 +15,7 @@
</template>
<ms-api-scenario-list
v-if="versionEnable"
:select-node-ids="selectNodeIds"
:select-project-id="projectId"
:referenced="true"
@ -23,7 +24,11 @@
@selection="setData"
:is-relate="true"
:custom-num="customNum"
ref="apiScenarioList"/>
ref="apiScenarioList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
</ms-api-scenario-list>
<template v-slot:headerBtn>
<el-button type="primary" @click="copy" :loading="buttonIsWorking" @keydown.enter.native.prevent size="mini">
@ -37,90 +42,76 @@
</template>
<script>
import MsContainer from "../../../../common/components/MsContainer";
import MsAsideContainer from "../../../../common/components/MsAsideContainer";
import MsMainContainer from "../../../../common/components/MsMainContainer";
import MsApiScenarioModule from "../ApiScenarioModule";
import MsApiScenarioList from "../ApiScenarioList";
import {getUUID} from "../../../../../../common/js/utils";
import RelevanceDialog from "../../../../track/plan/view/comonents/base/RelevanceDialog";
import TestCaseRelevanceBase from "@/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase";
import MsContainer from "../../../../common/components/MsContainer";
import MsAsideContainer from "../../../../common/components/MsAsideContainer";
import MsMainContainer from "../../../../common/components/MsMainContainer";
import MsApiScenarioModule from "../ApiScenarioModule";
import MsApiScenarioList from "../ApiScenarioList";
import {getUUID, hasLicense} from "@/common/js/utils";
import RelevanceDialog from "../../../../track/plan/view/comonents/base/RelevanceDialog";
import TestCaseRelevanceBase from "@/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase";
export default {
name: "ScenarioRelevance",
components: {
TestCaseRelevanceBase,
RelevanceDialog,
MsApiScenarioList,
MsApiScenarioModule,
MsMainContainer, MsAsideContainer, MsContainer
},
data() {
return {
buttonIsWorking: false,
result: {},
currentProtocol: null,
selectNodeIds: [],
moduleOptions: {},
isApiListEnable: true,
currentScenario: [],
currentScenarioIds: [],
projectId: '',
customNum: false
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "ScenarioRelevance",
components: {
'VersionSelect': VersionSelect.default,
TestCaseRelevanceBase,
RelevanceDialog,
MsApiScenarioList,
MsApiScenarioModule,
MsMainContainer, MsAsideContainer, MsContainer
},
data() {
return {
buttonIsWorking: false,
result: {},
currentProtocol: null,
selectNodeIds: [],
moduleOptions: {},
isApiListEnable: true,
currentScenario: [],
currentScenarioIds: [],
projectId: '',
customNum: false,
versionOptions: [],
currentVersion: '',
versionEnable: true,
};
},
watch: {
projectId(val) {
this.$refs.nodeTree.list(this.projectId);
if (val) {
this.$get("/project/get/" + val, result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;
}
});
}
this.$refs.apiScenarioList.search(this.projectId);
this.getVersionOptionList(this.projectId);
this.checkVersionEnable(this.projectId);
}
},
methods: {
changeButtonLoadingType() {
this.buttonIsWorking = false;
},
watch: {
projectId(val) {
this.$refs.nodeTree.list(this.projectId);
if (val) {
this.$get("/project/get/" + val, result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;
}
});
}
this.$refs.apiScenarioList.search(this.projectId);
}
},
methods: {
changeButtonLoadingType(){
this.buttonIsWorking = false;
},
reference() {
this.buttonIsWorking = true;
let scenarios = [];
let conditions = this.getConditions();
if (conditions.selectAll) {
let params = {};
params.ids = this.currentScenarioIds;
params.condition = conditions;
let url = "/api/automation/list/all/";
this.result = this.$post(url, params, (response) => {
this.currentScenario = response.data;
if (!this.currentScenario || this.currentScenario.length < 1) {
this.$emit('请选择场景');
this.buttonIsWorking = false;
return;
}
this.currentScenario.forEach(item => {
let obj = {
id: item.id,
name: item.name,
type: "scenario",
referenced: 'REF',
resourceId: getUUID(),
projectId: item.projectId
};
scenarios.push(obj);
});
this.$emit('save', scenarios);
this.$refs.baseRelevance.close();
this.buttonIsWorking = false;
},(error) => {
this.buttonIsWorking = false;
});
} else {
reference() {
this.buttonIsWorking = true;
let scenarios = [];
let conditions = this.getConditions();
if (conditions.selectAll) {
let params = {};
params.ids = this.currentScenarioIds;
params.condition = conditions;
let url = "/api/automation/list/all/";
this.result = this.$post(url, params, (response) => {
this.currentScenario = response.data;
if (!this.currentScenario || this.currentScenario.length < 1) {
this.$emit('请选择场景');
this.buttonIsWorking = false;
@ -140,55 +131,42 @@
this.$emit('save', scenarios);
this.$refs.baseRelevance.close();
this.buttonIsWorking = false;
}, (error) => {
this.buttonIsWorking = false;
});
} else {
if (!this.currentScenario || this.currentScenario.length < 1) {
this.$emit('请选择场景');
this.buttonIsWorking = false;
return;
}
},
copy() {
this.buttonIsWorking = true;
let scenarios = [];
let conditions = this.getConditions();
if (conditions.selectAll) {
let url = "/api/automation/id/all/";
let params = {};
params.ids = this.currentScenarioIds;
params.condition = conditions;
this.result = this.$post(url, params, (response) => {
this.currentScenarioIds = response.data;
if (!this.currentScenarioIds || this.currentScenarioIds.length < 1) {
this.$warning('请选择场景');
this.buttonIsWorking = false;
return;
}
this.result = this.$post("/api/automation/getApiScenarios/", this.currentScenarioIds, response => {
if (response.data) {
response.data.forEach(item => {
let scenarioDefinition = JSON.parse(item.scenarioDefinition);
if (scenarioDefinition && scenarioDefinition.hashTree) {
let obj = {
id: item.id,
name: item.name,
type: "scenario",
headers: scenarioDefinition.headers,
variables: scenarioDefinition.variables,
environmentMap: scenarioDefinition.environmentMap,
referenced: 'Copy',
resourceId: getUUID(),
hashTree: scenarioDefinition.hashTree,
projectId: item.projectId
};
scenarios.push(obj);
}
});
this.$emit('save', scenarios);
this.$refs.baseRelevance.close();
this.buttonIsWorking = false;
}
},(error) => {
this.buttonIsWorking = false;
});
},(error) => {
this.buttonIsWorking = false;
});
} else {
this.currentScenario.forEach(item => {
let obj = {
id: item.id,
name: item.name,
type: "scenario",
referenced: 'REF',
resourceId: getUUID(),
projectId: item.projectId
};
scenarios.push(obj);
});
this.$emit('save', scenarios);
this.$refs.baseRelevance.close();
this.buttonIsWorking = false;
}
},
copy() {
this.buttonIsWorking = true;
let scenarios = [];
let conditions = this.getConditions();
if (conditions.selectAll) {
let url = "/api/automation/id/all/";
let params = {};
params.ids = this.currentScenarioIds;
params.condition = conditions;
this.result = this.$post(url, params, (response) => {
this.currentScenarioIds = response.data;
if (!this.currentScenarioIds || this.currentScenarioIds.length < 1) {
this.$warning('请选择场景');
this.buttonIsWorking = false;
@ -218,48 +196,110 @@
this.$refs.baseRelevance.close();
this.buttonIsWorking = false;
}
},(error) => {
}, (error) => {
this.buttonIsWorking = false;
});
}, (error) => {
this.buttonIsWorking = false;
});
} else {
if (!this.currentScenarioIds || this.currentScenarioIds.length < 1) {
this.$warning('请选择场景');
this.buttonIsWorking = false;
return;
}
},
close() {
this.$emit('close');
this.refresh();
this.$refs.relevanceDialog.close();
},
open() {
this.buttonIsWorking = false;
this.$refs.baseRelevance.open();
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.search(this.projectId);
}
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
refresh() {
this.$refs.apiScenarioList.search();
},
setData(data) {
this.currentScenario = Array.from(data).map(row => row);
this.currentScenarioIds = Array.from(data).map(row => row.id);
},
setProject(projectId) {
this.projectId = projectId;
this.selectNodeIds = [];
},
getConditions() {
return this.$refs.apiScenarioList.getConditions();
},
}
this.result = this.$post("/api/automation/getApiScenarios/", this.currentScenarioIds, response => {
if (response.data) {
response.data.forEach(item => {
let scenarioDefinition = JSON.parse(item.scenarioDefinition);
if (scenarioDefinition && scenarioDefinition.hashTree) {
let obj = {
id: item.id,
name: item.name,
type: "scenario",
headers: scenarioDefinition.headers,
variables: scenarioDefinition.variables,
environmentMap: scenarioDefinition.environmentMap,
referenced: 'Copy',
resourceId: getUUID(),
hashTree: scenarioDefinition.hashTree,
projectId: item.projectId
};
scenarios.push(obj);
}
});
this.$emit('save', scenarios);
this.$refs.baseRelevance.close();
this.buttonIsWorking = false;
}
}, (error) => {
this.buttonIsWorking = false;
});
}
},
close() {
this.$emit('close');
this.refresh();
this.$refs.relevanceDialog.close();
},
open() {
this.buttonIsWorking = false;
this.$refs.baseRelevance.open();
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.search(this.projectId);
}
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
refresh() {
this.$refs.apiScenarioList.search();
},
setData(data) {
this.currentScenario = Array.from(data).map(row => row);
this.currentScenarioIds = Array.from(data).map(row => row.id);
},
setProject(projectId) {
this.projectId = projectId;
this.selectNodeIds = [];
},
getConditions() {
return this.$refs.apiScenarioList.getConditions();
},
getVersionOptionList(projectId) {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + projectId, response => {
this.versionOptions = response.data;
});
}
},
changeVersion(currentVersion) {
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.condition.versionId = currentVersion || null;
}
this.refresh();
},
checkVersionEnable(projectId) {
if (!projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + projectId, response => {
this.versionEnable = false;
this.$nextTick(() => {
this.versionEnable = true;
});
});
}
},
}
};
</script>
<style scoped>

View File

@ -20,6 +20,7 @@
<i class="el-icon-warning"/>
</el-tooltip>
</span>
<span v-xpack v-if="request.versionEnable">{{$t('project.version.name')}}: {{ request.versionName }}</span>
</template>
<template v-slot:behindHeaderLeft>
@ -443,6 +444,8 @@ export default {
this.request.disabled = true;
this.request.root = true;
this.request.projectId = response.data.projectId;
this.request.versionName = response.data.versionName;
this.request.versionEnable = response.data.versionEnable;
let req = JSON.parse(response.data.request);
if (req && this.request) {
this.request.hashTree = hashTree;
@ -462,6 +465,8 @@ export default {
this.getWorkspaceId(response.data.projectId);
}
this.request.id = response.data.id;
this.request.versionName = response.data.versionName;
this.request.versionEnable = response.data.versionEnable;
}
})
} else if (this.request.refType === 'API') {
@ -472,6 +477,8 @@ export default {
this.getWorkspaceId(response.data.projectId);
}
this.request.id = response.data.id;
this.request.versionName = response.data.versionName;
this.request.versionEnable = response.data.versionEnable;
}
})
}

View File

@ -22,6 +22,7 @@
<i class="el-icon-warning"/>
</el-tooltip>
</span>
<span v-xpack v-if="scenario.versionEnable">{{$t('project.version.name')}}: {{ scenario.versionName }}</span>
</template>
<template v-slot:behindHeaderLeft>
@ -130,6 +131,8 @@ export default {
this.scenario.num = response.data.num;
this.getWorkspaceId(response.data.projectId);
}
this.scenario.versionName = response.data.versionName;
this.scenario.versionEnable = response.data.versionEnable;
this.scenario.name = response.data.name;
this.scenario.headers = obj.headers;
this.scenario.variables = obj.variables;
@ -144,9 +147,11 @@ export default {
if(response.data.num){
this.scenario.num = response.data.num;
this.getWorkspaceId(response.data.projectId);
}else {
} else {
this.isSameSpace = false
}
this.scenario.versionName = response.data.versionName;
this.scenario.versionEnable = response.data.versionEnable;
} else {
this.isSameSpace = false
}

View File

@ -42,6 +42,9 @@
left-content="API"
right-content="CASE"
>
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
<!-- 列表集合 -->
<ms-api-list
v-if="trashActiveDom==='left'"
@ -100,6 +103,9 @@
:right-content="$t('api_test.definition.doc_title')"
:right-button-enable="currentProtocol === 'HTTP' "
>
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
<!-- 列表集合 -->
<ms-api-list
v-if="activeDom==='left'"
@ -107,6 +113,7 @@
:module-tree="nodeTree"
:module-options="moduleOptions"
:current-protocol="currentProtocol"
:current-version="currentVersion"
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
@ -129,6 +136,7 @@
<api-case-simple-list
v-if="activeDom==='middle'"
:current-protocol="currentProtocol"
:current-version="currentVersion"
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
@ -145,7 +153,8 @@
v-if="activeDom==='right' && currentProtocol==='HTTP'"
:project-id="projectId"
:trash-enable="trashEnable"
:module-ids="selectNodeIds"/>
:module-ids="selectNodeIds"
ref="documentsPage"/>
</ms-tab-button>
<!-- 添加/编辑测试窗口-->
<div v-if="item.type=== 'ADD' ||item.type === 'TEST'" class="ms-api-div">
@ -232,7 +241,6 @@ import MsApiList from './components/list/ApiList';
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsAsideContainer from "../../common/components/MsAsideContainer";
import MsApiConfig from "./components/ApiConfig";
import MsDebugHttpPage from "./components/debug/DebugHttpPage";
import MsDebugJdbcPage from "./components/debug/DebugJdbcPage";
import MsDebugTcpPage from "./components/debug/DebugTcpPage";
@ -242,7 +250,14 @@ import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage";
import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage";
import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage";
import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage";
import {getCurrentProjectID, getCurrentUser, getCurrentUserId, getUUID, hasPermission} from "@/common/js/utils";
import {
getCurrentProjectID,
getCurrentUser,
getCurrentUserId,
getUUID,
hasLicense,
hasPermission
} from "@/common/js/utils";
import MsApiModule from "./components/module/ApiModule";
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
@ -257,6 +272,10 @@ import MsEnvironmentSelect from "./components/case/MsEnvironmentSelect";
import {PROJECT_ID} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "ApiDefinition",
computed: {
@ -274,6 +293,7 @@ export default {
},
},
components: {
'VersionSelect': VersionSelect.default,
ApiSchedule,
MsTabButton,
MsTableButton,
@ -283,7 +303,6 @@ export default {
MsMainContainer,
MsContainer,
MsAsideContainer,
MsApiConfig,
MsDebugHttpPage,
MsRunTestHttpPage,
MsDebugJdbcPage,
@ -341,7 +360,8 @@ export default {
initApiTableOpretion: 'init',
param: {},
useEnvironment: String,
activeTab: "api"
activeTab: "api",
currentVersion: null,
};
},
activated() {
@ -399,10 +419,10 @@ export default {
},
created() {
let projectId = this.$route.params.projectId;
if(projectId){
if (projectId) {
sessionStorage.setItem(PROJECT_ID, projectId);
}
if (this.$route.query.projectId){
if (this.$route.query.projectId) {
sessionStorage.setItem(PROJECT_ID, this.$route.query.projectId);
}
this.getEnv();
@ -550,7 +570,7 @@ export default {
this.$store.state.apiMap.get(t.api.id).get("fromChange") === true)) {
message += t.api.name + "";
}
})
});
if (message !== "") {
this.$alert(this.$t('commons.api') + " [ " + message.substr(0, message.length - 1) + " ] " + this.$t('commons.confirm_info'), '', {
confirmButtonText: this.$t('commons.confirm'),
@ -592,7 +612,7 @@ export default {
this.handleTabRemove(targetName);
}
}
})
});
},
handleTabRemove(targetName) {
let tabs = this.apiTabs;
@ -660,15 +680,15 @@ export default {
init() {
let routeTestCase = this.$route.params.apiDefinition;
if (routeTestCase) {
this.editApi(routeTestCase)
this.editApi(routeTestCase);
}
let dataRange = this.$route.params.dataSelectRange;
let dataType = this.$route.params.dataType;
if(dataRange){
if (dataRange) {
let selectParamArr = dataRange.split("edit:");
if (selectParamArr.length === 2) {
let scenarioId = selectParamArr[1];
if(dataType==='api'){
if (dataType === 'api') {
this.$get('/api/definition/get/' + scenarioId, (response) => {
this.editApi(response.data);
});
@ -732,7 +752,9 @@ export default {
if (this.$refs.apiDefList && this.$refs.apiDefList[0]) {
this.$refs.apiDefList[0].initTable();
}
if (this.$refs.documentsPage && this.$refs.documentsPage[0]) {
this.$refs.documentsPage[0].initApiDocSimpleList();
}
//this.$refs.nodeTree.list();
},
refreshTree() {
@ -803,11 +825,14 @@ export default {
if (data) {
this.apiDefaultTab = "trash";
} else {
this.apiDefaultTab = "default"
this.apiDefaultTab = "default";
}
},
updateInitApiTableOpretion(param) {
this.initApiTableOpretion = param;
},
changeVersion(currentVersion) {
this.currentVersion = currentVersion || null;
}
}
};
@ -817,7 +842,7 @@ export default {
.ms-api-div {
overflow-y: auto;
height: calc(100vh - 155px)
height: calc(100vh - 125px)
}
/deep/ .el-main {
@ -858,4 +883,8 @@ export default {
max-width: 100%;
padding-right: 100%;
}
.version-select {
padding-left: 10px;
}
</style>

View File

@ -6,22 +6,26 @@
:request="request" :response="response" :project-id="projectId"
@mockConfig="mockConfig"
@changeTab="changeTab"
@checkout="checkout"
:basisData="currentApi" :moduleOptions="moduleOptions" :syncTabs="syncTabs"
v-if="currentProtocol === 'HTTP'" ref="httpApi"/>
<!-- TCP -->
<ms-edit-complete-tcp-api :request="request" @runTest="runTest" @createRootModelInTree="createRootModelInTree"
@saveApi="saveApi" :basisData="currentApi"
@changeTab="changeTab"
@checkout="checkout"
:moduleOptions="moduleOptions" :syncTabs="syncTabs" v-if="currentProtocol === 'TCP'"
ref="tcpApi"/>
<!--DUBBO-->
<ms-edit-complete-dubbo-api :request="request" @runTest="runTest" @createRootModelInTree="createRootModelInTree"
@saveApi="saveApi" :basisData="currentApi"
@checkout="checkout"
:moduleOptions="moduleOptions" :syncTabs="syncTabs" v-if="currentProtocol === 'DUBBO'"
ref="dubboApi"/>
<!--SQL-->
<ms-edit-complete-sql-api :request="request" @runTest="runTest" @createRootModelInTree="createRootModelInTree"
@saveApi="saveApi" :basisData="currentApi"
@checkout="checkout"
:moduleOptions="moduleOptions" :syncTabs="syncTabs" v-if="currentProtocol === 'SQL'"
ref="sqlApi"/>
</div>
@ -145,6 +149,9 @@ export default {
mockConfig(data) {
this.$emit('mockConfig', data);
},
checkout(data) {
this.$emit('checkout', data);
},
createRootModelInTree() {
this.$emit("createRootModel");
},
@ -261,10 +268,12 @@ export default {
}
this.sort(data.request.hashTree);
}
this.$fileUpload(this.reqUrl, null, bodyFiles, data, () => {
this.$fileUpload(this.reqUrl, null, bodyFiles, data, (response) => {
this.$success(this.$t('commons.save_success'));
this.reqUrl = "/api/definition/update";
this.currentApi.isCopy = false;
// apiidref_id id
data.id = response.data.id;
this.$emit('saveApi', data);
});
this.$store.state.apiMap.delete(this.currentApi.id);

View File

@ -1,6 +1,6 @@
<template>
<el-card class="card-content" v-if="isShow && !loading">
<el-button-group v-if="currentApi.id">
<el-button-group v-if="currentApi.id" style="z-index: 10; position: fixed;">
<el-tooltip class="item" effect="dark" :content="$t('api_test.definition.api_title')" placement="left">
<el-button plain :class="{active: showApiList}" @click="changeTab('api')" size="small">API</el-button>
</el-tooltip>
@ -8,15 +8,17 @@
<el-button plain :class="{active: showTest}" @click="changeTab('test')" size="small">TEST</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" :content="$t('api_test.definition.case_title')" placement="top">
<el-button plain :class="{active: showTestCaseList}" @click="changeTab('testCase')" size="small">CASE</el-button>
<el-button plain :class="{active: showTestCaseList}" @click="changeTab('testCase')" size="small">CASE
</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="Mock设置" placement="right" v-if="currentProtocol === 'HTTP' || currentProtocol === 'TCP'">
<el-tooltip class="item" effect="dark" content="Mock设置" placement="right"
v-if="currentProtocol === 'HTTP' || currentProtocol === 'TCP'">
<el-button plain :class="{active: showMock}" @click="changeTab('mock')" size="small"> Mock</el-button>
</el-tooltip>
</el-button-group>
<div style="height: 40px"></div>
<template v-slot:header>
<slot name="header"></slot>
</template>
@ -30,11 +32,12 @@
:moduleOptions="moduleOptions"
@runTest="runTest"
@saveApi="saveApi"
@checkout="checkout"
@changeTab="changeTab"
@createRootModel="createRootModel"
/>
</div>
<div v-else-if="showTest" class="ms-api-div">
<div v-else-if="showTest">
<ms-run-test-http-page
:syncTabs="syncTabs"
:currentProtocol="currentProtocol"
@ -77,15 +80,16 @@
/>
</div>
<div v-if="showMock && (currentProtocol === 'HTTP')" class="ms-api-div">
<div v-if="showMock && (currentProtocol === 'HTTP')">
<mock-tab :base-mock-config-data="baseMockConfigData" :is-tcp="false"/>
</div>
<div v-if="showMock && (currentProtocol === 'TCP')" class="ms-api-div">
<div v-if="showMock && (currentProtocol === 'TCP')">
<mock-tab :base-mock-config-data="baseMockConfigData" :is-tcp="true"/>
</div>
<div v-if="showTestCaseList">
<!--测试用例列表-->
<api-case-simple-list
class="api-case-simple-list"
:apiDefinitionId="currentApi.id"
:trash-enable="false"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@ -140,7 +144,7 @@ export default {
loading: false,
createCase: "",
api: {},
}
};
},
props: {
activeDom: String,
@ -194,7 +198,10 @@ export default {
stepArray[i].authManager.clazzName = TYPE_TO_C.get(stepArray[i].authManager.type);
}
if (stepArray[i].type === "Assertions" && !stepArray[i].document) {
stepArray[i].document = {type: "JSON", data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}};
stepArray[i].document = {
type: "JSON",
data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}
};
}
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.sort(stepArray[i].hashTree);
@ -260,6 +267,10 @@ export default {
refresh() {
this.$emit("refresh");
},
checkout(data) {
Object.assign(this.currentApi, data);
this.reload();
},
changeTab(tabType) {
this.refreshButtonActiveClass(tabType);
},
@ -283,9 +294,9 @@ export default {
}
},
reload() {
this.loading = true
this.loading = true;
this.$nextTick(() => {
this.loading = false
this.loading = false;
});
},
saveAsCase(api) {
@ -325,7 +336,7 @@ export default {
}
}
},
}
};
</script>
<style scoped>
@ -342,4 +353,10 @@ export default {
.item {
border: solid 1px var(--primary_color);
}
.api-case-simple-list >>> .el-table {
height: calc(100vh - 262px) !important;
}
</style>

View File

@ -422,6 +422,7 @@ export default {
tmp.id = tmp.request.id;
row.request.id = tmp.request.id;
tmp.request.path = this.api.path;
tmp.versionId = this.api.versionId;
if (tmp.request.protocol != "dubbo://" && tmp.request.protocol != "DUBBO") {
tmp.request.method = this.api.method;
}

View File

@ -1,5 +1,5 @@
<template>
<div>
<span>
<slot name="header"></slot>
<el-input :placeholder="$t('commons.search_by_name_or_id')" @blur="initTable" class="search-input" size="small"
@keyup.enter.native="initTable" v-model="condition.name"/>
@ -67,6 +67,17 @@
</template>
</ms-table-column>
<ms-table-column
v-if="versionEnable"
:label="$t('project.version.name')"
:filters="versionFilters"
min-width="100px"
prop="versionId">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column
width="160"
:label="$t('api_test.definition.api_last_time')"
@ -86,156 +97,172 @@
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</div>
</span>
</template>
<script>
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsBottomContainer from "../../../definition/components/BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../../../definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR} from "../../../definition/model/JsonData";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {getProtocolFilter} from "@/business/components/api/definition/api-definition";
import {getProjectMember} from "@/network/user";
import TableSelectCountBar from "@/business/components/api/automation/scenario/api/TableSelectCountBar";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsBottomContainer from "../../../definition/components/BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../../../definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR} from "../../../definition/model/JsonData";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {getProtocolFilter} from "@/business/components/api/definition/api-definition";
import {getProjectMember} from "@/network/user";
import TableSelectCountBar from "@/business/components/api/automation/scenario/api/TableSelectCountBar";
import {hasLicense} from "@/common/js/utils";
export default {
name: "ApiTableList",
components: {
TableSelectCountBar,
MsEnvironmentSelect,
PriorityTableItem,
ApiListContainer,
MsTableOperatorButton,
MsTableOperator,
MsTablePagination,
MsTag,
MsBottomContainer,
ShowMoreBtn,
MsBatchEdit,
MsTable,
MsTableColumn,
MsTableAdvSearchBar
},
data() {
return {
moduleId: "",
deletePath: "/test/case/delete",
typeArr: [
{id: 'priority', name: this.$t('test_track.case.priority')},
],
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
methodColorMap: new Map(API_METHOD_COLOUR),
methodFilters: [],
userFilters: [],
currentPage: 1,
pageSize: 10,
export default {
name: "ApiTableList",
components: {
TableSelectCountBar,
MsEnvironmentSelect,
PriorityTableItem,
ApiListContainer,
MsTableOperatorButton,
MsTableOperator,
MsTablePagination,
MsTag,
MsBottomContainer,
ShowMoreBtn,
MsBatchEdit,
MsTable,
MsTableColumn,
MsTableAdvSearchBar
},
data() {
return {
moduleId: "",
deletePath: "/test/case/delete",
typeArr: [
{id: 'priority', name: this.$t('test_track.case.priority')},
],
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
methodColorMap: new Map(API_METHOD_COLOUR),
methodFilters: [],
userFilters: [],
currentPage: 1,
pageSize: 10,
versionEnable: false,
};
},
props: {
currentProtocol: String,
projectId: String,
selectNodeIds: Array,
result: Object,
tableData: Array,
condition: Object,
total: Number,
versionFilters: Array,
screenHeight: {
type: [Number, String],
default() {
return 'calc(100vh - 400px)';
}
},
props: {
currentProtocol: String,
selectNodeIds: Array,
result: Object,
tableData: Array,
condition: Object,
total: Number,
screenHeight: {
type: [Number, String],
default() {
return 'calc(100vh - 400px)';
}
}
},
created: function () {
getProjectMember((data) => {
this.userFilters = data;
});
}
},
created: function () {
getProjectMember((data) => {
this.userFilters = data;
});
this.getProtocolFilter();
this.checkVersionEnable();
},
watch: {
currentProtocol() {
this.getProtocolFilter();
},
watch: {
currentProtocol() {
this.getProtocolFilter();
}
},
mounted() {
if (this.$refs.apitable) {
this.$emit('setSelectRow', this.$refs.apitable.getSelectRows());
projectId() {
this.checkVersionEnable();
}
},
mounted() {
if (this.$refs.apitable) {
this.$emit('setSelectRow', this.$refs.apitable.getSelectRows());
} else {
this.$emit('setSelectRow', new Set());
}
},
computed: {
getApiRequestTypeName() {
if (this.currentProtocol === 'TCP') {
return this.$t('api_test.definition.api_agreement');
} else {
this.$emit('setSelectRow', new Set());
return this.$t('api_test.definition.api_type');
}
},
computed: {
getApiRequestTypeName(){
if(this.currentProtocol === 'TCP'){
return this.$t('api_test.definition.api_agreement');
}else{
return this.$t('api_test.definition.api_type');
}
},
},
methods: {
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
methods: {
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
getColor(flag, method) {
return this.methodColorMap.get(method);
},
getProtocolFilter() {
this.methodFilters = getProtocolFilter(this.currentProtocol);
},
getSelectIds() {
return this.$refs.apitable.selectIds;
},
initTable() {
this.$emit('refreshTable');
},
clear() {
if (this.$refs.apitable) {
this.$refs.apitable.clear();
}
},
getColor(flag, method) {
return this.methodColorMap.get(method);
},
}
getProtocolFilter() {
this.methodFilters = getProtocolFilter(this.currentProtocol);
},
getSelectIds() {
return this.$refs.apitable.selectIds;
},
initTable() {
this.$emit('refreshTable');
},
clear() {
if (this.$refs.apitable) {
this.$refs.apitable.clear();
}
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
});
}
}
},
};
</script>
<style scoped>
.request-method {
padding: 0 5px;
color: #1E90FF;
}
.request-method {
padding: 0 5px;
color: #1E90FF;
}
.api-el-tag {
color: white;
}
.api-el-tag {
color: white;
}
.search-input {
float: right;
width: 30%;
margin-bottom: 20px;
margin-right: 20px;
}
.search-input {
float: right;
width: 200px;
}
.adv-search-bar {
float: right;
margin-top: 5px;
margin-right: 10px;
}
.adv-search-bar {
float: right;
margin-top: 5px;
margin-right: 10px;
}
</style>

View File

@ -3,26 +3,26 @@
<el-form :model="basicForm" label-position="right" label-width="80px" size="small" :rules="rule" ref="basicForm" style="margin-right: 20px">
<!-- 基础信息 -->
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input class="ms-http-input" size="small" v-model="basicForm.name"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item :label="$t('test_track.module.module')" prop="moduleId">
<ms-select-tree size="small" :data="moduleOptions" :defaultKey="basicForm.moduleId" @getValue="setModule" :obj="moduleObj" clearable checkStrictly/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item :label="$t('commons.status')" prop="status">
<el-select class="ms-http-input" size="small" v-model="basicForm.status" style="width: 100%">
<el-option v-for="item in options" :key="item.id" :label="$t(item.label)" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('api_test.definition.request.responsible')" prop="userId">
<el-select v-model="basicForm.userId"
:placeholder="$t('api_test.definition.request.responsible')" filterable size="small"
@ -37,9 +37,6 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('commons.tag')" prop="tag">
<ms-input-tag :currentScenario="basicForm" ref="tag"/>
@ -61,7 +58,6 @@
<script>
import {API_STATUS} from "../../model/JsonData";
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
import MsSelectTree from "../../../../common/select-tree/SelectTree";
import {getCurrentProjectID} from "@/common/js/utils";
@ -148,8 +144,8 @@
methods: {
apiMapStatus() {
this.$store.state.apiStatus.set("fromChange", true);
if (this.httpForm.id) {
this.$store.state.apiMap.set(this.httpForm.id, this.$store.state.apiStatus);
if (this.basicForm.id) {
this.$store.state.apiMap.set(this.basicForm.id, this.$store.state.apiStatus);
}
},
getMaintainerOptions() {

View File

@ -7,16 +7,24 @@
<!--操作按钮-->
<div style="float: right;margin-right: 20px;margin-top: 20px" class="ms-opt-btn">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
<i class="el-icon-star-off"
style="color: #783987; font-size: 25px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
<i class="el-icon-star-on"
style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="basisData.id">
{{ $t('operating_log.change_history') }}
</el-link>
<!-- 版本历史 -->
<ms-version-history v-xpack
ref="versionHistory"
:version-data="versionData"
:current-id="basisData.id"
@compare="compare" @checkout="checkout" @create="create" @del="del"/>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
</div>
</el-col>
@ -26,7 +34,8 @@
<br/>
<el-row>
<el-col>
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions" :basisData="basisData" ref="basicForm"
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions"
:basisData="basisData" ref="basicForm"
@callback="callback"/>
</el-col>
</el-row>
@ -45,13 +54,17 @@ import MsBasisApi from "./BasisApi";
import MsBasisParameters from "../request/dubbo/BasisParameters";
import MsChangeHistory from "../../../../history/ChangeHistory";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
import {getCurrentUser} from "@/common/js/utils";
import {getCurrentUser, hasLicense} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
export default {
name: "MsApiDubboRequestForm",
components: {
ApiOtherInfo,
MsBasisApi, MsBasisParameters, MsChangeHistory
MsBasisApi, MsBasisParameters, MsChangeHistory,
'MsVersionHistory': versionHistory.default,
},
props: {
request: {},
@ -75,7 +88,7 @@ export default {
if (item === this.basisData.id) {
return true;
}
})
});
this.syncTabs.splice(index, 1);
Object.assign(this.request, request);
}
@ -93,12 +106,16 @@ export default {
}
}
});
if (hasLicense()) {
this.getVersionHistory();
}
},
data() {
return {
validated: false,
showFollow: false
}
showFollow: false,
versionData: [],
};
},
methods: {
openHis() {
@ -140,7 +157,7 @@ export default {
this.showFollow = false;
for (let i = 0; i < this.basisData.follows.length; i++) {
if (this.basisData.follows[i] === getCurrentUser().id) {
this.basisData.follows.splice(i, 1)
this.basisData.follows.splice(i, 1);
break;
}
}
@ -154,18 +171,51 @@ export default {
if (!this.basisData.follows) {
this.basisData.follows = [];
}
this.basisData.follows.push(getCurrentUser().id)
this.basisData.follows.push(getCurrentUser().id);
if (this.basisData.id) {
this.$post("/api/definition/update/follows/" + this.basisData.id, this.basisData.follows, () => {
this.$success(this.$t('commons.follow_success'));
});
}
}
},
getVersionHistory() {
this.$get('/api/definition/versions/' + this.basisData.id, response => {
this.versionData = response.data;
});
},
compare(row) {
// console.log(row);
},
checkout(row) {
let api = this.versionData.filter(v => v.versionId === row.id)[0];
if (api.tags && api.tags.length > 0) {
api.tags = JSON.parse(api.tags);
}
this.$emit("checkout", api);
},
create(row) {
//
this.basisData.versionId = row.id;
this.saveApi();
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('/api/definition/delete/' + row.id + '/' + this.basisData.refId, () => {
this.$success(this.$t('commons.delete_success'));
this.getVersionHistory();
});
}
}
});
}
},
computed: {}
}
};
</script>
<style scoped>
@ -173,6 +223,7 @@ export default {
.ms-opt-btn {
position: fixed;
right: 50px;
z-index: 1;
z-index: 120;
top: 107px;
}
</style>

View File

@ -5,16 +5,28 @@
<el-form :model="httpForm" :rules="rule" ref="httpForm" label-width="80px" label-position="right">
<!-- 操作按钮 -->
<div style="float: right;margin-right: 20px" class="ms-opt-btn">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-right: 5px; position: relative; top: 5px; cursor: pointer " @click="saveFollow" />
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
<i class="el-icon-star-off"
style="color: #783987; font-size: 25px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer " @click="saveFollow" />
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
<i class="el-icon-star-on"
style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="httpForm.id">
<el-link type="primary" style="margin-right: 5px" @click="openHis" v-if="httpForm.id">
{{ $t('operating_log.change_history') }}
</el-link>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']">{{ $t('commons.save') }}</el-button>
<!-- 版本历史 -->
<ms-version-history v-xpack
ref="versionHistory"
:version-data="versionData"
:current-id="httpForm.id"
@compare="compare" @checkout="checkout" @create="create" @del="del"/>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s"
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']">{{ $t('commons.save') }}
</el-button>
</div>
<br/>
@ -57,7 +69,8 @@
</el-col>
<el-col :span="8">
<el-form-item :label="$t('test_track.module.module')" prop="moduleId">
<ms-select-tree size="small" :data="moduleOptions" :defaultKey="httpForm.moduleId" @getValue="setModule" :obj="moduleObj" clearable checkStrictly/>
<ms-select-tree size="small" :data="moduleOptions" :defaultKey="httpForm.moduleId" @getValue="setModule"
:obj="moduleObj" clearable checkStrictly/>
</el-form-item>
</el-col>
@ -80,8 +93,8 @@
<el-input class="ms-http-textarea"
v-model="httpForm.description"
type="textarea"
:autosize="{ minRows: 2, maxRows: 10}"
:rows="2" size="small"/>
:autosize="{ minRows: 1, maxRows: 10}"
:rows="1" size="small"/>
</el-form-item>
</el-col>
</el-row>
@ -127,367 +140,419 @@
<script>
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import MsResponseText from "../response/ResponseText";
import {API_STATUS, REQ_METHOD} from "../../model/JsonData";
import {KeyValue} from "../../model/ApiTestModel";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
import MsJsr233Processor from "../../../automation/scenario/component/Jsr233Processor";
import MsSelectTree from "../../../../common/select-tree/SelectTree";
import MsChangeHistory from "../../../../history/ChangeHistory";
import {getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils";
import MsFormDivider from "@/business/components/common/components/MsFormDivider";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import MsResponseText from "../response/ResponseText";
import {API_STATUS, REQ_METHOD} from "../../model/JsonData";
import {KeyValue} from "../../model/ApiTestModel";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
import MsJsr233Processor from "../../../automation/scenario/component/Jsr233Processor";
import MsSelectTree from "../../../../common/select-tree/SelectTree";
import MsChangeHistory from "../../../../history/ChangeHistory";
import {getCurrentProjectID, getCurrentUser, getUUID, hasLicense} from "@/common/js/utils";
import MsFormDivider from "@/business/components/common/components/MsFormDivider";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
export default {
name: "MsAddCompleteHttpApi",
components: {
ApiOtherInfo,
MsFormDivider,
MsJsr233Processor, MsResponseText, MsApiRequestForm, MsInputTag, MsSelectTree, MsChangeHistory},
data() {
let validateURL = (rule, value, callback) => {
if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) {
callback(this.$t('api_test.definition.request.path_valid_info'));
}
callback();
};
return {
rule: {
name: [
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
{max: 100, message: this.$t('test_track.length_less_than') + '100', trigger: 'blur'}
],
path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}, {
validator: validateURL,
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'}],
},
httpForm: {environmentId: "", path: "", tags: []},
isShowEnable: true,
showFollow:false,
maintainerOptions: [],
currentModule: {},
reqOptions: REQ_METHOD,
options: API_STATUS,
mockEnvironment: {},
moduleObj: {
id: 'id',
label: 'name',
},
mockBaseUrl: "",
count: 0
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
export default {
name: "MsAddCompleteHttpApi",
components: {
'MsVersionHistory': versionHistory.default,
ApiOtherInfo,
MsFormDivider,
MsJsr233Processor, MsResponseText, MsApiRequestForm, MsInputTag, MsSelectTree, MsChangeHistory
},
data() {
let validateURL = (rule, value, callback) => {
if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) {
callback(this.$t('api_test.definition.request.path_valid_info'));
}
},
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}, syncTabs: Array, projectId: String},
watch: {
'httpForm.name': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
callback();
};
return {
rule: {
name: [
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
{max: 100, message: this.$t('test_track.length_less_than') + '100', trigger: 'blur'}
],
path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}, {
validator: validateURL,
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'}],
},
'httpForm.path': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
httpForm: {environmentId: "", path: "", tags: []},
isShowEnable: true,
showFollow: false,
maintainerOptions: [],
currentModule: {},
reqOptions: REQ_METHOD,
options: API_STATUS,
mockEnvironment: {},
moduleObj: {
id: 'id',
label: 'name',
},
'httpForm.userId': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.moduleId': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.status': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.follows': {
handler(v, v1) {
if (v && v1 && JSON.stringify(v) !== JSON.stringify(v1)) {
this.apiMapStatus();
}
}
},
'httpForm.description': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.tags': {
handler(v, v1) {
this.count++;
if (v && v1 && JSON.stringify(v) !== JSON.stringify(v1) && this.count > 1) {
this.apiMapStatus();
}
}
},
syncTabs() {
if (this.basisData && this.syncTabs && this.syncTabs.includes(this.basisData.id)) {
//
let url = "/api/definition/get/";
this.$get(url + this.basisData.id, response => {
if (response.data) {
let request = JSON.parse(response.data.request);
let index = this.syncTabs.findIndex(item => {
if (item === this.basisData.id) {
return true;
}
})
this.syncTabs.splice(index, 1);
this.httpForm.path = response.data.path;
this.httpForm.method = response.data.method;
Object.assign(this.request, request);
}
});
mockBaseUrl: "",
count: 0,
versionData: [],
};
},
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}, syncTabs: Array, projectId: String},
watch: {
'httpForm.name': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
computed: {
getUrlPrefix() {
if (this.httpForm.path == null) {
return this.mockBaseUrl;
} else {
let path = this.httpForm.path;
let protocol = this.httpForm.method;
if (protocol === 'GET' || protocol === 'DELETE') {
if (this.httpForm.request != null && this.httpForm.request.rest != null) {
let pathUrlArr = path.split("/");
let newPath = "";
pathUrlArr.forEach(item => {
if (item !== "") {
let pathItem = item;
if (item.indexOf("{") === 0 && item.indexOf("}") === (item.length - 1)) {
let paramItem = item.substr(1, item.length - 2);
for (let i = 0; i < this.httpForm.request.rest.length; i++) {
let param = this.httpForm.request.rest[i];
if (param.name === paramItem) {
pathItem = param.value;
}
'httpForm.path': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.userId': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.moduleId': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.status': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.follows': {
handler(v, v1) {
if (v && v1 && JSON.stringify(v) !== JSON.stringify(v1)) {
this.apiMapStatus();
}
}
},
'httpForm.description': {
handler(v, v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'httpForm.tags': {
handler(v, v1) {
this.count++;
if (v && v1 && JSON.stringify(v) !== JSON.stringify(v1) && this.count > 1) {
this.apiMapStatus();
}
}
},
syncTabs() {
if (this.basisData && this.syncTabs && this.syncTabs.includes(this.basisData.id)) {
//
let url = "/api/definition/get/";
this.$get(url + this.basisData.id, response => {
if (response.data) {
let request = JSON.parse(response.data.request);
let index = this.syncTabs.findIndex(item => {
if (item === this.basisData.id) {
return true;
}
});
this.syncTabs.splice(index, 1);
this.httpForm.path = response.data.path;
this.httpForm.method = response.data.method;
Object.assign(this.request, request);
}
});
}
}
},
computed: {
getUrlPrefix() {
if (this.httpForm.path == null) {
return this.mockBaseUrl;
} else {
let path = this.httpForm.path;
let protocol = this.httpForm.method;
if (protocol === 'GET' || protocol === 'DELETE') {
if (this.httpForm.request != null && this.httpForm.request.rest != null) {
let pathUrlArr = path.split("/");
let newPath = "";
pathUrlArr.forEach(item => {
if (item !== "") {
let pathItem = item;
if (item.indexOf("{") === 0 && item.indexOf("}") === (item.length - 1)) {
let paramItem = item.substr(1, item.length - 2);
for (let i = 0; i < this.httpForm.request.rest.length; i++) {
let param = this.httpForm.request.rest[i];
if (param.name === paramItem) {
pathItem = param.value;
}
}
newPath += "/" + pathItem;
}
});
if (newPath !== "") {
path = newPath;
newPath += "/" + pathItem;
}
});
if (newPath !== "") {
path = newPath;
}
}
return this.mockBaseUrl + path;
}
return this.mockBaseUrl + path;
}
}
},
methods: {
apiMapStatus() {
this.$store.state.apiStatus.set("fromChange", true);
if (this.httpForm.id) {
this.$store.state.apiMap.set(this.httpForm.id, this.$store.state.apiStatus);
}
},
methods: {
apiMapStatus() {
this.$store.state.apiStatus.set("fromChange", true);
if (this.httpForm.id) {
this.$store.state.apiMap.set(this.httpForm.id, this.$store.state.apiStatus);
currentUser: () => {
return getCurrentUser();
},
openHis() {
this.$refs.changeHistory.open(this.httpForm.id, ["接口定义", "接口定義", "Api definition"]);
},
mockSetting() {
if (this.basisData.id) {
this.$store.state.currentApiCase = {mock: getUUID()};
this.$emit('changeTab', 'mock');
} else {
this.$alert(this.$t('api_test.mock.create_error'));
}
},
runTest() {
this.$refs['httpForm'].validate((valid) => {
if (valid) {
this.setParameter();
this.$emit('runTest', this.httpForm);
} else {
return false;
}
},
currentUser: () => {
return getCurrentUser();
},
openHis() {
this.$refs.changeHistory.open(this.httpForm.id, ["接口定义", "接口定義", "Api definition"]);
},
mockSetting() {
if (this.basisData.id) {
this.$store.state.currentApiCase = {mock: getUUID()};
this.$emit('changeTab', 'mock');
}else {
this.$alert(this.$t('api_test.mock.create_error'));
});
},
getMaintainerOptions() {
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data;
});
},
setParameter() {
this.request.path = this.httpForm.path;
this.request.method = this.httpForm.method;
this.httpForm.request.useEnvironment = undefined;
if (this.httpForm.tags instanceof Array) {
this.httpForm.tags = JSON.stringify(this.httpForm.tags);
}
},
saveApi() {
this.$refs['httpForm'].validate((valid) => {
if (valid) {
this.setParameter();
if (!this.httpForm.versionId) {
if (this.$refs.versionHistory) {
this.httpForm.versionId = this.$refs.versionHistory.currentVersion.id;
}
}
this.$emit('saveApi', this.httpForm);
this.count = 0;
this.$store.state.apiMap.delete(this.httpForm.id);
} else {
return false;
}
},
runTest() {
this.$refs['httpForm'].validate((valid) => {
if (valid) {
this.setParameter();
this.$emit('runTest', this.httpForm);
} else {
return false;
});
},
createModules() {
this.$emit("createRootModelInTree");
},
urlChange() {
if (!this.httpForm.path || this.httpForm.path.indexOf('?') === -1) return;
let url = this.getURL(this.addProtocol(this.httpForm.path));
if (url) {
this.httpForm.path = decodeURIComponent(this.httpForm.path.substr(0, this.httpForm.path.indexOf("?")));
}
},
addProtocol(url) {
if (url) {
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
return "https://" + url;
}
}
return url;
},
getURL(urlStr) {
try {
let url = new URL(urlStr);
url.searchParams.forEach((value, key) => {
if (key && value) {
this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value}));
}
});
},
getMaintainerOptions() {
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data;
});
},
setParameter() {
this.request.path = this.httpForm.path;
this.request.method = this.httpForm.method;
this.httpForm.request.useEnvironment = undefined;
if (this.httpForm.tags instanceof Array) {
this.httpForm.tags = JSON.stringify(this.httpForm.tags);
}
},
saveApi() {
this.$refs['httpForm'].validate((valid) => {
if (valid) {
this.setParameter();
this.$emit('saveApi', this.httpForm);
this.count = 0;
this.$store.state.apiMap.delete(this.httpForm.id);
} else {
return false;
}
})
},
createModules() {
this.$emit("createRootModelInTree");
},
urlChange() {
if (!this.httpForm.path || this.httpForm.path.indexOf('?') === -1) return;
let url = this.getURL(this.addProtocol(this.httpForm.path));
if (url) {
this.httpForm.path = decodeURIComponent(this.httpForm.path.substr(0, this.httpForm.path.indexOf("?")));
}
},
addProtocol(url) {
if (url) {
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
return "https://" + url;
}
}
return url;
},
getURL(urlStr) {
try {
let url = new URL(urlStr);
url.searchParams.forEach((value, key) => {
if (key && value) {
this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value}));
} catch (e) {
this.$error(this.$t('api_test.request.url_invalid'), 2000);
}
},
setModule(id, data) {
this.httpForm.moduleId = id;
this.httpForm.modulePath = data.path;
},
initMockEnvironment() {
let protocol = document.location.protocol;
protocol = protocol.substring(0, protocol.indexOf(":"));
let url = "/api/definition/getMockEnvironment/";
this.$get(url + this.projectId + "/" + protocol, response => {
this.mockEnvironment = response.data;
let httpConfig = JSON.parse(this.mockEnvironment.config);
if (httpConfig != null) {
httpConfig = httpConfig.httpConfig;
let httpType = httpConfig.defaultCondition;
let conditions = httpConfig.conditions;
conditions.forEach(condition => {
if (condition.type === httpType) {
this.mockBaseUrl = condition.protocol + "://" + condition.socket;
}
});
return url;
} catch (e) {
this.$error(this.$t('api_test.request.url_invalid'), 2000);
}
},
setModule(id, data) {
this.httpForm.moduleId = id;
this.httpForm.modulePath = data.path;
},
initMockEnvironment() {
let protocol = document.location.protocol;
protocol = protocol.substring(0, protocol.indexOf(":"));
let url = "/api/definition/getMockEnvironment/";
this.$get(url + this.projectId + "/" + protocol, response => {
this.mockEnvironment = response.data;
let httpConfig = JSON.parse(this.mockEnvironment.config);
if (httpConfig != null) {
httpConfig = httpConfig.httpConfig;
let httpType = httpConfig.defaultCondition;
let conditions = httpConfig.conditions;
conditions.forEach(condition => {
if (condition.type === httpType) {
this.mockBaseUrl = condition.protocol + "://" + condition.socket;
}
});
}
});
},
saveFollow(){
if(this.showFollow){
this.showFollow = false;
for (let i = 0; i < this.httpForm.follows.length; i++) {
if(this.httpForm.follows[i]===this.currentUser().id){
this.httpForm.follows.splice(i,1)
break;
}
}
if(this.basisData.id){
this.$post("/api/definition/update/follows/"+this.basisData.id, this.httpForm.follows,() => {
this.$success(this.$t('commons.cancel_follow_success'));
});
}
}else {
this.showFollow = true;
if(!this.httpForm.follows){
this.httpForm.follows = [];
}
this.httpForm.follows.push(this.currentUser().id)
if(this.basisData.id){
this.$post("/api/definition/update/follows/"+this.basisData.id, this.httpForm.follows,() => {
this.$success(this.$t('commons.follow_success'));
});
}
}
}
});
},
created() {
this.getMaintainerOptions();
if (!this.basisData.environmentId) {
this.basisData.environmentId = "";
}
this.httpForm = JSON.parse(JSON.stringify(this.basisData));
this.$get('/api/definition/follow/' + this.basisData.id, response => {
this.httpForm.follows = response.data;
for (let i = 0; i < response.data.length; i++) {
if(response.data[i]===this.currentUser().id){
this.showFollow = true;
saveFollow() {
if (this.showFollow) {
this.showFollow = false;
for (let i = 0; i < this.httpForm.follows.length; i++) {
if (this.httpForm.follows[i] === this.currentUser().id) {
this.httpForm.follows.splice(i, 1);
break;
}
}
if (this.basisData.id) {
this.$post("/api/definition/update/follows/" + this.basisData.id, this.httpForm.follows, () => {
this.$success(this.$t('commons.cancel_follow_success'));
});
}
} else {
this.showFollow = true;
if (!this.httpForm.follows) {
this.httpForm.follows = [];
}
this.httpForm.follows.push(this.currentUser().id);
if (this.basisData.id) {
this.$post("/api/definition/update/follows/" + this.basisData.id, this.httpForm.follows, () => {
this.$success(this.$t('commons.follow_success'));
});
}
}
},
getVersionHistory() {
this.$get('/api/definition/versions/' + this.httpForm.id, response => {
this.versionData = response.data;
});
this.initMockEnvironment();
},
compare(row) {
// console.log(row);
},
checkout(row) {
let api = this.versionData.filter(v => v.versionId === row.id)[0];
if (api.tags && api.tags.length > 0) {
api.tags = JSON.parse(api.tags);
}
this.$emit("checkout", api);
},
create(row) {
//
this.httpForm.versionId = row.id;
this.saveApi();
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('/api/definition/delete/' + row.id + '/' + this.httpForm.refId, () => {
this.$success(this.$t('commons.delete_success'));
this.getVersionHistory();
});
}
}
});
}
},
created() {
this.getMaintainerOptions();
if (!this.basisData.environmentId) {
this.basisData.environmentId = "";
}
this.httpForm = JSON.parse(JSON.stringify(this.basisData));
this.$get('/api/definition/follow/' + this.basisData.id, response => {
this.httpForm.follows = response.data;
for (let i = 0; i < response.data.length; i++) {
if (response.data[i] === this.currentUser().id) {
this.showFollow = true;
break;
}
}
});
this.initMockEnvironment();
if (hasLicense()) {
this.getVersionHistory();
}
}
};
</script>
<style scoped>
.base-info .el-form-item {
width: 100%;
}
.base-info .el-form-item {
width: 100%;
}
.mock-info {
margin: 20px 45px;
}
.mock-info {
margin: 20px 45px;
}
.ms-opt-btn {
position: fixed;
right: 50px;
z-index: 1;
}
/*.base-info .el-form-item >>> .el-form-item__content {*/
/* width: 80%;*/
/*}*/
.ms-opt-btn {
position: fixed;
right: 50px;
z-index: 1;
top: 128px;
}
.base-info .ms-http-select {
width: 100%;
}
/*.base-info .el-form-item >>> .el-form-item__content {*/
/* width: 80%;*/
/*}*/
.ms-http-textarea {
width: 100%;
}
.base-info .ms-http-select {
width: 100%;
}
.ms-left-cell {
margin-top: 100px;
}
.ms-http-textarea {
width: 100%;
}
.ms-left-buttion {
margin: 6px 0px 8px 30px;
}
.ms-left-cell {
margin-top: 100px;
}
.ms-left-buttion {
margin: 6px 0px 8px 30px;
}
</style>

View File

@ -6,16 +6,24 @@
<!--操作按钮-->
<div style="float: right;margin-right: 20px;margin-top: 20px" class="ms-opt-btn">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
<i class="el-icon-star-off"
style="color: #783987; font-size: 25px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
<i class="el-icon-star-on"
style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="basisData.id">
<el-link type="primary" style="margin-right: 5px" @click="openHis" v-if="basisData.id">
{{ $t('operating_log.change_history') }}
</el-link>
<!-- 版本历史 -->
<ms-version-history v-xpack
ref="versionHistory"
:version-data="versionData"
:current-id="basisData.id"
@compare="compare" @checkout="checkout" @create="create" @del="del"/>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
</div>
</el-col>
@ -25,7 +33,8 @@
<br/>
<el-row>
<el-col>
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions" :basisData="basisData" ref="basicForm"
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions"
:basisData="basisData" ref="basicForm"
@callback="callback"/>
</el-col>
</el-row>
@ -46,13 +55,17 @@ import MsBasisApi from "./BasisApi";
import MsBasisParameters from "../request/database/BasisParameters";
import MsChangeHistory from "../../../../history/ChangeHistory";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
import {getCurrentUser} from "@/common/js/utils";
import {getCurrentUser, hasLicense} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
export default {
name: "MsApiSqlRequestForm",
components: {
ApiOtherInfo,
MsBasisApi, MsBasisParameters, MsChangeHistory
MsBasisApi, MsBasisParameters, MsChangeHistory,
'MsVersionHistory': versionHistory.default,
},
props: {
request: {},
@ -76,7 +89,7 @@ export default {
if (item === this.basisData.id) {
return true;
}
})
});
this.syncTabs.splice(index, 1);
Object.assign(this.request, request);
}
@ -87,8 +100,9 @@ export default {
data() {
return {
validated: false,
showFollow: false
}
showFollow: false,
versionData: [],
};
},
created() {
this.$get('/api/definition/follow/' + this.basisData.id, response => {
@ -100,6 +114,10 @@ export default {
}
}
});
if (hasLicense()) {
this.getVersionHistory();
}
},
methods: {
openHis() {
@ -141,7 +159,7 @@ export default {
this.showFollow = false;
for (let i = 0; i < this.basisData.follows.length; i++) {
if (this.basisData.follows[i] === getCurrentUser().id) {
this.basisData.follows.splice(i, 1)
this.basisData.follows.splice(i, 1);
break;
}
}
@ -155,23 +173,57 @@ export default {
if (!this.basisData.follows) {
this.basisData.follows = [];
}
this.basisData.follows.push(getCurrentUser().id)
this.basisData.follows.push(getCurrentUser().id);
if (this.basisData.id) {
this.$post("/api/definition/update/follows/" + this.basisData.id, this.basisData.follows, () => {
this.$success(this.$t('commons.follow_success'));
});
}
}
},
getVersionHistory() {
this.$get('/api/definition/versions/' + this.basisData.id, response => {
this.versionData = response.data;
});
},
compare(row) {
// console.log(row);
},
checkout(row) {
let api = this.versionData.filter(v => v.versionId === row.id)[0];
if (api.tags && api.tags.length > 0) {
api.tags = JSON.parse(api.tags);
}
this.$emit("checkout", api);
},
create(row) {
//
this.basisData.versionId = row.id;
this.saveApi();
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('/api/definition/delete/' + row.id + '/' + this.basisData.refId, () => {
this.$success(this.$t('commons.delete_success'));
this.getVersionHistory();
});
}
}
});
}
},
}
};
</script>
<style scoped>
.ms-opt-btn {
position: fixed;
right: 50px;
z-index: 1;
z-index: 120;
top: 107px;
}
</style>

View File

@ -6,16 +6,24 @@
<!--操作按钮-->
<div style="float: right;margin-right: 20px;margin-top: 20px" class="ms-opt-btn">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
<i class="el-icon-star-off"
style="color: #783987; font-size: 25px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
<i class="el-icon-star-on"
style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="basisData.id">
<el-link type="primary" style="margin-right: 5px" @click="openHis" v-if="basisData.id">
{{ $t('operating_log.change_history') }}
</el-link>
<!-- 版本历史 -->
<ms-version-history v-xpack
ref="versionHistory"
:version-data="versionData"
:current-id="basisData.id"
@compare="compare" @checkout="checkout" @create="create" @del="del"/>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
</div>
</el-col>
@ -25,7 +33,8 @@
<br/>
<el-row>
<el-col>
<ms-tcp-basic-api :method-types="methodTypes" @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions"
<ms-tcp-basic-api :method-types="methodTypes" @createRootModelInTree="createRootModelInTree"
:moduleOptions="moduleOptions"
:basisData="basisData" ref="basicForm"
@changeApiProtocol="changeApiProtocol" @callback="callback"/>
</el-col>
@ -58,7 +67,8 @@
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<esb-definition v-xpack v-if="showXpackCompnent" :show-script="false" :request="request" ref="esbDefinition"/>
<p class="tip">{{ $t('api_test.definition.request.res_param') }}</p>
<esb-definition-response v-xpack v-if="showXpackCompnent" :is-api-component="true" :show-options-button="true" :request="request"/>
<esb-definition-response v-xpack v-if="showXpackCompnent" :is-api-component="true" :show-options-button="true"
:request="request"/>
<!-- <api-response-component :currentProtocol="apiCase.request.protocol" :api-item="apiCase"/>-->
</div>
<api-other-info :api="basisData"/>
@ -73,18 +83,21 @@
import MsTcpBasicApi from "./TCPBasicApi";
import MsTcpFormatParameters from "../request/tcp/TcpFormatParameters";
import MsChangeHistory from "../../../../history/ChangeHistory";
import {hasLicense, getCurrentProjectID, getUUID, getCurrentUser} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUser, hasLicense} from "@/common/js/utils";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const esbDefinition = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {};
const esbDefinitionResponse = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {};
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
export default {
name: "MsAddCompleteTcpApi",
components: {
ApiOtherInfo, MsTcpBasicApi, MsTcpFormatParameters, MsChangeHistory,
"esbDefinition": esbDefinition.default,
"esbDefinitionResponse": esbDefinitionResponse.default
"esbDefinitionResponse": esbDefinitionResponse.default,
'MsVersionHistory': versionHistory.default,
},
props: {
request: {},
@ -109,7 +122,8 @@ export default {
}
],
showXpackCompnent: false,
}
versionData: [],
};
},
created: function () {
if (this.basisData.method != 'TCP' && this.basisData.method != 'ESB') {
@ -140,6 +154,9 @@ export default {
}
});
this.getMockInfo();
if (hasLicense()) {
this.getVersionHistory();
}
},
watch: {
syncTabs() {
@ -153,7 +170,7 @@ export default {
if (item === this.basisData.id) {
return true;
}
})
});
this.syncTabs.splice(index, 1);
Object.assign(this.request, request);
}
@ -256,7 +273,7 @@ export default {
this.showFollow = false;
for (let i = 0; i < this.basisData.follows.length; i++) {
if (this.basisData.follows[i] === getCurrentUser().id) {
this.basisData.follows.splice(i, 1)
this.basisData.follows.splice(i, 1);
break;
}
}
@ -270,16 +287,49 @@ export default {
if (!this.basisData.follows) {
this.basisData.follows = [];
}
this.basisData.follows.push(getCurrentUser().id)
this.basisData.follows.push(getCurrentUser().id);
if (this.basisData.id) {
this.$post("/api/definition/update/follows/" + this.basisData.id, this.basisData.follows, () => {
this.$success(this.$t('commons.follow_success'));
});
}
}
},
getVersionHistory() {
this.$get('/api/definition/versions/' + this.basisData.id, response => {
this.versionData = response.data;
});
},
compare(row) {
// console.log(row);
},
checkout(row) {
let api = this.versionData.filter(v => v.versionId === row.id)[0];
if (api.tags && api.tags.length > 0) {
api.tags = JSON.parse(api.tags);
}
this.$emit("checkout", api);
},
create(row) {
//
this.basisData.versionId = row.id;
this.saveApi();
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('/api/definition/delete/' + row.id + '/' + this.basisData.refId, () => {
this.$success(this.$t('commons.delete_success'));
this.getVersionHistory();
});
}
}
});
}
},
}
};
</script>
<style scoped>
@ -290,6 +340,7 @@ export default {
.ms-opt-btn {
position: fixed;
right: 50px;
z-index: 1;
z-index: 120;
top: 107px;
}
</style>

View File

@ -3,7 +3,7 @@
<el-form :model="basicForm" label-position="right" label-width="80px" size="small" :rules="rule" ref="basicForm" style="margin-right: 20px">
<!-- 基础信息 -->
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item :label="$t('commons.name')" prop="name">
<!-- <el-input class="ms-http-input" size="small" v-model="basicForm.name"/>-->
<el-input v-model="basicForm.name" class="ms-http-input" size="small">
@ -14,22 +14,22 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item :label="$t('test_track.module.module')" prop="moduleId">
<ms-select-tree size="small" :data="moduleOptions" :defaultKey="basicForm.moduleId" @getValue="setModule" :obj="moduleObj" clearable checkStrictly/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item :label="$t('commons.status')" prop="status">
<el-select class="ms-http-input" size="small" v-model="basicForm.status" style="width: 100%">
<el-option v-for="item in options" :key="item.id" :label="$t(item.label)" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('api_test.definition.request.responsible')" prop="userId">
<el-select v-model="basicForm.userId"
:placeholder="$t('api_test.definition.request.responsible')" filterable size="small"
@ -44,9 +44,6 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('commons.tag')" prop="tag">
<ms-input-tag :currentScenario="basicForm" ref="tag"/>
@ -167,8 +164,8 @@
methods: {
apiMapStatus() {
this.$store.state.apiStatus.set("fromChange", true);
if (this.httpForm.id) {
this.$store.state.apiMap.set(this.httpForm.id, this.$store.state.apiStatus);
if (this.basicForm.id) {
this.$store.state.apiMap.set(this.basicForm.id, this.$store.state.apiStatus);
}
},
getMaintainerOptions() {

View File

@ -1,6 +1,6 @@
<template>
<div>
<div>
<span>
<span>
<el-link type="primary" style="float:right;margin-top: 5px" @click="open">{{ $t('commons.adv_search.title') }}
</el-link>
@ -138,6 +138,18 @@
</template>
</ms-table-column>
<ms-table-column
:label="$t('project.version.name')"
:field="item"
:fields-width="fieldsWidth"
:filters="versionFilters"
min-width="100px"
prop="versionId">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column
prop="environment"
:field="item"
@ -192,7 +204,7 @@
:current-page.sync="currentPage"
:page-size.sync="pageSize"
:total="total"/>
</div>
</span>
<api-case-list @showExecResult="showExecResult" @refreshCase="setRunning" :currentApi="selectCase" ref="caseList"
@stop="stop" @reLoadCase="initTable"/>
@ -214,7 +226,7 @@
:visible.sync="resVisible" class="api-import" destroy-on-close @close="resVisible=false">
<ms-request-result-tail :response="response" ref="debugResult"/>
</el-dialog>
</div>
</span>
</template>
@ -234,7 +246,7 @@ import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {getBodyUploadFiles, getCurrentProjectID, getUUID, strMapToObj} from "@/common/js/utils";
import {getBodyUploadFiles, getCurrentProjectID, getUUID, hasLicense, strMapToObj} from "@/common/js/utils";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
import MsReferenceView from "../reference/ReferenceView";
@ -382,7 +394,7 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
screenHeight: 'calc(100vh - 250px)',//
screenHeight: 'calc(100vh - 220px)',//
environmentId: undefined,
selectAll: false,
unSelection: [],
@ -391,10 +403,12 @@ export default {
resVisible: false,
response: {},
timeoutIndex: 0,
versionFilters: [],
};
},
props: {
currentProtocol: String,
currentVersion: String,
apiDefinitionId: String,
selectNodeIds: Array,
activeDom: String,
@ -431,7 +445,8 @@ export default {
this.operators = this.simpleOperators;
this.buttons = this.simpleButtons;
}
// tab
this.condition.versionId = this.currentVersion;
this.initTable();
//
if (this.$route.query.caseId) {
@ -439,6 +454,8 @@ export default {
this.handleTestCase(response.data);
});
}
this.getVersionOptions();
this.checkVersionEnable();
},
watch: {
selectNodeIds() {
@ -453,6 +470,10 @@ export default {
this.selectDataCounts = 0;
this.initTable();
},
currentVersion() {
this.condition.versionId = this.currentVersion;
this.initTable();
},
trashEnable() {
if (this.trashEnable) {
this.operators = this.trashOperators;
@ -1141,6 +1162,27 @@ export default {
this.$emit('runRefresh', {});
});
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
if (!response.data) {
this.fields = this.fields.filter(f => f.id !== 'versionId');
}
});
}
}
},
};
</script>

View File

@ -1,6 +1,8 @@
<template>
<div>
<api-document-anchor :is-share-page="isSharePage" :trash-enable="trashEnable" :project-id="projectId" :module-ids="moduleIds"></api-document-anchor>
<api-document-anchor :is-share-page="isSharePage" :trash-enable="trashEnable"
:project-id="projectId" :module-ids="moduleIds"
ref="documentAnchor"/>
</div>
</template>
@ -15,13 +17,14 @@ export default {
},
data() {
return {
isSharePage:false,
}
isSharePage: false,
condition: {},
};
},
props: {
projectId:String,
moduleIds:Array,
activeDom:String,
projectId: String,
moduleIds: Array,
activeDom: String,
trashEnable: {
type: Boolean,
default: false,
@ -29,14 +32,15 @@ export default {
},
created: function () {
},
watch: {
},
computed: {
},
watch: {},
computed: {},
methods: {
initApiDocSimpleList() {
Object.assign(this.$refs.documentAnchor.apiSearch, this.condition);
this.$refs.documentAnchor.initApiDocSimpleList();
}
},
}
};
</script>
<style scoped>

View File

@ -1,11 +1,12 @@
<template>
<div>
<div>
<el-link type="primary" @click="open" style="float: right;margin-top: 5px">{{ $t('commons.adv_search.title') }}
</el-link>
<span>
<span>
<el-input :placeholder="$t('commons.search_by_id_name_tag_path')" @blur="search" class="search-input" size="small"
@keyup.enter.native="enterSearch"
v-model="condition.name" ref="inputVal"/>
<el-link type="primary" @click="open" style="float: right;margin-top: 5px;padding-right: 10px">
{{ $t('commons.adv_search.title') }}
</el-link>
<ms-table
:data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
@ -116,7 +117,7 @@
prop="tags"
:field="item"
:fields-width="fieldsWidth"
min-width="100px"
min-width="80px"
:label="$t('commons.tag')">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
@ -126,6 +127,18 @@
</template>
</ms-table-column>
<ms-table-column
:label="$t('project.version.name')"
:field="item"
:fields-width="fieldsWidth"
:filters="versionFilters"
min-width="100px"
prop="versionId">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column
:label="$t('api_test.definition.api_last_time')"
:field="item"
@ -182,17 +195,18 @@
</ms-table>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</div>
</span>
<ms-api-case-list @refresh="initTable" @showExecResult="showExecResult" :currentApi="selectApi" ref="caseList"/>
<!--批量编辑-->
<ms-batch-edit ref="batchEdit" @batchEdit="batchEdit" :data-count="$refs.table ? $refs.table.selectDataCounts : 0" :typeArr="typeArr" :value-arr="valueArr"/>
<ms-batch-edit ref="batchEdit" @batchEdit="batchEdit" :data-count="$refs.table ? $refs.table.selectDataCounts : 0"
:typeArr="typeArr" :value-arr="valueArr"/>
<!--高级搜索-->
<ms-table-adv-search-bar :condition.sync="condition" :showLink="false" ref="searchBar" @search="search"/>
<case-batch-move @refresh="initTable" @moveSave="moveSave" ref="testCaseBatchMove"/>
<relationship-graph-drawer :graph-data="graphData" ref="relationshipGraph"/>
</div>
</span>
</template>
@ -211,7 +225,7 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
import MsBottomContainer from "../BottomContainer";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {downloadFile, getCurrentProjectID, getUUID} from "@/common/js/utils";
import {downloadFile, getCurrentProjectID, getUUID, hasLicense} from "@/common/js/utils";
import {API_LIST} from '@/common/js/constants';
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
@ -220,8 +234,11 @@ import {API_DEFINITION_CONFIGS} from "@/business/components/common/components/se
import MsTipButton from "@/business/components/common/components/MsTipButton";
import CaseBatchMove from "@/business/components/api/definition/components/basis/BatchMove";
import {
initCondition,
getCustomTableHeader, getCustomTableWidth, buildBatchParam, getLastTableSortField
buildBatchParam,
getCustomTableHeader,
getCustomTableWidth,
getLastTableSortField,
initCondition
} from "@/common/js/tableUtils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import {Body} from "@/business/components/api/definition/model/ApiTestModel";
@ -384,6 +401,7 @@ export default {
{text: 'TCP', value: 'TCP'},
],
userFilters: [],
versionFilters: [],
valueArr: {
status: API_STATUS,
method: REQ_METHOD,
@ -394,7 +412,7 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
screenHeight: 'calc(100vh - 258px)',//,
screenHeight: 'calc(100vh - 220px)',//,
environmentId: undefined,
selectDataCounts: 0,
projectName: "",
@ -402,6 +420,7 @@ export default {
},
props: {
currentProtocol: String,
currentVersion: String,
selectNodeIds: Array,
isSelectThisWeek: String,
activeDom: String,
@ -462,9 +481,13 @@ export default {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
}
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
// tab
this.condition.versionId = this.currentVersion;
this.initTable();
this.getMaintainerOptions();
this.getVersionOptions();
this.checkVersionEnable();
//
if (this.$route.query.resourceId) {
@ -490,6 +513,10 @@ export default {
this.closeCaseModel();
this.initTable(true);
},
currentVersion() {
this.condition.versionId = this.currentVersion;
this.initTable();
},
trashEnable() {
if (this.trashEnable) {
this.tableOperatorButtons = this.tableTrashOperatorButtons;
@ -598,6 +625,15 @@ export default {
});
});
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
enterSearch() {
this.$refs.inputVal.blur();
this.search();
@ -616,7 +652,7 @@ export default {
handleCopy(row) {
let obj = JSON.parse(JSON.stringify(row));
obj.isCopy = true;
obj.id =getUUID();
obj.id = getUUID();
this.$emit('editApi', obj);
},
runApi(row) {
@ -737,7 +773,7 @@ export default {
});
},
handleTestCase(api) {
this.$emit("handleTestCase", api)
this.$emit("handleTestCase", api);
// this.$refs.caseList.open(this.selectApi);
},
handleDelete(api) {
@ -836,6 +872,18 @@ export default {
return false;
}
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
if (!response.data) {
this.fields = this.fields.filter(f => f.id !== 'versionId');
}
});
}
}
},
};
</script>
@ -858,7 +906,6 @@ export default {
.search-input {
float: right;
width: 300px;
margin-right: 10px;
}
.el-tag {
@ -879,6 +926,7 @@ export default {
max-width: 100%;
padding-right: 100%;
}
/* /deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
} */

View File

@ -4,15 +4,21 @@
<el-button-group v-if="isShowChangeButton">
<el-tooltip class="item" effect="dark" content="接口列表" placement="left">
<el-button plain style="width: 44px;height: 32px;padding: 5px 8px;" :class="{active: isApiListEnable}" @click="apiChange('api')">API</el-button>
<el-button plain style="width: 44px;height: 32px;padding: 5px 8px;" :class="{active: isApiListEnable}"
@click="apiChange('api')">API
</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="用例列表" placement="right">
<el-button plain class="case-button" style="width: 44px;height: 32px;padding: 1px;" :class="{active: !isApiListEnable}" @click="caseChange('case')">CASE</el-button>
<el-button plain class="case-button" style="width: 44px;height: 32px;padding: 1px;"
:class="{active: !isApiListEnable}" @click="caseChange('case')">CASE
</el-button>
</el-tooltip>
</el-button-group>
<slot name="version"></slot>
<template v-slot:header>
<slot name="header"></slot>
</template>
@ -21,41 +27,42 @@
</template>
<script>
export default {
name: "ApiListContainer",
data() {
return {
isShow: true
}
},
props: {
isApiListEnable: Boolean,
isShowChangeButton: {
type: Boolean,
default: true
}
},
methods: {
apiChange() {
this.$emit('isApiListEnableChange', true);
},
caseChange() {
this.$emit('isApiListEnableChange', false);
}
}
export default {
name: "ApiListContainer",
data() {
return {
isShow: true,
};
},
props: {
isApiListEnable: Boolean,
isShowChangeButton: {
type: Boolean,
default: true
}
},
methods: {
apiChange() {
this.$emit('isApiListEnableChange', true);
},
caseChange() {
this.$emit('isApiListEnableChange', false);
},
}
};
</script>
<style scoped>
.active {
border: solid 1px #6d317c;
background-color: #7C3985;
color: #FFFFFF;
}
.active {
border: solid 1px #6d317c;
background-color: #7C3985;
color: #FFFFFF;
}
.case-button {
border-left: solid 1px #6d317c;
}
.case-button {
border-left: solid 1px #6d317c;
}
</style>

View File

@ -19,6 +19,8 @@
</el-button-group>
<slot name="version"></slot>
<template v-slot:header>
<slot name="header"></slot>
</template>

View File

@ -19,6 +19,7 @@
content="转场景测试" @click="historicalDataUpgrade"/>
<slot name="button"></slot>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" v-if="isShowVersion"/>
</span>
<span>
<slot name="searchBarBefore"></slot>
@ -34,10 +35,19 @@
import MsTableSearchBar from './MsTableSearchBar';
import MsTableButton from './MsTableButton';
import MsTableAdvSearchBar from "./search/MsTableAdvSearchBar";
import {getCurrentProjectID} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "MsTableHeader",
components: {MsTableAdvSearchBar, MsTableSearchBar, MsTableButton},
components: {MsTableAdvSearchBar, MsTableSearchBar, MsTableButton,'VersionSelect': VersionSelect.default},
data() {
return {
version:this.currentVersion
};
},
props: {
title: {
type: String,
@ -88,7 +98,13 @@
type: String,
},
currentVersion:{
type: String,
},
isShowVersion:{
type: Boolean,
default: false
},
isTesterPermission: {
type: Boolean,
default: false
@ -104,6 +120,12 @@
default() {
return true;
}
},
versionOptions:{
type: Array,
default() {
return []
}
}
},
methods: {
@ -122,12 +144,18 @@
},
historicalDataUpgrade() {
this.$emit('historicalDataUpgrade');
},
changeVersion(type){
this.$emit('changeVersion',type);
}
},
computed: {
isCombine() {
return this.condition.components !== undefined && this.condition.components.length > 0;
}
},
projectId() {
return getCurrentProjectID();
},
}
}
</script>
@ -151,5 +179,7 @@
.search-bar {
width: 240px
}
.version-select {
padding-left: 10px;
}
</style>

View File

@ -14,6 +14,7 @@
<script>
import PerformanceHeaderMenus from "./head/PerformanceHeaderMenus";
import EditPerformanceTest from "@/business/components/performance/test/EditPerformanceTest";
export default {
name: "PerformanceTest",
@ -22,7 +23,7 @@ export default {
return {
baseUrl: "performance",
//
excludeCaches: ['PerformanceReportView'],
excludeCaches: ['PerformanceReportView','EditPerformanceTest'],
};
},
};

View File

@ -35,6 +35,17 @@
<span @click="handleView(scope.row)" style="cursor: pointer;">{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column
v-if="versionEnable"
:label="$t('project.version.name')"
:filters="versionFilters"
column-key="versionId"
min-width="100px"
prop="versionId">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</el-table-column>
<el-table-column
prop="userName"
:label="$t('report.user_name')"
@ -129,13 +140,13 @@ import MsTablePagination from "../../common/pagination/TablePagination";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsPerformanceReportStatus from "./PerformanceReportStatus";
import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import ReportTriggerModeItem from "../../common/tableItem/ReportTriggerModeItem";
import {REPORT_CONFIGS} from "../../common/components/search/search-components";
import MsTableHeader from "../../common/components/MsTableHeader";
import ShowMoreBtn from "../../track/case/components/ShowMoreBtn";
import {_filter, _sort,saveLastTableSortField,getLastTableSortField} from "@/common/js/tableUtils";
import {_filter, _sort, getLastTableSortField, saveLastTableSortField} from "@/common/js/tableUtils";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import SameTestReports from "@/business/components/performance/report/components/SameTestReports";
@ -156,10 +167,12 @@ export default {
created: function () {
this.testId = this.$route.path.split('/')[3];
this.initTableData();
this.getVersionOptions();
this.checkVersionEnable();
},
data() {
return {
tableHeaderKey:"PERFORMANCE_REPORT_TABLE",
tableHeaderKey: "PERFORMANCE_REPORT_TABLE",
result: {},
deletePath: "/performance/report/delete/",
condition: {
@ -196,6 +209,10 @@ export default {
}
],
selectRows: new Set(),
versionFilters: [],
versionOptions: [],
currentVersion: '',
versionEnable: false,
};
},
watch: {
@ -334,7 +351,7 @@ export default {
this.condition.orders = [];
}
_sort(column, this.condition);
this.saveSortField(this.tableHeaderKey,this.condition.orders);
this.saveSortField(this.tableHeaderKey, this.condition.orders);
this.initTableData();
},
filter(filters) {
@ -350,8 +367,8 @@ export default {
this.selectRows.add(row);
}
},
saveSortField(key,orders){
saveLastTableSortField(key,JSON.stringify(orders));
saveSortField(key, orders) {
saveLastTableSortField(key, JSON.stringify(orders));
},
handleSelectAll(selection) {
if (selection.length > 0) {
@ -383,7 +400,27 @@ export default {
}
},
});
}
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionOptions = response.data;
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
checkVersionEnable() {
if (!getCurrentProjectID()) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + getCurrentProjectID(), response => {
this.versionEnable = response.data;
});
}
},
}
};
</script>

View File

@ -21,9 +21,15 @@
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 15px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow" />
</el-tooltip>
<el-link type="primary" size="small" style="margin-right: 20px" @click="openHis" v-if="test.id">
{{ $t('operating_log.change_history') }}
</el-link>
<ms-version-history v-xpack
ref="versionHistory"
:version-data="versionData"
:current-id="testId"
@compare="compare" @checkout="checkout" @create="create" @del="del"/>
<el-button :disabled="isReadOnly" type="primary" size="small" plain @click="save"
v-permission="['PROJECT_PERFORMANCE_TEST:READ+EDIT']"
>{{ $t('commons.save') }}
@ -80,12 +86,15 @@ import PerformancePressureConfig from "./components/PerformancePressureConfig";
import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID, getCurrentUser, getCurrentWorkspaceId, hasPermission} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUser, getCurrentWorkspaceId, hasLicense, hasPermission} from "@/common/js/utils";
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
import MsChangeHistory from "../../history/ChangeHistory";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import MsTipButton from "@/business/components/common/components/MsTipButton";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
export default {
name: "EditPerformanceTest",
components: {
@ -97,7 +106,8 @@ export default {
PerformanceAdvancedConfig,
MsContainer,
MsMainContainer,
MsChangeHistory
MsChangeHistory,
'MsVersionHistory': versionHistory.default,
},
inject: [
'reload'
@ -128,6 +138,7 @@ export default {
component: 'PerformanceAdvancedConfig'
}],
maintainerOptions: [],
versionData: [],
};
},
watch: {
@ -150,6 +161,9 @@ export default {
created() {
this.isReadOnly = !hasPermission('PROJECT_PERFORMANCE_TEST:READ+EDIT');
this.getTest(this.$route.params.testId);
if (hasLicense()) {
this.getVersionHistory();
}
},
mounted() {
this.importAPITest();
@ -251,24 +265,31 @@ export default {
if (!this.test.schedule) {
this.test.schedule = {};
}
this.$get('/performance/test/follow/' + testId, response => {
this.$set(this.test, 'follows', response.data);
for (let i = 0; i < this.test.follows.length; i++) {
if(this.test.follows[i]===this.currentUser().id){
this.showFollow = true;
break;
}
}
});
this.getDefaultFollow(testId);
}
});
}
},
getDefaultFollow(testId){
this.$get('/performance/test/follow/' + testId, response => {
this.$set(this.test, 'follows', response.data);
for (let i = 0; i < this.test.follows.length; i++) {
if(this.test.follows[i]===this.currentUser().id){
this.showFollow = true;
break;
}
}
});
},
save() {
if (!this.validTest()) {
return;
}
if (!this.test.versionId) {
if (this.$refs.versionHistory) {
this.test.versionId = this.$refs.versionHistory.currentVersion.id;
}
}
let options = this.getSaveOption();
this.result = this.$request(options, () => {
@ -320,7 +341,6 @@ export default {
formData.append('request', new Blob([requestJson], {
type: "application/json"
}));
return {
method: 'POST',
url: url,
@ -493,6 +513,47 @@ export default {
});
}
}
},
getVersionHistory() {
let testId = undefined
if(this.testId){
testId = this.testId;
}
this.$get('/performance/versions/' + testId, response => {
this.versionData = response.data;
});
},
compare(row) {
// console.log(row);
},
checkout(row) {
//let test = this.versionData.filter(v => v.versionId === row.id)[0];
this.test.versionId = row.id;
this.result = this.$get('/performance/get/' + this.test.versionId+"/"+this.test.refId, response => {
this.testId = response.data.id;
this.$router.push({
path: '/performance/test/edit/' + this.testId,
});
this.getVersionHistory();
});
},
create(row) {
//
this.test.versionId = row.id;
this.save();
},
del(row) {
this.$alert(this.$t('load_test.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('performance/delete/' + row.id + '/' + this.test.refId, () => {
this.$success(this.$t('commons.delete_success'));
this.getVersionHistory();
});
}
}
});
}
}
};

View File

@ -1,13 +1,16 @@
<template>
<ms-container>
<ms-main-container>
<ms-main-container v-if="loading">
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search"
:create-permission="['PROJECT_PERFORMANCE_TEST:READ+CREATE']"
:version-options="versionOptions"
:current-version.sync="currentVersion"
:is-show-version=true
@changeVersion="changeVersion"
@create="create" :createTip="$t('load_test.create')"/>
</template>
<ms-table
:data="tableData"
:condition="condition"
@ -27,13 +30,23 @@
@refresh="search"
:disable-header-config="true"
ref="table">
<el-table-column
prop="num"
label="ID"
width="100"
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="versionEnable"
:label="$t('project.version.name')"
:filters="versionFilters"
column-key="versionId"
min-width="100px"
prop="versionId">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</el-table-column>
<el-table-column
prop="name"
:label="$t('commons.name')"
@ -103,7 +116,7 @@ import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsPerformanceTestStatus from "./PerformanceTestStatus";
import MsTableOperators from "../../common/components/MsTableOperators";
import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils";
import MsTableHeader from "../../common/components/MsTableHeader";
import {TEST_CONFIGS} from "../../common/components/search/search-components";
import {getLastTableSortField} from "@/common/js/tableUtils";
@ -123,7 +136,7 @@ export default {
},
data() {
return {
tableHeaderKey:"PERFORMANCE_TEST_TABLE",
tableHeaderKey: "PERFORMANCE_TEST_TABLE",
result: {},
deletePath: "/performance/delete",
condition: {
@ -132,10 +145,11 @@ export default {
projectId: null,
tableData: [],
multipleSelection: [],
versionFilters: [],
currentPage: 1,
pageSize: 10,
total: 0,
loading: false,
loading: true,
testId: null,
enableOrderDrag: true,
operators: [
@ -163,6 +177,9 @@ export default {
],
userFilters: [],
screenHeight: 'calc(100vh - 200px)',
versionOptions: [],
currentVersion: '',
versionEnable: false,
};
},
watch: {
@ -179,10 +196,12 @@ export default {
return editLoadTestCaseOrder;
}
},
created: function () {
created() {
this.projectId = getCurrentProjectID();
this.initTableData();
this.getMaintainerOptions();
this.getVersionOptions();
this.checkVersionEnable();
},
methods: {
getMaintainerOptions() {
@ -268,7 +287,40 @@ export default {
return;
}
this.$router.push('/performance/test/create');
}
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionOptions = response.data;
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
changeVersion(value) {
this.currentVersion = value || null;
this.condition.versionId = value || null;
this.refresh();
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
this.loading = false;
this.$nextTick(() => {
this.loading = true;
});
});
}
},
refresh(data) {
this.initTableData();
//this.$refs.nodeTree.list();
},
}
};
</script>

Some files were not shown because too many files have changed in this diff Show More