From 50bcc73377d38017ee5c36655028f53a3c25c58b Mon Sep 17 00:00:00 2001
From: 刘小明 <liuxm_a@163.com>
Date: 星期四, 10 十月 2024 09:40:54 +0800
Subject: [PATCH] 物料清单保存 方法修改

---
 pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml             |    7 +++++++
 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java      |    1 +
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java |    3 +++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java
index ffee6ba..a298ebd 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrBillOfMaterialMapper.java
@@ -2,6 +2,7 @@
 
 import com.dy.pmsGlobal.pojoPr.PrBillOfMaterial;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -20,4 +21,6 @@
     int updateByPrimaryKey(PrBillOfMaterial record);
 
     int insertMany(List<PrBillOfMaterial> records);
+
+    void deleteByNodeId(@Param("nodeIds")List<Long> nodeIds);
 }
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml
index a9c0e69..b3a55e0 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrBillOfMaterialMapper.xml
@@ -89,4 +89,11 @@
       file_id = #{fileId,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <delete id="deleteByNodeId" >
+    delete from pr_bill_of_material where node_id in
+    <foreach collection="nodeIds" item="item" separator="," open="(" close=")">
+      #{item}
+    </foreach>
+    </delete>
 </mapper>
\ No newline at end of file
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java
index 54ff76d..697912e 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/process/ProcessSv.java
@@ -211,6 +211,7 @@
             return null;
         }).filter(bill -> bill != null).toList();
         if (CollectionUtils.isNotEmpty(billList)) {
+            billDao.deleteByNodeId(billList.stream().map(PrBillOfMaterial::getNodeId).toList());
             billDao.insertMany(billList);
         }
     }

--
Gitblit v1.8.0