From 4a82ac1bfb3e3cd04d6dd6c07aaee6c0d70df13e Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 12 三月 2026 09:59:32 +0800
Subject: [PATCH] 主生产计划:产品信息改为关联查询

---
 src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml |   31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
index 43df1a5..88ec8fb 100644
--- a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
+++ b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -40,20 +40,26 @@
 
 
     <select id="listPage" resultType="com.ruoyi.productionPlan.dto.ProductionPlanDto">
-        SELECT *
+        SELECT
+        pp.*,
+        pm.product_name,
+        pm.specification,
+        pm.material_code,
+        pm.base_unit
         FROM production_plan pp
+        left join product_material pm on pp.product_material_id = pm.id
         WHERE 1 = 1
         <if test="c.customerName != null and c.customerName != '' ">
             AND pp.customer_name LIKE CONCAT('%',#{c.customerName},'%')
         </if>
         <if test="c.productName != null and c.productName != '' ">
-            AND pp.product_name LIKE CONCAT('%',#{c.productName},'%')
+            AND pm.product_name LIKE CONCAT('%',#{c.productName},'%')
         </if>
-        <if test="c.productSpec != null and c.productSpec != '' ">
-            AND pp.product_spec LIKE CONCAT('%',#{c.productSpec},'%')
+        <if test="c.specification != null and c.specification != '' ">
+            AND pm.specification LIKE CONCAT('%',#{c.specification},'%')
         </if>
         <if test="c.materialCode != null and c.materialCode != '' ">
-            AND pp.material_code LIKE CONCAT('%',#{c.materialCode},'%')
+            AND pm.material_code LIKE CONCAT('%',#{c.materialCode},'%')
         </if>
         <if test="c.startDate != null">
             AND pp.start_date &gt;= DATE_FORMAT(#{c.startDate},'%Y-%m-%d')
@@ -92,4 +98,19 @@
         height
     </select>
 
+    <select id="selectWithMaterialByIds" resultType="com.ruoyi.productionPlan.dto.ProductionPlanDto">
+        SELECT
+        pp.*,
+        pm.product_name,
+        pm.specification,
+        pm.material_code,
+        pm.base_unit
+        FROM production_plan pp
+        LEFT JOIN product_material pm ON pp.product_material_id = pm.id
+        WHERE pp.id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        ORDER BY pp.id ASC
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3