fix 访问最近的计划中已删除的测试计划报错

This commit is contained in:
shiziyuan9527 2020-06-28 17:56:25 +08:00
parent aabfd2a38d
commit 52932ed2bc
3 changed files with 7 additions and 2 deletions

View File

@ -229,6 +229,9 @@ public class TestCaseNodeService {
public List<TestCaseNodeDTO> getAllNodeByPlanId(String planId) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(planId);
if (testPlan == null) {
return Collections.emptyList();
}
return getNodeTreeByProjectId(testPlan.getProjectId());
}

View File

@ -134,7 +134,9 @@ public class TestCaseService {
public List<TestCase> getTestCaseNames(QueryTestCaseRequest request) {
if ( StringUtils.isNotBlank(request.getPlanId()) ) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
request.setProjectId(testPlan.getProjectId());
if (testPlan != null) {
request.setProjectId(testPlan.getProjectId());
}
}
List<TestCase> testCaseNames = extTestCaseMapper.getTestCaseNames(request);

View File

@ -91,7 +91,7 @@ public class TestPlanService {
}
public TestPlan getTestPlan(String testPlanId) {
return testPlanMapper.selectByPrimaryKey(testPlanId);
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
}
public int editTestPlan(TestPlan testPlan) {