From 5a61859424171517e5327dc583a7f27192c25d01 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 27 Mar 2023 19:58:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4api?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8A=A5sql=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1024917 --user=王孝刚 【接口测试】api-回收站- 全选批量删除报sql异常 https://www.tapd.cn/55049933/s/1356281 --- .../io/metersphere/service/MockConfigService.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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); }