fix(接口定义): 模块移动处理

This commit is contained in:
fit2-zhao 2020-12-17 14:11:20 +08:00
parent 086b780dbe
commit 9d9f949414
2 changed files with 11 additions and 6 deletions

View File

@ -166,7 +166,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
ApiModuleDTO nodeTree = request.getNodeTree();
List<ApiModule> updateNodes = new ArrayList<>();
if (nodeTree == null) {
return;
}
buildUpdateDefinition(nodeTree, apiModule, updateNodes, "/", "0", nodeTree.getLevel());
updateNodes = updateNodes.stream()
@ -180,7 +182,6 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
private void buildUpdateDefinition(ApiModuleDTO rootNode, List<ApiDefinitionResult> apiDefinitions,
List<ApiModule> updateNodes, String rootPath, String pId, int level) {
rootPath = rootPath + rootNode.getName();
if (level > 8) {

View File

@ -13,7 +13,6 @@ import io.metersphere.base.mapper.ApiScenarioModuleMapper;
import io.metersphere.base.mapper.ext.ExtApiScenarioModuleMapper;
import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.i18n.Translator;
import io.metersphere.service.NodeTreeService;
import org.apache.commons.lang3.StringUtils;
@ -24,7 +23,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@Service
@ -140,7 +142,9 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
ApiScenarioModuleDTO nodeTree = request.getNodeTree();
List<ApiScenarioModule> updateNodes = new ArrayList<>();
if (nodeTree == null) {
return;
}
buildUpdateDefinition(nodeTree, apiScenarios, updateNodes, "/", "0", nodeTree.getLevel());
updateNodes = updateNodes.stream()