From 973b5221a85660b3b1e026e119256e35e95336ea Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 13 三月 2026 16:31:58 +0800
Subject: [PATCH] fix: 产品规则返回命名修改

---
 src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml |   50 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
index 204a386..7192a76 100644
--- a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
+++ b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -28,7 +28,6 @@
         <result property="modifierName" column="modifier_name"/>
         <result property="formCreatedTime" column="form_created_time"/>
         <result property="formModifiedTime" column="form_modified_time"/>
-        <result property="dataSyncType" column="data_sync_type"/>
         <result property="dataSourceType" column="data_source_type"/>
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
@@ -40,6 +39,7 @@
         pp.*,
         pms.material_code AS materialCode,
         pms.specification AS specification,
+        pms.material_id AS productMaterialId,
         pm.material_name AS productName,
         pm.base_unit
         FROM production_plan pp
@@ -58,41 +58,55 @@
         <if test="c.specification != null and c.specification != '' ">
             AND pms.specification LIKE CONCAT('%',#{c.specification},'%')
         </if>
+        <if test="c.applyNo != null and c.applyNo != '' ">
+            AND pp.apply_no LIKE CONCAT('%',#{c.applyNo},'%')
+        </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>
+        ORDER BY COALESCE(pp.form_modified_time, pp.id) DESC
     </select>
 
     <select id="selectSummaryByProductType" resultType="com.ruoyi.productionPlan.dto.ProductionPlanSummaryDto">
         SELECT
-        material_code,
-        product_name,
-        product_spec,
-        length,
-        width,
-        height,
-        COALESCE(SUM(quantity),0) AS quantity,
-        COALESCE(SUM(volume),0) AS volume
-        FROM production_plan
+        sku.material_code AS materialCode,
+        pm.material_name AS productName,
+        sku.specification AS specification,
+        pp.length,
+        pp.width,
+        pp.height,
+        pm.base_unit AS baseUnit,
+        COALESCE(SUM(pp.quantity),0) AS quantity,
+        COALESCE(SUM(pp.volume),0) AS volume
+        FROM production_plan pp
+        LEFT JOIN product_material_sku sku
+        ON pp.product_material_sku_id = sku.id
+        LEFT JOIN product_material pm
+        ON sku.material_id = pm.id
         <where>
             <if test="materialCode != null and materialCode != ''">
-                AND material_code LIKE CONCAT('%', #{materialCode}, '%')
+                AND sku.material_code LIKE CONCAT('%', #{materialCode}, '%')
             </if>
 
             <if test="productName != null and productName != ''">
-                AND product_name LIKE CONCAT('%', #{productName}, '%')
+                AND pm.material_name LIKE CONCAT('%', #{productName}, '%')
+            </if>
+
+            <if test="specification != null and specification != ''">
+                AND sku.specification LIKE CONCAT('%', #{specification}, '%')
             </if>
         </where>
         GROUP BY
-        material_code,
-        product_name,
-        product_spec,
-        length,
-        width,
-        height
+        sku.material_code,
+        pm.material_name,
+        sku.specification,
+        pp.length,
+        pp.width,
+        pp.height,
+        pm.base_unit
     </select>
 
     <select id="selectWithMaterialByIds" resultType="com.ruoyi.productionPlan.dto.ProductionPlanDto">

--
Gitblit v1.9.3