fix(用例管理): 用例详情执行评论重复关联显示更新时间最新的那一个

This commit is contained in:
guoyuqi 2024-05-20 15:53:29 +08:00 committed by Craftsman
parent db15c7325d
commit 9bb85bad49
2 changed files with 12 additions and 6 deletions

View File

@ -74,7 +74,7 @@
<include refid="planFilters">
<property name="filter" value="request.filter"/>
</include>
group by tpfc.test_plan_id
order by tpfc.last_exec_time desc
</select>
<select id="getPlanExecuteHistoryList" resultType="io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO">

View File

@ -34,10 +34,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author guoyuqi
@ -254,7 +252,15 @@ public class FunctionalTestCaseService {
* @return List<FunctionalCaseTestPlanDTO>
*/
public List<FunctionalCaseTestPlanDTO> hasAssociatePlanPage(AssociatePlanPageRequest request) {
return extFunctionalCaseTestMapper.getPlanList(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;
}
public List<TestPlanCaseExecuteHistoryDTO> getTestPlanCaseExecuteHistory(String caseId) {