fix(接口测试): 修复重复创建未规划接口的缺陷

This commit is contained in:
wxg0103 2022-12-26 16:39:43 +08:00 committed by 刘瑞斌
parent 26fa5d48e5
commit bcb0f887c9
6 changed files with 41 additions and 55 deletions

View File

@ -1,21 +1,21 @@
package io.metersphere.listener; package io.metersphere.listener;
import io.metersphere.base.domain.ApiModule; import io.metersphere.base.domain.*;
import io.metersphere.base.domain.ModuleNode;
import io.metersphere.base.domain.Project;
import io.metersphere.base.mapper.ApiModuleMapper; import io.metersphere.base.mapper.ApiModuleMapper;
import io.metersphere.base.mapper.ApiScenarioModuleMapper;
import io.metersphere.base.mapper.ProjectMapper; import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.base.mapper.ext.BaseModuleNodeMapper; import io.metersphere.base.mapper.ext.BaseModuleNodeMapper;
import io.metersphere.commons.constants.KafkaTopicConstants; import io.metersphere.commons.constants.KafkaTopicConstants;
import io.metersphere.commons.constants.ProjectModuleDefaultNodeEnum; import io.metersphere.commons.constants.ProjectModuleDefaultNodeEnum;
import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.UUID; import java.util.UUID;
@Component @Component
@ -28,6 +28,8 @@ public class ProjectCreatedListener {
@Resource @Resource
private ApiModuleMapper apiModuleMapper; private ApiModuleMapper apiModuleMapper;
@Resource @Resource
private ApiScenarioModuleMapper apiScenarioModuleMapper;
@Resource
private ProjectMapper projectMapper; private ProjectMapper projectMapper;
@ -52,7 +54,12 @@ public class ProjectCreatedListener {
record.setUpdateTime(System.currentTimeMillis()); record.setUpdateTime(System.currentTimeMillis());
record.setProjectId(projectId); record.setProjectId(projectId);
record.setName(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getNodeName()); record.setName(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getNodeName());
baseModuleNodeMapper.insert(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getTableName(), record); ApiScenarioModuleExample scenarioModuleExample = new ApiScenarioModuleExample();
scenarioModuleExample.createCriteria().andProjectIdEqualTo(projectId).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getNodeName()).andParentIdIsNull();
List<ApiScenarioModule> scenarioModules = apiScenarioModuleMapper.selectByExample(scenarioModuleExample);
if (CollectionUtils.isEmpty(scenarioModules)) {
baseModuleNodeMapper.insert(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getTableName(), record);
}
ApiModule apiRecord = new ApiModule(); ApiModule apiRecord = new ApiModule();
BeanUtils.copyBean(apiRecord, record); BeanUtils.copyBean(apiRecord, record);
apiRecord.setName(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName()); apiRecord.setName(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName());
@ -60,7 +67,12 @@ public class ProjectCreatedListener {
for (String protocol : protocols) { for (String protocol : protocols) {
apiRecord.setProtocol(protocol); apiRecord.setProtocol(protocol);
apiRecord.setId(UUID.randomUUID().toString()); apiRecord.setId(UUID.randomUUID().toString());
apiModuleMapper.insert(apiRecord); ApiModuleExample apiExample = new ApiModuleExample();
apiExample.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName()).andParentIdIsNull();
List<ApiModule> apiList = apiModuleMapper.selectByExample(apiExample);
if (CollectionUtils.isEmpty(apiList)) {
apiModuleMapper.insert(apiRecord);
}
} }
} }
} }

View File

