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 id="getTestPlanRelateCountNodes" resultType="io.metersphere.dto.TestCaseNodeDTO">
select tcn.id, count(*) as caseNum, test_case.project_id select tcn.id, count(*) as caseNum, test_case.project_id
from test_case from test_case
<if test="!request.repeatCase">
left join test_plan_test_case tptc on tptc.case_id = test_case.id and tptc.plan_id = #{request.planId} 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 left join test_case_node tcn on test_case.node_id = tcn.id
<include refid="queryWhereCondition"/> <include refid="queryWhereCondition"/>
<if test="!request.repeatCase">
and tptc.case_id is null and tptc.case_id is null
</if>
group by tcn.id group by tcn.id
</select> </select>
<select id="getTestReviewRelateCountNodes" resultType="io.metersphere.dto.TestCaseNodeDTO"> <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.TestCaseDTO;
import io.metersphere.dto.TestCaseNodeDTO; import io.metersphere.dto.TestCaseNodeDTO;
import io.metersphere.plan.service.TestPlanProjectService; import io.metersphere.plan.service.TestPlanProjectService;
import io.metersphere.plan.service.TestPlanService;
import io.metersphere.request.testcase.*; import io.metersphere.request.testcase.*;
import io.metersphere.plan.request.function.QueryTestPlanCaseRequest; import io.metersphere.plan.request.function.QueryTestPlanCaseRequest;
import io.metersphere.request.testreview.QueryCaseReviewRequest; import io.metersphere.request.testreview.QueryCaseReviewRequest;
@ -65,6 +66,8 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
ExtTestReviewCaseMapper extTestReviewCaseMapper; ExtTestReviewCaseMapper extTestReviewCaseMapper;
@Resource @Resource
TestPlanProjectService testPlanProjectService; TestPlanProjectService testPlanProjectService;
@Resource
TestPlanService testPlanService;
public TestCaseNodeService() { public TestCaseNodeService() {
super(TestCaseNodeDTO.class); super(TestCaseNodeDTO.class);
@ -351,6 +354,9 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
public List<TestCaseNodeDTO> getRelatePlanNodes(QueryTestCaseRequest request) { public List<TestCaseNodeDTO> getRelatePlanNodes(QueryTestCaseRequest request) {
request.setNodeIds(null); request.setNodeIds(null);
if (testPlanService.isAllowedRepeatCase(request.getPlanId())) {
request.setRepeatCase(true);
}
List<TestCaseNodeDTO> countMNodes = extTestCaseMapper.getTestPlanRelateCountNodes(request); List<TestCaseNodeDTO> countMNodes = extTestCaseMapper.getTestPlanRelateCountNodes(request);
List<TestCaseNodeDTO> testCaseNodes = extTestCaseNodeMapper.getNodeTreeByProjectId(request.getProjectId()); List<TestCaseNodeDTO> testCaseNodes = extTestCaseNodeMapper.getNodeTreeByProjectId(request.getProjectId());
return getNodeTreeWithPruningTreeByCaseCount(testCaseNodes, getCountMap(countMNodes)); return getNodeTreeWithPruningTreeByCaseCount(testCaseNodes, getCountMap(countMNodes));