fix 删除项目

This commit is contained in:
chenjianxing 2020-05-27 12:25:02 +08:00
parent dfd6aaeeee
commit 74827189bc
6 changed files with 32 additions and 9 deletions

View File

@ -285,11 +285,18 @@ public class TestCaseService {
} }
public void deleteTestCaseBath(TestCaseBatchRequest request) { public void deleteTestCaseBath(TestCaseBatchRequest request) {
deleteTestPlanTestCaseBath(request.getIds());
TestCaseExample example = new TestCaseExample(); TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdIn(request.getIds()); example.createCriteria().andIdIn(request.getIds());
testCaseMapper.deleteByExample(example); testCaseMapper.deleteByExample(example);
} }
public void deleteTestPlanTestCaseBath(List<String> caseIds) {
TestPlanTestCaseExample example = new TestPlanTestCaseExample();
example.createCriteria().andCaseIdIn(caseIds);
testPlanTestCaseMapper.deleteByExample(example);
}
public void deleteTestCaseByProjectId(String projectId) { public void deleteTestCaseByProjectId(String projectId) {
TestCaseExample example = new TestCaseExample(); TestCaseExample example = new TestCaseExample();
example.createCriteria().andProjectIdEqualTo(projectId); example.createCriteria().andProjectIdEqualTo(projectId);

View File

@ -33,6 +33,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -92,14 +93,15 @@ public class TestPlanService {
return testPlanMapper.updateByPrimaryKeySelective(testPlan); 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 testPlanTestCaseExample = new TestPlanTestCaseExample();
testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(testPlanId); testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(testPlanId);
List<TestPlanTestCase> testPlanTestCases = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample); testPlanTestCaseMapper.deleteByExample(testPlanTestCaseExample);
if (testPlanTestCases.size() > 0) {
MSException.throwException(Translator.get("before_delete_plan"));
}
return testPlanMapper.deleteByPrimaryKey(testPlanId);
} }
public List<TestPlanDTO> listTestPlan(QueryTestPlanRequest request) { public List<TestPlanDTO> listTestPlan(QueryTestPlanRequest request) {

View File

@ -10,6 +10,20 @@
<el-table-column prop="name" :label="$t('commons.name')"/> <el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" :label="$t('commons.description')"/> <el-table-column prop="description" :label="$t('commons.description')"/>
<!--<el-table-column prop="workspaceName" :label="$t('project.owning_workspace')"/>--> <!--<el-table-column prop="workspaceName" :label="$t('project.owning_workspace')"/>-->
<el-table-column
:label="$t('commons.create_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('commons.update_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column> <el-table-column>
<template v-slot:default="scope"> <template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/> <ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>

View File

@ -428,7 +428,7 @@ export default {
plan_status_prepare: "Not started", plan_status_prepare: "Not started",
plan_status_running: "Starting", plan_status_running: "Starting",
plan_status_completed: "Completed", plan_status_completed: "Completed",
plan_delete_confirm: "Confirm delete test plan: ", plan_delete_confirm: "All use cases under this plan will be deleted,confirm delete test plan: ",
}, },
module: { module: {
search: "Search module", search: "Search module",

View File

@ -425,7 +425,7 @@ export default {
plan_status_prepare: "未开始", plan_status_prepare: "未开始",
plan_status_running: "进行中", plan_status_running: "进行中",
plan_status_completed: "已完成", plan_status_completed: "已完成",
plan_delete_confirm: "确认删除测试计划: ", plan_delete_confirm: "将删除该测试计划下所有用例,确认删除测试计划: ",
}, },
module: { module: {
search: "搜索模块", search: "搜索模块",

View File

@ -427,7 +427,7 @@ export default {
plan_status_prepare: "未開始", plan_status_prepare: "未開始",
plan_status_running: "進行中", plan_status_running: "進行中",
plan_status_completed: "已完成", plan_status_completed: "已完成",
plan_delete_confirm: "確認刪除測試計劃: ", plan_delete_confirm: "將刪除該測試計劃下所有用例,確認刪除測試計劃: ",
}, },
module: { module: {
search: "搜索模塊", search: "搜索模塊",