@ -9,6 +9,7 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiModuleMapper; import io.metersphere.base.mapper.ApiModuleMapper;
import io.metersphere.base.mapper.ApiTestCaseMapper; import io.metersphere.base.mapper.ApiTestCaseMapper;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.ProjectModuleDefaultNodeEnum;
import io.metersphere.commons.constants.PropertyConstant; import io.metersphere.commons.constants.PropertyConstant;
import io.metersphere.commons.enums.ApiTestDataStatus; import io.metersphere.commons.enums.ApiTestDataStatus;
import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.BeanUtils;
@ -355,7 +356,7 @@ public class ApiDefinitionImportUtil {
public static void setModule(ApiDefinitionWithBLOBs item, ApiModuleMapper apiModuleMapper) { public static void setModule(ApiDefinitionWithBLOBs item, ApiModuleMapper apiModuleMapper) {
if (item != null && StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) { if (item != null && StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) {
ApiModuleExample example = new ApiModuleExample(); ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo("未规划接口"); example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName());
List<ApiModule> modules = apiModuleMapper.selectByExample(example); List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) { if (CollectionUtils.isNotEmpty(modules)) {
item.setModuleId(modules.get(0).getId()); item.setModuleId(modules.get(0).getId());

View File

@ -1003,7 +1003,7 @@ public class ApiDefinitionService {
private void setModule(ApiDefinitionWithBLOBs item) { private void setModule(ApiDefinitionWithBLOBs item) {
if (item != null && StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) { if (item != null && StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) {
ApiModuleExample example = new ApiModuleExample(); ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo("未规划接口"); example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName());
List<ApiModule> modules = apiModuleMapper.selectByExample(example); List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) { if (CollectionUtils.isNotEmpty(modules)) {
item.setModuleId(modules.get(0).getId()); item.setModuleId(modules.get(0).getId());
@ -1840,7 +1840,7 @@ public class ApiDefinitionService {
public void initModulePathAndId(String projectId, ApiDefinitionWithBLOBs test) { public void initModulePathAndId(String projectId, ApiDefinitionWithBLOBs test) {
ApiModuleExample example = new ApiModuleExample(); ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(test.getProtocol()).andNameEqualTo("未规划接口").andLevelEqualTo(1); example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(test.getProtocol()).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName()).andLevelEqualTo(1);
List<ApiModule> modules = apiModuleMapper.selectByExample(example); List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) { if (CollectionUtils.isNotEmpty(modules)) {
test.setModuleId(modules.get(0).getId()); test.setModuleId(modules.get(0).getId());

View File

@ -1,24 +1,15 @@
package io.metersphere.service.definition; package io.metersphere.service.definition;
import io.metersphere.api.dto.ApiTestImportRequest; import io.metersphere.api.dto.ApiTestImportRequest;
import io.metersphere.api.dto.definition.ApiDefinitionRequest; import io.metersphere.api.dto.definition.*;
import io.metersphere.api.dto.definition.ApiDefinitionResult;
import io.metersphere.api.dto.definition.ApiModuleDTO;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.DragModuleRequest;
import io.metersphere.api.dto.definition.UpdateApiModuleDTO;
import io.metersphere.api.parse.api.ApiDefinitionImport; import io.metersphere.api.parse.api.ApiDefinitionImport;
import io.metersphere.base.domain.ApiDefinition; import io.metersphere.base.domain.*;
import io.metersphere.base.domain.ApiDefinitionExample;
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import io.metersphere.base.domain.ApiModule;
import io.metersphere.base.domain.ApiModuleExample;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.base.mapper.ApiDefinitionMapper; import io.metersphere.base.mapper.ApiDefinitionMapper;
import io.metersphere.base.mapper.ApiModuleMapper; import io.metersphere.base.mapper.ApiModuleMapper;
import io.metersphere.base.mapper.ext.ExtApiDefinitionMapper; import io.metersphere.base.mapper.ext.ExtApiDefinitionMapper;
import io.metersphere.base.mapper.ext.ExtApiModuleMapper; import io.metersphere.base.mapper.ext.ExtApiModuleMapper;
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper; import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
import io.metersphere.commons.constants.ProjectModuleDefaultNodeEnum;
import io.metersphere.commons.constants.PropertyConstant; import io.metersphere.commons.constants.PropertyConstant;
import io.metersphere.commons.constants.TestCaseConstants; import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.enums.ApiTestDataStatus; import io.metersphere.commons.enums.ApiTestDataStatus;
@ -44,15 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -204,7 +187,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
return getNodeTrees(apiModules); return getNodeTrees(apiModules);
} }
public List<ApiModuleDTO> getNodeTreeByCondition(String projectId, String protocol, String versionId, ApiDefinitionRequest request ) { public List<ApiModuleDTO> getNodeTreeByCondition(String projectId, String protocol, String versionId, ApiDefinitionRequest request) {
// 判断当前项目下是否有默认模块没有添加默认模块 // 判断当前项目下是否有默认模块没有添加默认模块
this.getDefaultNode(projectId, protocol); this.getDefaultNode(projectId, protocol);
List<ApiModuleDTO> apiModules = getApiModulesByProjectAndPro(projectId, protocol); List<ApiModuleDTO> apiModules = getApiModulesByProjectAndPro(projectId, protocol);
@ -588,12 +571,12 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
public ApiModule getDefaultNode(String projectId, String protocol) { public ApiModule getDefaultNode(String projectId, String protocol) {
ApiModuleExample example = new ApiModuleExample(); ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andNameEqualTo("未规划接口").andParentIdIsNull(); example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName()).andParentIdIsNull();
List<ApiModule> list = apiModuleMapper.selectByExample(example); List<ApiModule> list = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
ApiModule record = new ApiModule(); ApiModule record = new ApiModule();
record.setId(UUID.randomUUID().toString()); record.setId(UUID.randomUUID().toString());
record.setName("未规划接口"); record.setName(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName());
record.setProtocol(protocol); record.setProtocol(protocol);
record.setPos(1.0); record.setPos(1.0);
record.setLevel(1); record.setLevel(1);
@ -608,17 +591,6 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
} }
} }
public ApiModule getDefaultNodeUnCreateNew(String projectId, String protocol) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andNameEqualTo("未规划接口").andParentIdIsNull();
List<ApiModule> list = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
return null;
} else {
return list.get(0);
}
}
public long countTrashApiData(String projectId, String protocol) { public long countTrashApiData(String projectId, String protocol) {
ApiDefinitionExample example = new ApiDefinitionExample(); ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andStatusEqualTo("Trash"); example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andStatusEqualTo("Trash");
@ -666,7 +638,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
if (protocol.equals("HTTP")) { if (protocol.equals("HTTP")) {
return dealHttp(data, pidChildrenMap, idPathMap, idModuleMap, request, fullCoverage, urlRepeat, importCases); return dealHttp(data, pidChildrenMap, idPathMap, idModuleMap, request, fullCoverage, urlRepeat, importCases);
} else { } else {
return delOtherProtocol(data, pidChildrenMap, idPathMap, idModuleMap, request, fullCoverage, importCases); return delOtherProtocol(data, pidChildrenMap, idPathMap, idModuleMap, request, fullCoverage, importCases);
} }
} }
@ -693,7 +665,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
//处理模块 //处理模块
setModule(moduleMap, pidChildrenMap, idPathMap, idModuleMap, optionData, chooseModule); setModule(moduleMap, pidChildrenMap, idPathMap, idModuleMap, optionData, chooseModule);
return getUpdateApiModuleDTO(chooseModule,idPathMap,optionData,fullCoverage, moduleMap,optionDataCases); return getUpdateApiModuleDTO(chooseModule, idPathMap, optionData, fullCoverage, moduleMap, optionDataCases);
} }
private UpdateApiModuleDTO dealHttp(List<ApiDefinitionWithBLOBs> data, private UpdateApiModuleDTO dealHttp(List<ApiDefinitionWithBLOBs> data,
@ -722,8 +694,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
setModule(moduleMap, pidChildrenMap, idPathMap, idModuleMap, optionData, chooseModule); setModule(moduleMap, pidChildrenMap, idPathMap, idModuleMap, optionData, chooseModule);
return getUpdateApiModuleDTO(chooseModule, idPathMap, optionData, fullCoverage, moduleMap, optionDataCases);
return getUpdateApiModuleDTO(chooseModule,idPathMap,optionData,fullCoverage, moduleMap,optionDataCases);
} }
@ -752,7 +723,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
} }
} }
private UpdateApiModuleDTO getUpdateApiModuleDTO(ApiModuleDTO chooseModule,Map<String, String> idPathMap,List<ApiDefinitionWithBLOBs> optionData,Boolean fullCoverage,Map<String, ApiModule> moduleMap, List<ApiTestCaseWithBLOBs> optionDataCases) { private UpdateApiModuleDTO getUpdateApiModuleDTO(ApiModuleDTO chooseModule, Map<String, String> idPathMap, List<ApiDefinitionWithBLOBs> optionData, Boolean fullCoverage, Map<String, ApiModule> moduleMap, List<ApiTestCaseWithBLOBs> optionDataCases) {
UpdateApiModuleDTO updateApiModuleDTO = new UpdateApiModuleDTO(); UpdateApiModuleDTO updateApiModuleDTO = new UpdateApiModuleDTO();
updateApiModuleDTO.setChooseModule(chooseModule); updateApiModuleDTO.setChooseModule(chooseModule);
updateApiModuleDTO.setIdPathMap(idPathMap); updateApiModuleDTO.setIdPathMap(idPathMap);
@ -822,7 +793,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
//导入时即没选中模块接口自身也没模块的直接返会当前项目当前协议下的默认模块 //导入时即没选中模块接口自身也没模块的直接返会当前项目当前协议下的默认模块
List<ApiModule> moduleList = pidChildrenMap.get(PropertyConstant.ROOT); List<ApiModule> moduleList = pidChildrenMap.get(PropertyConstant.ROOT);
for (ApiModule module : moduleList) { for (ApiModule module : moduleList) {
if (module.getName().equals("未规划接口")) { if (module.getName().equals(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName())) {
datum.setModuleId(module.getId()); datum.setModuleId(module.getId());
datum.setModulePath("/" + module.getName()); datum.setModulePath("/" + module.getName());
} }
@ -846,6 +817,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
datum.setModulePath(idPathMap.get(chooseModule.getId())); datum.setModulePath(idPathMap.get(chooseModule.getId()));
} }
} }
public String[] getPathTree(String modulePath) { public String[] getPathTree(String modulePath) {
String substring = modulePath.substring(0, 1); String substring = modulePath.substring(0, 1);
if (substring.equals("/")) { if (substring.equals("/")) {

View File

@ -11,6 +11,7 @@ import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.ApiScenarioModuleMapper; import io.metersphere.base.mapper.ApiScenarioModuleMapper;
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper; import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
import io.metersphere.base.mapper.ext.ExtApiScenarioModuleMapper; import io.metersphere.base.mapper.ext.ExtApiScenarioModuleMapper;
import io.metersphere.commons.constants.ProjectModuleDefaultNodeEnum;
import io.metersphere.commons.constants.PropertyConstant; import io.metersphere.commons.constants.PropertyConstant;
import io.metersphere.commons.constants.TestCaseConstants; import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.enums.ApiTestDataStatus; import io.metersphere.commons.enums.ApiTestDataStatus;
@ -157,7 +158,7 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
//回收站数据初始化被删除了的数据挂在默认模块上 //回收站数据初始化被删除了的数据挂在默认模块上
initTrashDataModule(projectId); initTrashDataModule(projectId);
//通过回收站里的接口模块进行反显 //通过回收站里的接口模块进行反显
if(request.getFilters() != null && request.getFilters().get("status") != null){ if (request.getFilters() != null && request.getFilters().get("status") != null) {
List<String> statusList = new ArrayList<>(); List<String> statusList = new ArrayList<>();
statusList.add(ApiTestDataStatus.TRASH.getValue()); statusList.add(ApiTestDataStatus.TRASH.getValue());
request.getFilters().put("status", statusList); request.getFilters().put("status", statusList);
@ -507,12 +508,12 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
public ApiScenarioModule getDefaultNode(String projectId) { public ApiScenarioModule getDefaultNode(String projectId) {
ApiScenarioModuleExample example = new ApiScenarioModuleExample(); ApiScenarioModuleExample example = new ApiScenarioModuleExample();
example.createCriteria().andProjectIdEqualTo(projectId).andNameEqualTo("未规划场景").andParentIdIsNull(); example.createCriteria().andProjectIdEqualTo(projectId).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getNodeName()).andParentIdIsNull();
List<ApiScenarioModule> list = apiScenarioModuleMapper.selectByExample(example); List<ApiScenarioModule> list = apiScenarioModuleMapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
ApiScenarioModule record = new ApiScenarioModule(); ApiScenarioModule record = new ApiScenarioModule();
record.setId(UUID.randomUUID().toString()); record.setId(UUID.randomUUID().toString());
record.setName("未规划场景"); record.setName(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getNodeName());
record.setPos(1.0); record.setPos(1.0);
record.setLevel(1); record.setLevel(1);
record.setCreateTime(System.currentTimeMillis()); record.setCreateTime(System.currentTimeMillis());
@ -825,7 +826,7 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
//导入时即没选中模块接口自身也没模块的直接返会当前项目当前协议下的默认模块 //导入时即没选中模块接口自身也没模块的直接返会当前项目当前协议下的默认模块
List<ApiScenarioModule> moduleList = pidChildrenMap.get(PropertyConstant.ROOT); List<ApiScenarioModule> moduleList = pidChildrenMap.get(PropertyConstant.ROOT);
for (ApiScenarioModule module : moduleList) { for (ApiScenarioModule module : moduleList) {
if (module.getName().equals("未规划场景")) { if (module.getName().equals(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getNodeName())) {
datum.setApiScenarioModuleId(module.getId()); datum.setApiScenarioModuleId(module.getId());
datum.setModulePath("/" + module.getName()); datum.setModulePath("/" + module.getName());
} }

View File

@ -1478,7 +1478,7 @@ public class ApiScenarioService {
private void replenishScenarioModuleIdPath(String request, ApiScenarioModuleMapper apiScenarioModuleMapper, ApiScenarioWithBLOBs item) { private void replenishScenarioModuleIdPath(String request, ApiScenarioModuleMapper apiScenarioModuleMapper, ApiScenarioWithBLOBs item) {
ApiScenarioModuleExample example = new ApiScenarioModuleExample(); ApiScenarioModuleExample example = new ApiScenarioModuleExample();
example.createCriteria().andProjectIdEqualTo(request).andNameEqualTo("未规划场景"); example.createCriteria().andProjectIdEqualTo(request).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_SCENARIO_DEFAULT_NODE.getNodeName());
List<ApiScenarioModule> modules = apiScenarioModuleMapper.selectByExample(example); List<ApiScenarioModule> modules = apiScenarioModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) { if (CollectionUtils.isNotEmpty(modules)) {
item.setApiScenarioModuleId(modules.get(0).getId()); item.setApiScenarioModuleId(modules.get(0).getId());