测试计划已存在校验

This commit is contained in:
chenjianxing 2020-05-25 17:46:12 +08:00
parent cf0f35eba3
commit fbbba58bfc
4 changed files with 16 additions and 2 deletions

View File

@ -66,6 +66,9 @@ public class TestPlanService {
ExtProjectMapper extProjectMapper;
public void addTestPlan(TestPlan testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) {
MSException.throwException(Translator.get("plan_name_already_exists"));
};
testPlan.setId(UUID.randomUUID().toString());
testPlan.setStatus(TestPlanStatus.Prepare.name());
testPlan.setCreateTime(System.currentTimeMillis());
@ -73,6 +76,13 @@ public class TestPlanService {
testPlanMapper.insert(testPlan);
}
public List<TestPlan> getTestPlanByName(String name) {
TestPlanExample example = new TestPlanExample();
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
.andNameEqualTo(name);
return testPlanMapper.selectByExample(example);
}
public TestPlan getTestPlan(String testPlanId) {
return testPlanMapper.selectByPrimaryKey(testPlanId);
}

View File

@ -87,4 +87,5 @@ do_not_modify_header_order=Do not modify the header order
module_created_automatically=If there is no such module, will be created automatically
options=options
please_input_workspace_member=Please input workspace merber
test_case_report_template_repeat=The workspace has the same name template
test_case_report_template_repeat=The workspace has the same name template
plan_name_already_exists=Test plan name already exists

View File

@ -88,3 +88,5 @@ module_created_automatically=若无该模块将自动创建
options=选项
please_input_workspace_member=请填写该工作空间相关人员
test_case_report_template_repeat=同一工作空间下不能存在同名模版
plan_name_already_exists=测试计划名称已存在

View File

@ -87,4 +87,5 @@ do_not_modify_header_order=請勿修改表頭順序
module_created_automatically=若無該模塊將自動創建
options=選項
please_input_workspace_member=請填寫該工作空間相關人員
test_case_report_template_repeat=同壹工作空間下不能存在同名模版
test_case_report_template_repeat=同壹工作空間下不能存在同名模版
plan_name_already_exists=測試計劃名稱已存在