From b78f044e3ec24c0e4c2d477e469434d514cb3d42 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 12 三月 2026 17:32:18 +0800
Subject: [PATCH] 合并下发时判断ids是否存在
---
src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
index 204a386..de06cf1 100644
--- a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
+++ b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -40,6 +40,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
@@ -68,31 +69,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