From 9a8731dda3c51f46a41b5478c6e31111dbf82557 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 09 四月 2026 16:28:47 +0800
Subject: [PATCH] fix: 工序无法删除,并且删除工序的同时把绑定的参数也清空

---
 src/main/resources/mapper/production/ProductMaterialMapper.xml |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductMaterialMapper.xml b/src/main/resources/mapper/production/ProductMaterialMapper.xml
index 7e014c9..93f4a8e 100644
--- a/src/main/resources/mapper/production/ProductMaterialMapper.xml
+++ b/src/main/resources/mapper/production/ProductMaterialMapper.xml
@@ -16,8 +16,12 @@
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
-    <select id="selectProductModelIdByName" resultType="java.lang.String" parameterType="java.lang.Long">
-        select pm.product_name
+    <select id="selectProductByModelId" resultType="com.ruoyi.production.dto.ProductMaterialSkuDto"
+            parameterType="java.lang.Long">
+        select pm.product_name as productName,
+        pm.unit,
+        pms.material_code as materialCode,
+        pms.model
         from product_material pm
         left join product_material_sku pms on pms.product_id = pm.id
         <where>
@@ -32,4 +36,27 @@
         </where>
     </select>
 
+    <select id="selectProductByProductMainId" resultType="com.ruoyi.production.dto.ProductMaterialSkuDto"
+            parameterType="java.lang.Long">
+        select
+        pm.product_name as productName,
+        pm.unit,
+        pms.material_code as materialCode,
+        pms.model
+        from product_order po
+        left join product_material_sku pms on pms.id = po.product_material_sku_id
+        left join product_material pm on pm.id = pms.product_id
+        <where>
+            <choose>
+                <when test="productOrderId != null">
+                    po.id = #{productOrderId}
+                </when>
+                <otherwise>
+                    1 = 0
+                </otherwise>
+            </choose>
+        </where>
+    </select>
+
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3