fix: 修复创建测试计划时重复提交,成功创建多个相同的计划
This commit is contained in:
parent
848a9481f8
commit
de786f42f9
|
@ -96,7 +96,7 @@ public class TestPlanService {
|
||||||
@Resource
|
@Resource
|
||||||
UserMapper userMapper;
|
UserMapper userMapper;
|
||||||
|
|
||||||
public void addTestPlan(AddTestPlanRequest testPlan) {
|
public synchronized void addTestPlan(AddTestPlanRequest testPlan) {
|
||||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||||
MSException.throwException(Translator.get("plan_name_already_exists"));
|
MSException.throwException(Translator.get("plan_name_already_exists"));
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized List<TestPlan> getTestPlanByName(String name) {
|
public List<TestPlan> getTestPlanByName(String name) {
|
||||||
TestPlanExample example = new TestPlanExample();
|
TestPlanExample example = new TestPlanExample();
|
||||||
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
|
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
|
||||||
.andNameEqualTo(name);
|
.andNameEqualTo(name);
|
||||||
|
|
Loading…
Reference in New Issue