fix(测试计划): 批量执行历史

--bug=1040923 --user=王旭 【测试计划】测试计划详情-功能用例列表-批量执行-批量执行成功后用例的步骤执行结果为空了 https://www.tapd.cn/55049933/s/1518912
This commit is contained in:
WangXu10 2024-05-23 11:29:12 +08:00 committed by 刘瑞斌
parent 288b1e14be
commit fa0fdb1ee4
3 changed files with 29 additions and 5 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.plan.mapper;
import io.metersphere.plan.domain.TestPlanCaseExecuteHistory;
import io.metersphere.plan.dto.request.TestPlanCaseExecHistoryRequest;
import io.metersphere.plan.dto.response.TestPlanCaseExecHistoryResponse;
import org.apache.ibatis.annotations.Param;
@ -11,4 +12,6 @@ public interface ExtTestPlanCaseExecuteHistoryMapper {
void updateDeleted(@Param("testPlanCaseIds") List<String> testPlanCaseIds, @Param("deleted") boolean deleted);
List<TestPlanCaseExecHistoryResponse> getCaseExecHistory(@Param("request") TestPlanCaseExecHistoryRequest request);
List<TestPlanCaseExecuteHistory> selectSteps(@Param("testPlanCaseId") String testPlanCaseId, @Param("caseId") String caseId);
}

View File

@ -37,4 +37,24 @@
tpceh.create_time DESC
</select>
<select id="selectSteps" resultType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
SELECT
test_plan_case_execute_history.id,
test_plan_case_execute_history.test_plan_case_id as testPlanCaseId,
test_plan_case_execute_history.test_plan_id as testPlanId,
test_plan_case_execute_history.case_id as caseId,
test_plan_case_execute_history.steps
FROM
test_plan_case_execute_history
WHERE
test_plan_case_id = #{testPlanCaseId}
AND case_id = #{caseId}
AND DELETED = FALSE
AND steps IS NOT NULL
ORDER BY
create_time DESC
LIMIT 1
</select>
</mapper>

View File

@ -16,7 +16,10 @@ import io.metersphere.functional.mapper.FunctionalCaseMapper;
import io.metersphere.functional.service.FunctionalCaseAttachmentService;
import io.metersphere.functional.service.FunctionalCaseModuleService;
import io.metersphere.functional.service.FunctionalCaseService;
import io.metersphere.plan.domain.*;
import io.metersphere.plan.domain.TestPlan;
import io.metersphere.plan.domain.TestPlanCaseExecuteHistory;
import io.metersphere.plan.domain.TestPlanFunctionalCase;
import io.metersphere.plan.domain.TestPlanFunctionalCaseExample;
import io.metersphere.plan.dto.AssociationNodeSortDTO;
import io.metersphere.plan.dto.ResourceLogInsertModule;
import io.metersphere.plan.dto.TestPlanCaseRunResultCount;
@ -141,6 +144,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
List<TestPlanCaseRunResultCount> runResultCounts = extTestPlanFunctionalCaseMapper.selectCaseExecResultCount(testPlanId);
return runResultCounts.stream().collect(Collectors.toMap(TestPlanCaseRunResultCount::getResult, TestPlanCaseRunResultCount::getResultCount));
}
@Override
public void refreshPos(String testPlanId) {
List<String> functionalCaseIdList = extTestPlanFunctionalCaseMapper.selectIdByTestPlanIdOrderByPos(testPlanId);
@ -550,10 +554,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
String caseId = planFunctionalCase.getFunctionalCaseId();
FunctionalCaseDetailDTO functionalCaseDetail = functionalCaseService.getFunctionalCaseDetail(caseId, userId);
String caseDetailSteps = functionalCaseDetail.getSteps();
TestPlanCaseExecuteHistoryExample testPlanCaseExecuteHistoryExample = new TestPlanCaseExecuteHistoryExample();
testPlanCaseExecuteHistoryExample.createCriteria().andCaseIdEqualTo(caseId).andTestPlanCaseIdEqualTo(id);
testPlanCaseExecuteHistoryExample.setOrderByClause("create_time DESC");
List<TestPlanCaseExecuteHistory> testPlanCaseExecuteHistories = testPlanCaseExecuteHistoryMapper.selectByExampleWithBLOBs(testPlanCaseExecuteHistoryExample);
List<TestPlanCaseExecuteHistory> testPlanCaseExecuteHistories = extTestPlanCaseExecuteHistoryMapper.selectSteps(id, caseId);
Integer runListCount = 0;
List<FunctionalCaseStepDTO> functionalCaseStepDTOS = new ArrayList<>();
if (CollectionUtils.isNotEmpty(testPlanCaseExecuteHistories)) {