fix(用例管理): 修复用例详情关联测试计划分页查询不正确的问题

This commit is contained in:
guoyuqi 2024-05-20 18:08:04 +08:00 committed by 刘瑞斌
parent b4d10d25d7
commit 784fec2293
2 changed files with 8 additions and 13 deletions

View File

@ -57,7 +57,8 @@
</select>
<select id="getPlanList" parameterType="io.metersphere.functional.request.AssociatePlanPageRequest" resultType="io.metersphere.functional.dto.FunctionalCaseTestPlanDTO">
SELECT
SELECT r.* from (
SELECT distinct tpfc.test_plan_id as testPlanId,
tpfc.*, tp.name as testPlanName, tp.num as testPlanNum, tp.status as planStatus, p.name as projectName
FROM
test_plan_functional_case tpfc
@ -74,7 +75,7 @@
<include refid="planFilters">
<property name="filter" value="request.filter"/>
</include>
order by tpfc.last_exec_time desc
order by tpfc.last_exec_time desc) as r group by r.test_plan_id
</select>
<select id="getPlanExecuteHistoryList" resultType="io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO">

View File

@ -34,8 +34,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author guoyuqi
@ -252,15 +254,7 @@ public class FunctionalTestCaseService {
* @return List<FunctionalCaseTestPlanDTO>
*/
public List<FunctionalCaseTestPlanDTO> hasAssociatePlanPage(AssociatePlanPageRequest request) {
List<FunctionalCaseTestPlanDTO> planList = extFunctionalCaseTestMapper.getPlanList(request);
List<FunctionalCaseTestPlanDTO> returnList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(planList)) {
LinkedHashMap<String, List<FunctionalCaseTestPlanDTO>> caseMap = planList.stream().collect(Collectors.groupingBy(FunctionalCaseTestPlanDTO::getTestPlanId, LinkedHashMap::new, Collectors.toList()));
caseMap.forEach((planId,list)->{
returnList.add(list.get(0));
});
}
return returnList;
return extFunctionalCaseTestMapper.getPlanList(request);
}
public List<TestPlanCaseExecuteHistoryDTO> getTestPlanCaseExecuteHistory(String caseId) {