fix:测试计划关联同步接口用例报错

This commit is contained in:
wenyann 2021-04-25 10:58:03 +08:00 committed by 刘瑞斌
parent 143045c8fc
commit 7f33a80ad7
1 changed files with 16 additions and 13 deletions

View File

@ -511,21 +511,24 @@ public class TestPlanService {
}
if(StringUtils.equals(l.getTestType(),TestCaseStatus.testcase.name())){
TestPlanApiCase t=new TestPlanApiCase();
ApiTestCaseWithBLOBs apitest=apiTestCaseMapper.selectByPrimaryKey(l.getTestId());
ApiDefinitionWithBLOBs apidefinition=apiDefinitionMapper.selectByPrimaryKey(apitest.getApiDefinitionId());
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setApiCaseId(l.getTestId());
t.setEnvironmentId(apidefinition.getEnvironmentId());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanApiCaseExample example=new TestPlanApiCaseExample();
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiCaseIdEqualTo(t.getApiCaseId());
if(testPlanApiCaseMapper.countByExample(example)<=0){
testPlanApiCaseMapper.insert(t);
TestPlanApiCase t = new TestPlanApiCase();
ApiTestCaseWithBLOBs apitest = apiTestCaseMapper.selectByPrimaryKey(l.getTestId());
if (null != apitest) {
ApiDefinitionWithBLOBs apidefinition = apiDefinitionMapper.selectByPrimaryKey(apitest.getApiDefinitionId());
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setApiCaseId(l.getTestId());
t.setEnvironmentId(apidefinition.getEnvironmentId());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiCaseIdEqualTo(t.getApiCaseId());
if (testPlanApiCaseMapper.countByExample(example) <= 0) {
testPlanApiCaseMapper.insert(t);
}
}
}
if(StringUtils.equals(l.getTestType(),TestCaseStatus.automation.name())){
TestPlanApiScenario t=new TestPlanApiScenario();