fix(测试跟踪): 测试计划允许重复,关联功能用例依然过滤了模块

This commit is contained in:
chenjianxing 2022-10-27 12:57:13 +08:00 committed by jianxing
parent 00af9a4866
commit 0e80457e59
2 changed files with 12 additions and 2 deletions

View File

@ -323,10 +323,14 @@
<select id="getTestPlanRelateCountNodes" resultType="io.metersphere.dto.TestCaseNodeDTO">
select tcn.id, count(*) as caseNum, test_case.project_id
from test_case
left join test_plan_test_case tptc on tptc.case_id = test_case.id and tptc.plan_id = #{request.planId}
<if test="!request.repeatCase">
left join test_plan_test_case tptc on tptc.case_id = test_case.id and tptc.plan_id = #{request.planId}
</if>
left join test_case_node tcn on test_case.node_id = tcn.id
<include refid="queryWhereCondition"/>
and tptc.case_id is null
<if test="!request.repeatCase">
and tptc.case_id is null
</if>
group by tcn.id
</select>
<select id="getTestReviewRelateCountNodes" resultType="io.metersphere.dto.TestCaseNodeDTO">

View File

@ -27,6 +27,7 @@ import io.metersphere.log.vo.api.ModuleReference;
import io.metersphere.dto.TestCaseDTO;
import io.metersphere.dto.TestCaseNodeDTO;
import io.metersphere.plan.service.TestPlanProjectService;
import io.metersphere.plan.service.TestPlanService;
import io.metersphere.request.testcase.*;
import io.metersphere.plan.request.function.QueryTestPlanCaseRequest;
import io.metersphere.request.testreview.QueryCaseReviewRequest;
@ -65,6 +66,8 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
ExtTestReviewCaseMapper extTestReviewCaseMapper;
@Resource
TestPlanProjectService testPlanProjectService;
@Resource
TestPlanService testPlanService;
public TestCaseNodeService() {
super(TestCaseNodeDTO.class);
@ -351,6 +354,9 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
public List<TestCaseNodeDTO> getRelatePlanNodes(QueryTestCaseRequest request) {
request.setNodeIds(null);
if (testPlanService.isAllowedRepeatCase(request.getPlanId())) {
request.setRepeatCase(true);
}
List<TestCaseNodeDTO> countMNodes = extTestCaseMapper.getTestPlanRelateCountNodes(request);
List<TestCaseNodeDTO> testCaseNodes = extTestCaseNodeMapper.getNodeTreeByProjectId(request.getProjectId());
return getNodeTreeWithPruningTreeByCaseCount(testCaseNodes, getCountMap(countMNodes));