fix(测试跟踪): 项目下模块默认节点创建重复的问题

--bug=1013696 --user=宋昌昌 【测试跟踪】github#14110  升级导致模块未规划用例重复问题 https://www.tapd.cn/55049933/s/1179384
This commit is contained in:
songcc 2022-06-13 10:21:17 +08:00 committed by jianxing
parent 866d693d1a
commit c0382bfebc
3 changed files with 10 additions and 8 deletions

View File

@ -19,9 +19,13 @@ public enum ProjectModuleDefaultNodeEnum {
*/
API_SCENARIO_DEFAULT_NODE("未规划场景", "api_scenario_module"),
/**
* 接口场景默认节点
* UI自动化默认节点
*/
UI_SCENARIO_DEFAULT_NODE("未规划场景", "ui_scenario_module");
UI_SCENARIO_DEFAULT_NODE("未规划场景", "ui_scenario_module"),
/**
* UI元素库默认节点
*/
UI_ELEMENT_DEFAULT_NODE("未规划元素", "ui_element_module");
private String nodeName;
private String tableName;

View File

@ -133,15 +133,10 @@ public class BaseModuleService extends NodeTreeService<ModuleNodeDTO> {
}
public List<ModuleNodeDTO> getNodeTreeByProjectIdWithCount(String projectId, Function<QueryNodeRequest, List<Map<String, Object>>> getModuleCountFunc, String defaultName) {
// 判断当前项目下是否有默认模块没有添加默认模块
this.getDefaultNode(projectId, defaultName);
List<ModuleNodeDTO> moduleNodes = extModuleNodeMapper.getNodeTreeByProjectId(tableName, projectId);
if (getModuleCountFunc != null) {
buildNodeCount(projectId, moduleNodes, getModuleCountFunc);
}
return getNodeTrees(moduleNodes);
}

View File

@ -232,7 +232,7 @@ public class ProjectService {
record.setCreateTime(System.currentTimeMillis());
record.setUpdateTime(System.currentTimeMillis());
record.setProjectId(projectId);
//每个新项目的默认测试用例节点, 接口场景节点, UI自动化场景, 接口节点{HTTP, DUBBO, SQL, TCP}
//每个新项目的默认测试用例节点, 接口场景节点, UI自动化场景, UI元素库, 接口节点{HTTP, DUBBO, SQL, TCP}
record.setName(ProjectModuleDefaultNodeEnum.TEST_CASE_DEFAULT_NODE.getNodeName());
extModuleNodeMapper.insert(ProjectModuleDefaultNodeEnum.TEST_CASE_DEFAULT_NODE.getTableName(), record);
record.setId(UUID.randomUUID().toString());
@ -241,6 +241,9 @@ public class ProjectService {
record.setId(UUID.randomUUID().toString());
record.setName(ProjectModuleDefaultNodeEnum.UI_SCENARIO_DEFAULT_NODE.getNodeName());
extModuleNodeMapper.insert(ProjectModuleDefaultNodeEnum.UI_SCENARIO_DEFAULT_NODE.getTableName(), record);
record.setId(UUID.randomUUID().toString());
record.setName(ProjectModuleDefaultNodeEnum.UI_ELEMENT_DEFAULT_NODE.getNodeName());
extModuleNodeMapper.insert(ProjectModuleDefaultNodeEnum.UI_ELEMENT_DEFAULT_NODE.getTableName(), record);
ApiModule apiRecord = new ApiModule();
BeanUtils.copyBean(apiRecord, record);