feat(用例管理): 增加删除功能用例时删除与测试计划的资源关系

This commit is contained in:
guoyuqi 2024-05-17 15:32:50 +08:00 committed by 刘瑞斌
parent 601d659708
commit 920252e952
1 changed files with 16 additions and 0 deletions

View File

@ -2,6 +2,10 @@ package io.metersphere.functional.service;
import io.metersphere.functional.domain.*;
import io.metersphere.functional.mapper.*;
import io.metersphere.plan.domain.TestPlanCaseExecuteHistoryExample;
import io.metersphere.plan.domain.TestPlanFunctionalCaseExample;
import io.metersphere.plan.mapper.TestPlanCaseExecuteHistoryMapper;
import io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper;
import io.metersphere.sdk.constants.DefaultRepositoryDir;
import io.metersphere.sdk.file.FileCenter;
import io.metersphere.sdk.file.FileRequest;
@ -43,6 +47,10 @@ public class DeleteFunctionalCaseService {
private FunctionalCaseRelationshipEdgeMapper functionalCaseRelationshipEdgeMapper;
@Resource
private ExtFunctionalCaseRelationshipEdgeMapper extFunctionalCaseRelationshipEdgeMapper;
@Resource
private TestPlanCaseExecuteHistoryMapper testPlanCaseExecuteHistoryMapper;
@Resource
private TestPlanFunctionalCaseMapper testPlanFunctionalCaseMapper;
public void deleteFunctionalCaseResource(List<String> ids, String projectId) {
@ -116,6 +124,14 @@ public class DeleteFunctionalCaseService {
CaseReviewHistoryExample caseReviewHistoryExample = new CaseReviewHistoryExample();
caseReviewHistoryExample.createCriteria().andCaseIdIn(ids);
caseReviewHistoryMapper.deleteByExample(caseReviewHistoryExample);
//删除和测试计划的关联关系
TestPlanFunctionalCaseExample testPlanFunctionalCaseExample = new TestPlanFunctionalCaseExample();
testPlanFunctionalCaseExample.createCriteria().andFunctionalCaseIdIn(ids);
testPlanFunctionalCaseMapper.deleteByExample(testPlanFunctionalCaseExample);
//删除执行历史
TestPlanCaseExecuteHistoryExample testPlanCaseExecuteHistoryExample = new TestPlanCaseExecuteHistoryExample();
testPlanCaseExecuteHistoryExample.createCriteria().andCaseIdIn(ids);
testPlanCaseExecuteHistoryMapper.deleteByExample(testPlanCaseExecuteHistoryExample);
}
}