From 74827189bcd218cd2502cb58ba4a973dfc2d8974 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 27 May 2020 12:25:02 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/track/service/TestCaseService.java | 7 +++++++ .../metersphere/track/service/TestPlanService.java | 14 ++++++++------ .../src/business/components/project/MsProject.vue | 14 ++++++++++++++ frontend/src/i18n/en-US.js | 2 +- frontend/src/i18n/zh-CN.js | 2 +- frontend/src/i18n/zh-TW.js | 2 +- 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 263d0aced4..1edf70ce46 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -285,11 +285,18 @@ public class TestCaseService { } public void deleteTestCaseBath(TestCaseBatchRequest request) { + deleteTestPlanTestCaseBath(request.getIds()); TestCaseExample example = new TestCaseExample(); example.createCriteria().andIdIn(request.getIds()); testCaseMapper.deleteByExample(example); } + public void deleteTestPlanTestCaseBath(List caseIds) { + TestPlanTestCaseExample example = new TestPlanTestCaseExample(); + example.createCriteria().andCaseIdIn(caseIds); + testPlanTestCaseMapper.deleteByExample(example); + } + public void deleteTestCaseByProjectId(String projectId) { TestCaseExample example = new TestCaseExample(); example.createCriteria().andProjectIdEqualTo(projectId); diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 12c00e91ff..2a92a3d023 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -33,6 +33,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; @Service @Transactional(rollbackFor = Exception.class) @@ -92,14 +93,15 @@ public class TestPlanService { return testPlanMapper.updateByPrimaryKeySelective(testPlan); } - public int deleteTestPlan(String testPlanId) { + public int deleteTestPlan(String planId) { + deleteTestCaseByPlanId(planId); + return testPlanMapper.deleteByPrimaryKey(planId); + } + + public void deleteTestCaseByPlanId(String testPlanId) { TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample(); testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(testPlanId); - List testPlanTestCases = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample); - if (testPlanTestCases.size() > 0) { - MSException.throwException(Translator.get("before_delete_plan")); - } - return testPlanMapper.deleteByPrimaryKey(testPlanId); + testPlanTestCaseMapper.deleteByExample(testPlanTestCaseExample); } public List listTestPlan(QueryTestPlanRequest request) { diff --git a/frontend/src/business/components/project/MsProject.vue b/frontend/src/business/components/project/MsProject.vue index f5ceb84058..42ee94fc9e 100644 --- a/frontend/src/business/components/project/MsProject.vue +++ b/frontend/src/business/components/project/MsProject.vue @@ -10,6 +10,20 @@ + + + + + +