fix(测试跟踪): 脑图模块移动报错
--bug=1010184 --user=陈建星 【测试跟踪】github#10391脑图模块移动报错 https://www.tapd.cn/55049933/s/11101722
This commit is contained in:
parent
3d236e6e34
commit
99a69b1c4d
|
@ -8,7 +8,6 @@ import io.metersphere.track.dto.TestCaseDTO;
|
||||||
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
||||||
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
|
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
|
||||||
import io.metersphere.track.response.TrackCountResult;
|
import io.metersphere.track.response.TrackCountResult;
|
||||||
import org.apache.ibatis.annotations.MapKey;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -146,4 +145,6 @@ public interface ExtTestCaseMapper {
|
||||||
int addLatestVersion(@Param("refId") String refId);
|
int addLatestVersion(@Param("refId") String refId);
|
||||||
|
|
||||||
List<TestCase> getMaintainerMap(@Param("request") QueryTestCaseRequest request);
|
List<TestCase> getMaintainerMap(@Param("request") QueryTestCaseRequest request);
|
||||||
|
|
||||||
|
List<TestCaseDTO> getForNodeEdit(@Param("ids") List<String> ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -991,6 +991,13 @@
|
||||||
and T2.case_id is null
|
and T2.case_id is null
|
||||||
order by test_case.`order` desc, test_case.sort desc
|
order by test_case.`order` desc, test_case.sort desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getForNodeEdit" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||||
|
select test_case.id, test_case.node_id, test_case.node_path
|
||||||
|
from test_case where node_id in
|
||||||
|
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="addLatestVersion">
|
<update id="addLatestVersion">
|
||||||
UPDATE test_case
|
UPDATE test_case
|
||||||
|
|
|
@ -16,4 +16,6 @@ public interface ExtTestCaseNodeMapper {
|
||||||
void updatePos(String id, Double pos);
|
void updatePos(String id, Double pos);
|
||||||
|
|
||||||
List<String> getNodes(@Param("parentId") String parentId);
|
List<String> getNodes(@Param("parentId") String parentId);
|
||||||
|
|
||||||
|
List<TestCaseNodeDTO> getNodeTreeByIds(@Param("nodeIds") List<String> nodeIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,15 @@
|
||||||
from test_case_node
|
from test_case_node
|
||||||
where parent_id = #{parentId}
|
where parent_id = #{parentId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getNodeTreeByIds" resultType="io.metersphere.track.dto.TestCaseNodeDTO">
|
||||||
|
select
|
||||||
|
<include refid="io.metersphere.base.mapper.TestCaseNodeMapper.Base_Column_List"/>
|
||||||
|
from test_case_node
|
||||||
|
where test_case_node.id in
|
||||||
|
<foreach collection="nodeIds" open="(" close=")" separator="," item="id">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
<update id="updatePos">
|
<update id="updatePos">
|
||||||
update test_case_node
|
update test_case_node
|
||||||
set pos = #{pos}
|
set pos = #{pos}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
package io.metersphere.track.dto;
|
package io.metersphere.track.dto;
|
||||||
|
|
||||||
import io.metersphere.api.dto.definition.ApiModuleDTO;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -211,7 +211,7 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
||||||
request.setUpdateTime(System.currentTimeMillis());
|
request.setUpdateTime(System.currentTimeMillis());
|
||||||
checkTestCaseNodeExist(request);
|
checkTestCaseNodeExist(request);
|
||||||
if (!CollectionUtils.isEmpty(request.getNodeIds())) {
|
if (!CollectionUtils.isEmpty(request.getNodeIds())) {
|
||||||
List<TestCaseDTO> testCases = QueryTestCaseByNodeIds(request.getNodeIds());
|
List<TestCaseDTO> testCases = extTestCaseMapper.getForNodeEdit(request.getNodeIds());
|
||||||
testCases.forEach(testCase -> {
|
testCases.forEach(testCase -> {
|
||||||
StringBuilder path = new StringBuilder(testCase.getNodePath());
|
StringBuilder path = new StringBuilder(testCase.getNodePath());
|
||||||
List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
||||||
|
@ -224,12 +224,23 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
||||||
});
|
});
|
||||||
batchUpdateTestCase(testCases);
|
batchUpdateTestCase(testCases);
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(request.getParentId())) {
|
|
||||||
request.setParentId(null);
|
|
||||||
}
|
|
||||||
return testCaseNodeMapper.updateByPrimaryKeySelective(request);
|
return testCaseNodeMapper.updateByPrimaryKeySelective(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用例的 nodePath
|
||||||
|
* @param editNodeIds
|
||||||
|
* @param projectId
|
||||||
|
*/
|
||||||
|
public void editCasePathForMinder(List<String> editNodeIds, String projectId) {
|
||||||
|
if (!CollectionUtils.isEmpty(editNodeIds)) {
|
||||||
|
List<TestCaseNodeDTO> nodeTrees = getNodeTrees(extTestCaseNodeMapper.getNodeTreeByProjectId(projectId));
|
||||||
|
List<TestCaseDTO> testCases = extTestCaseMapper.getForNodeEdit(editNodeIds);
|
||||||
|
nodeTrees.forEach(nodeTree -> buildUpdateTestCase(nodeTree, testCases, null, "/", "0", 1));
|
||||||
|
batchUpdateTestCase(testCases);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int deleteNode(List<String> nodeIds) {
|
public int deleteNode(List<String> nodeIds) {
|
||||||
if (CollectionUtils.isEmpty(nodeIds)) {
|
if (CollectionUtils.isEmpty(nodeIds)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -520,11 +531,13 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
||||||
MSException.throwException(Translator.get("node_deep_limit"));
|
MSException.throwException(Translator.get("node_deep_limit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TestCaseNode testCaseNode = new TestCaseNode();
|
if (updateNodes != null) {
|
||||||
testCaseNode.setId(rootNode.getId());
|
TestCaseNode testCaseNode = new TestCaseNode();
|
||||||
testCaseNode.setLevel(level);
|
testCaseNode.setId(rootNode.getId());
|
||||||
testCaseNode.setParentId(pId);
|
testCaseNode.setLevel(level);
|
||||||
updateNodes.add(testCaseNode);
|
testCaseNode.setParentId(pId);
|
||||||
|
updateNodes.add(testCaseNode);
|
||||||
|
}
|
||||||
|
|
||||||
for (TestCaseDTO item : testCases) {
|
for (TestCaseDTO item : testCases) {
|
||||||
if (StringUtils.equals(item.getNodeId(), rootNode.getId())) {
|
if (StringUtils.equals(item.getNodeId(), rootNode.getId())) {
|
||||||
|
@ -697,17 +710,21 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
||||||
deleteNode(request.getIds());
|
deleteNode(request.getIds());
|
||||||
|
|
||||||
List<TestCaseMinderEditRequest.TestCaseNodeMinderEditItem> testCaseNodes = request.getTestCaseNodes();
|
List<TestCaseMinderEditRequest.TestCaseNodeMinderEditItem> testCaseNodes = request.getTestCaseNodes();
|
||||||
|
List<String> editNodeIds = new ArrayList<>();
|
||||||
|
|
||||||
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(testCaseNodes)) {
|
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(testCaseNodes)) {
|
||||||
|
|
||||||
for (TestCaseMinderEditRequest.TestCaseNodeMinderEditItem item: testCaseNodes) {
|
for (TestCaseMinderEditRequest.TestCaseNodeMinderEditItem item: testCaseNodes) {
|
||||||
if (StringUtils.isBlank(item.getParentId()) || item.getParentId().equals("root")) {
|
if (StringUtils.isBlank(item.getParentId()) || item.getParentId().equals("root")) {
|
||||||
item.setParentId("");
|
item.setParentId(null);
|
||||||
}
|
}
|
||||||
item.setProjectId(request.getProjectId());
|
item.setProjectId(request.getProjectId());
|
||||||
if (item.getIsEdit()) {
|
if (item.getIsEdit()) {
|
||||||
DragNodeRequest editNode = new DragNodeRequest();
|
DragNodeRequest editNode = new DragNodeRequest();
|
||||||
BeanUtils.copyBean(editNode, item);
|
BeanUtils.copyBean(editNode, item);
|
||||||
editNode(editNode);
|
checkTestCaseNodeExist(editNode);
|
||||||
|
editNodeIds.add(editNode.getId());
|
||||||
|
testCaseNodeMapper.updateByPrimaryKeySelective(editNode);
|
||||||
} else {
|
} else {
|
||||||
TestCaseNode testCaseNode = new TestCaseNode();
|
TestCaseNode testCaseNode = new TestCaseNode();
|
||||||
BeanUtils.copyBean(testCaseNode, item);
|
BeanUtils.copyBean(testCaseNode, item);
|
||||||
|
@ -715,6 +732,8 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
||||||
addNode(testCaseNode);
|
addNode(testCaseNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editCasePathForMinder(editNodeIds, request.getProjectId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,23 @@
|
||||||
:show-operator="showOperator"
|
:show-operator="showOperator"
|
||||||
:condition="condition"
|
:condition="condition"
|
||||||
:commands="operators"/>
|
:commands="operators"/>
|
||||||
<module-trash-button :condition="condition" :total="total" :exe="enableTrash"/>
|
<module-trash-button
|
||||||
<module-public-button :condition="condition" :public-total="publicTotal" :exe="enablePublic"/>
|
:condition="condition"
|
||||||
|
:total="total"
|
||||||
|
:exe="enableTrash"/>
|
||||||
|
<module-public-button
|
||||||
|
:condition="condition"
|
||||||
|
:public-total="publicTotal"
|
||||||
|
:exe="enablePublic"/>
|
||||||
</template>
|
</template>
|
||||||
</ms-node-tree>
|
</ms-node-tree>
|
||||||
<test-case-import @refreshAll="refreshAll" ref="testCaseImport"/>
|
<test-case-import
|
||||||
<test-case-export @refreshAll="refreshAll" @exportTestCase="exportTestCase" ref="testCaseExport"/>
|
@refreshAll="refreshAll"
|
||||||
|
ref="testCaseImport"/>
|
||||||
|
<test-case-export
|
||||||
|
@refreshAll="refreshAll"
|
||||||
|
@exportTestCase="exportTestCase"
|
||||||
|
ref="testCaseExport"/>
|
||||||
<test-case-create
|
<test-case-create
|
||||||
:tree-nodes="treeNodes"
|
:tree-nodes="treeNodes"
|
||||||
@saveAsEdit="saveAsEdit"
|
@saveAsEdit="saveAsEdit"
|
||||||
|
|
Loading…
Reference in New Issue