Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
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;
Expand Down Expand Up @@ -141,6 +144,7 @@ public Map<String, Long> caseExecResultCount(String testPlanId) {
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);
Expand Down Expand Up @@ -550,10 +554,7 @@ public TestPlanCaseDetailResponse getFunctionalCaseDetail(String id, String user
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)) {
Expand Down
Loading