From d562551c7efd2c19fd037ab4fb1b7a355ff80f42 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期五, 13 三月 2026 17:57:52 +0800
Subject: [PATCH] feat(inspection): 新增检测项目管理相关功能
---
src/main/resources/mapper/production/ProductionProductMainMapper.xml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductionProductMainMapper.xml b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
index a122e90..aead45c 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -118,4 +118,54 @@
#{id}
</foreach>
</delete>
+
+ <select id="queryProductInputAndOutput" resultType="Hashmap">
+ select *
+ from (
+ select p.product_name as productName,
+ pm.model as model,
+ pm.unit as unit,
+ temp.inputQuantity as inputQuantity,
+ temp.outputQuantity as outputQuantity
+ from (
+ select product_model_id,
+ coalesce(sum(inputQuantity),0) as inputQuantity,
+ coalesce(sum(outputQuantity),0) as outputQuantity
+ from (
+ (select product_model_id,
+ coalesce(sum(quantity),0) as inputQuantity,
+ 0 as outputQuantity
+ from production_product_input
+ <where>
+ <if test="ew.startTime != null and ew.startTime != ''">
+ and create_time >= #{ew.startTime}
+ </if>
+ <if test="ew.endTime != null and ew.endTime != ''">
+ and create_time < #{ew.endTime}
+ </if>
+ </where>
+ group by product_model_id)
+
+ union all
+
+ (select product_model_id,
+ 0 as inputQuantity,
+ coalesce(sum(quantity),0) as outputQuantity
+ from production_product_output
+ <where>
+ <if test="ew.startTime != null and ew.startTime != ''">
+ and create_time >= #{ew.startTime}
+ </if>
+ <if test="ew.endTime != null and ew.endTime != ''">
+ and create_time < #{ew.endTime}
+ </if>
+ </where>
+ group by product_model_id)
+ ) t
+ group by product_model_id
+ ) temp
+ left join product_model pm on temp.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ ) tmp
+ </select>
</mapper>
--
Gitblit v1.9.3