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 | 76 ++++++++++++++++++++++++++++++++++++-
1 files changed, 73 insertions(+), 3 deletions(-)
diff --git a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
index 22812ac..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"/>
@@ -34,13 +35,82 @@
<result property="dataSourceType" column="data_source_type"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
+ <result property="totalCount" column="total_count"/>
</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 >= 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
+ <where>
+ <if test="materialCode != null and materialCode != ''">
+ AND material_code LIKE CONCAT('%', #{materialCode}, '%')
+ </if>
+
+ <if test="productName != null and productName != ''">
+ AND product_name LIKE CONCAT('%', #{productName}, '%')
+ </if>
+ </where>
+ GROUP BY
+ material_code,
+ product_name,
+ product_spec,
+ length,
+ width,
+ 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