From 3d2f41d21cf136f4573335948c9e9712e9d72229 Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Sun, 22 Feb 2026 00:07:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=99=AE=E9=80=9A=E7=BA=AA=E5=BF=B5?= =?UTF-8?q?=E5=B8=81=E8=87=AA=E6=B5=8B=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommemorativeCoinServiceImpl.java | 13 +++++++++++-- .../mapper/collect/CommemorativeCoinMapper.xml | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/intc-modules/intc-collect/src/main/java/com/intc/collect/service/impl/CommemorativeCoinServiceImpl.java b/intc-modules/intc-collect/src/main/java/com/intc/collect/service/impl/CommemorativeCoinServiceImpl.java index 8a3402c..68f096c 100644 --- a/intc-modules/intc-collect/src/main/java/com/intc/collect/service/impl/CommemorativeCoinServiceImpl.java +++ b/intc-modules/intc-collect/src/main/java/com/intc/collect/service/impl/CommemorativeCoinServiceImpl.java @@ -80,6 +80,9 @@ public class CommemorativeCoinServiceImpl implements ICommemorativeCoinService */ public void insertCollectFile(CommemorativeCoin commemorativeCoin) { + //先删除,再添加 + collectFileMapper.deleteCollectFileByCollectId(commemorativeCoin.getId()); + List collectFileList = commemorativeCoin.getCollectFileList(); Long id = commemorativeCoin.getId(); if (StringUtils.isNotNull(collectFileList)) @@ -93,7 +96,7 @@ public class CommemorativeCoinServiceImpl implements ICommemorativeCoinService collectFile.setId(IdWorker.getId()); list.add(collectFile); } - if (list.size() > 0) + if (!list.isEmpty()) { collectFileMapper.batchInsertCollectFile(list); } @@ -124,7 +127,13 @@ public class CommemorativeCoinServiceImpl implements ICommemorativeCoinService @Override public int deleteCommemorativeCoinByIds(Long[] ids) { - return commemorativeCoinMapper.removeCommemorativeCoinByIds(ids); + int i= commemorativeCoinMapper.removeCommemorativeCoinByIds(ids); + for (Long collectId : ids) + { + collectFileMapper.deleteCollectFileByCollectId(collectId); + } + return i; + } /** diff --git a/intc-modules/intc-collect/src/main/resources/mapper/collect/CommemorativeCoinMapper.xml b/intc-modules/intc-collect/src/main/resources/mapper/collect/CommemorativeCoinMapper.xml index f4b8a08..4af37f9 100644 --- a/intc-modules/intc-collect/src/main/resources/mapper/collect/CommemorativeCoinMapper.xml +++ b/intc-modules/intc-collect/src/main/resources/mapper/collect/CommemorativeCoinMapper.xml @@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - a.del_flag='0' @@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by a.issue_date desc - where a.id = #{id}