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/resources/mapper/productionPlan/ProductionPlanMapper.xml | 84 ++++++++++++++++++++++++++++-------------
1 files changed, 57 insertions(+), 27 deletions(-)
diff --git a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
index 4bf0e0d..83fc71c 100644
--- a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
+++ b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -11,9 +11,7 @@
<result property="serialNo" column="serial_no"/>
<result property="applyNo" column="apply_no"/>
<result property="customerName" column="customer_name"/>
- <result property="materialCode" column="material_code"/>
- <result property="productName" column="product_name"/>
- <result property="productSpec" column="product_spec"/>
+ <result property="productMaterialSkuId" column="product_material_sku_id"/>
<result property="length" column="length"/>
<result property="width" column="width"/>
<result property="height" column="height"/>
@@ -37,52 +35,84 @@
<result property="totalCount" column="total_count"/>
</resultMap>
-
<select id="listPage" resultType="com.ruoyi.productionPlan.dto.ProductionPlanDto">
- SELECT *
+ SELECT
+ pp.*,
+ pms.material_code AS materialCode,
+ pms.specification AS specification,
+ pm.material_name AS productName,
+ pm.base_unit
FROM production_plan pp
+ left join product_material_sku pms on pp.product_material_sku_id = pms.id
+ left join product_material pm on pms.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},'%')
- </if>
- <if test="c.productSpec != null and c.productSpec != '' ">
- AND pp.product_spec LIKE CONCAT('%',#{c.productSpec},'%')
+ AND pm.material_name LIKE CONCAT('%',#{c.productName},'%')
</if>
<if test="c.materialCode != null and c.materialCode != '' ">
- AND pp.material_code LIKE CONCAT('%',#{c.materialCode},'%')
+ AND pms.material_code LIKE CONCAT('%',#{c.materialCode},'%')
+ </if>
+ <if test="c.specification != null and c.specification != '' ">
+ AND pms.specification LIKE CONCAT('%',#{c.specification},'%')
+ </if>
+ <if test="c.startDate != null">
+ AND pp.start_date >= DATE_FORMAT(#{c.startDate},'%Y-%m-%d')
+ </if>
+ <if test="c.endDate != null">
+ AND pp.end_date <= DATE_FORMAT(#{c.endDate},'%Y-%m-%d')
</if>
</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,
+ 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">
+ SELECT
+ pp.*,
+ pms.material_code AS materialCode,
+ pms.specification AS specification,
+ pm.material_name AS productName,
+ pm.base_unit
+ FROM production_plan pp
+ LEFT JOIN product_material_sku pms ON pp.product_material_sku_id = pms.id
+ LEFT JOIN product_material pm ON pms.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