fix(用例管理): 用例详情获取测试计划数量去重
This commit is contained in:
parent
793433c230
commit
ecb74fd9d4
|
@ -13,6 +13,7 @@ import io.metersphere.functional.mapper.*;
|
|||
import io.metersphere.functional.request.*;
|
||||
import io.metersphere.functional.result.CaseManagementResultCode;
|
||||
import io.metersphere.plan.domain.TestPlanCaseExecuteHistoryExample;
|
||||
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
||||
import io.metersphere.plan.domain.TestPlanFunctionalCaseExample;
|
||||
import io.metersphere.plan.mapper.TestPlanCaseExecuteHistoryMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper;
|
||||
|
@ -410,7 +411,13 @@ public class FunctionalCaseService {
|
|||
//获取已关联测试计划数量
|
||||
TestPlanFunctionalCaseExample testPlanFunctionalCaseExample = new TestPlanFunctionalCaseExample();
|
||||
testPlanFunctionalCaseExample.createCriteria().andFunctionalCaseIdEqualTo(functionalCaseDetailDTO.getId());
|
||||
functionalCaseDetailDTO.setTestPlanCount((int) testPlanFunctionalCaseMapper.countByExample(testPlanFunctionalCaseExample));
|
||||
List<TestPlanFunctionalCase> testPlanFunctionalCases = testPlanFunctionalCaseMapper.selectByExample(testPlanFunctionalCaseExample);
|
||||
if (CollectionUtils.isNotEmpty(testPlanFunctionalCases)) {
|
||||
Map<String, List<TestPlanFunctionalCase>> planMap = testPlanFunctionalCases.stream().collect(Collectors.groupingBy(TestPlanFunctionalCase::getTestPlanId));
|
||||
functionalCaseDetailDTO.setTestPlanCount(planMap.size());
|
||||
} else {
|
||||
functionalCaseDetailDTO.setTestPlanCount(0);
|
||||
}
|
||||
|
||||
//获取评论总数量数量
|
||||
CaseReviewHistoryExample caseReviewHistoryExample = new CaseReviewHistoryExample();
|
||||
|
|
Loading…
Reference in New Issue