diff --git a/api-test/backend/src/main/java/io/metersphere/service/MockConfigService.java b/api-test/backend/src/main/java/io/metersphere/service/MockConfigService.java index 9c84d4d589..98a920414b 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/MockConfigService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/MockConfigService.java @@ -682,14 +682,16 @@ public class MockConfigService { MockConfigExample configExample = new MockConfigExample(); configExample.createCriteria().andApiIdIn(apiIds); List mockConfigList = mockConfigMapper.selectByExample(configExample); - MockExpectConfigExample example = new MockExpectConfigExample(); List mockConfigIds = mockConfigList.stream().map(MockConfig::getId).toList(); - example.createCriteria().andMockConfigIdIn(mockConfigIds); - List deleteBlobs = mockExpectConfigMapper.selectByExampleWithBLOBs(example); - for (MockExpectConfigWithBLOBs model : deleteBlobs) { - this.deleteMockExpectFiles(model); + if (CollectionUtils.isNotEmpty(mockConfigIds)) { + MockExpectConfigExample example = new MockExpectConfigExample(); + example.createCriteria().andMockConfigIdIn(mockConfigIds); + List deleteBlobs = mockExpectConfigMapper.selectByExampleWithBLOBs(example); + for (MockExpectConfigWithBLOBs model : deleteBlobs) { + this.deleteMockExpectFiles(model); + } + mockExpectConfigMapper.deleteByExample(example); } - mockExpectConfigMapper.deleteByExample(example); mockConfigMapper.deleteByExample(configExample); }