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 |   46 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
index 0b205d6..88ec8fb 100644
--- a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
+++ b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -12,6 +12,7 @@
         <result property="applyNo" column="apply_no"/>
         <result property="customerName" column="customer_name"/>
         <result property="materialCode" column="material_code"/>
+        <result property="productMaterialId" column="product_material_id"/>
         <result property="productName" column="product_name"/>
         <result property="productSpec" column="product_spec"/>
         <result property="length" column="length"/>
@@ -38,10 +39,34 @@
     </resultMap>
 
 
-    <select id="listPage" resultMap="ProductionPlanResultMap">
-        SELECT *
-        FROM production_plan
+    <select id="listPage" 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 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 pm.product_name LIKE CONCAT('%',#{c.productName},'%')
+        </if>
+        <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 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')
+        </if>
+        <if test="c.endDate != null">
+            AND pp.end_date &lt;= DATE_FORMAT(#{c.endDate},'%Y-%m-%d')
+        </if>
     </select>
 
     <select id="selectSummaryByProductType" resultType="com.ruoyi.productionPlan.dto.ProductionPlanSummaryDto">
@@ -73,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