From 666dddac6724361f31d640435ea23b84ca1539f9 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 12 三月 2026 17:09:42 +0800
Subject: [PATCH] fix: 移除生产计划多余字段

---
 src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java                    |   21 ----------
 src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java |   17 --------
 src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml                  |   38 ++++++++++--------
 3 files changed, 21 insertions(+), 55 deletions(-)

diff --git a/src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java b/src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java
index 30e5f17..126f9dc 100644
--- a/src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java
+++ b/src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java
@@ -59,27 +59,6 @@
     private String customerName;
 
     /**
-     * 鐗╂枡缂栫爜
-     */
-    @ApiModelProperty("鐗╂枡缂栫爜")
-    @Excel(name = "鐗╂枡缂栫爜")
-    private String materialCode;
-
-    /**
-     * 浜у搧鍚嶇О
-     */
-    @ApiModelProperty("浜у搧鍚嶇О")
-    @Excel(name = "浜у搧鍚嶇О")
-    private String productName;
-
-    /**
-     * 浜у搧瑙勬牸
-     */
-    @ApiModelProperty("浜у搧瑙勬牸")
-    @Excel(name = "浜у搧瑙勬牸")
-    private String productSpec;
-
-    /**
      * 鍏宠仈鐗╂枡淇℃伅琛↖D
      */
     @ApiModelProperty("鍏宠仈鐗╂枡淇℃伅琛↖D")
diff --git a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
index 86d6439..e2c41db 100644
--- a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -389,7 +389,6 @@
                 plan.setCustomerName(formData.getString("textField_lbkozohg"));
 
                 String materialCode = row.getString("textField_l9xo62q5");
-                plan.setMaterialCode(materialCode);
                 // 鏍规嵁鐗╂枡缂栫爜鏌ヨ鐗╂枡淇℃伅琛紝鍏宠仈鐗╂枡ID
                 if (StringUtils.isNotEmpty(materialCode)) {
                     LambdaQueryWrapper<ProductMaterialSku> skuQueryWrapper = new LambdaQueryWrapper<>();
@@ -397,15 +396,6 @@
                     ProductMaterialSku sku = productMaterialSkuService.getOne(skuQueryWrapper);
                     if (sku != null) {
                         plan.setProductMaterialSkuId(sku.getId());
-                        if (sku.getMaterialId() != null) {
-                            // 璁剧疆浜у搧鍚嶇О
-                            ProductMaterial material = productMaterialService.getById(sku.getMaterialId());
-                            if (material != null) {
-                                plan.setProductName(material.getMaterialName());
-                            }
-                        }
-                        // 璁剧疆瑙勬牸鍨嬪彿
-                        plan.setProductSpec(sku.getSpecification());
                     }
                 }
 
@@ -563,13 +553,6 @@
                 ProductMaterialSku sku = productMaterialSkuService.getOne(skuQueryWrapper);
                 if (sku != null) {
                     entity.setProductMaterialSkuId(sku.getId());
-                    if (sku.getMaterialId() != null) {
-                        ProductMaterial material = productMaterialService.getById(sku.getMaterialId());
-                        if (material != null) {
-                            entity.setProductName(material.getMaterialName());
-                        }
-                    }
-                    entity.setProductSpec(sku.getSpecification());
                 }
             }
 
diff --git a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
index 204a386..83fc71c 100644
--- a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
+++ b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -68,31 +68,35 @@
 
     <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,
+        pm.material_name AS product_name,
+        sku.specification AS product_spec,
+        pp.length,
+        pp.width,
+        pp.height,
+        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>
         </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
     </select>
 
     <select id="selectWithMaterialByIds" resultType="com.ruoyi.productionPlan.dto.ProductionPlanDto">

--
Gitblit v1.9.3