fix: 删除接口时删除关联的用例
This commit is contained in:
parent
b8edfe2532
commit
685b31ed44
|
@ -1864,6 +1864,13 @@ public class ApiDefinitionService {
|
||||||
public void deleteApiDefinitionByVersion(String refId, String version) {
|
public void deleteApiDefinitionByVersion(String refId, String version) {
|
||||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||||
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
|
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
|
||||||
|
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
|
||||||
|
List<String> ids = apiDefinitions.stream().map(ApiDefinition::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
ApiTestCaseExample apiTestCaseExample = new ApiTestCaseExample();
|
||||||
|
apiTestCaseExample.createCriteria().andApiDefinitionIdIn(ids);
|
||||||
|
apiTestCaseMapper.deleteByExample(apiTestCaseExample);
|
||||||
|
//
|
||||||
apiDefinitionMapper.deleteByExample(example);
|
apiDefinitionMapper.deleteByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue