From 685b31ed44d9b603d9ec20939968eb194d2b4add Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 20 Jan 2022 17:15:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=97=B6=E5=88=A0=E9=99=A4=E5=85=B3=E8=81=94=E7=9A=84=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/service/ApiDefinitionService.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 51299f2b62..9c240af323 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -1864,6 +1864,13 @@ public class ApiDefinitionService { public void deleteApiDefinitionByVersion(String refId, String version) { ApiDefinitionExample example = new ApiDefinitionExample(); example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version); + List apiDefinitions = apiDefinitionMapper.selectByExample(example); + List ids = apiDefinitions.stream().map(ApiDefinition::getId).collect(Collectors.toList()); + + ApiTestCaseExample apiTestCaseExample = new ApiTestCaseExample(); + apiTestCaseExample.createCriteria().andApiDefinitionIdIn(ids); + apiTestCaseMapper.deleteByExample(apiTestCaseExample); + // apiDefinitionMapper.deleteByExample(example); }