From 9f3689ea26fd2158ffafd31a7932b1e685b0252b Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 11 二月 2026 11:59:46 +0800
Subject: [PATCH] fix: 一个合同中多个产品时,来票登记已来票金额、待来票金额统计有误

---
 src/main/resources/mapper/production/ProductionProductOutputMapper.xml |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductionProductOutputMapper.xml b/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
index 48c8c9e..3b44135 100644
--- a/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
@@ -10,6 +10,7 @@
         <result property="tenantId" column="tenant_id"/>
         <result property="createTime" column="create_time"/>
     </resultMap>
+
     <select id="listPageProductionProductOutputDto" resultType="com.ruoyi.production.dto.ProductionProductOutputDto">
         select ppo.*,
         pm.model as model,
@@ -25,4 +26,36 @@
         </where>
         order by ppo.id
     </select>
+
+    <delete id="deleteByProductMainIds" parameterType="java.util.List">
+        DELETE FROM production_product_output
+        WHERE product_main_id IN
+        <foreach collection="productMainIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    <select id="selectOutputStats" resultType="com.ruoyi.production.dto.ProductionProductOutputDto">
+        SELECT
+            create_time,
+            quantity,
+            scrap_qty
+        FROM
+            production_product_output
+        WHERE
+            create_time &gt;= #{startDate}
+            AND create_time &lt;= #{endDate}
+    </select>
+
+    <select id="selectDailyOutputStats" resultType="java.util.Map">
+        SELECT
+            DATE_FORMAT(create_time, '%Y-%m-%d') as date,
+            SUM(quantity-scrap_qty) as quantity
+        FROM
+            production_product_output
+        WHERE
+            create_time &gt;= #{startDate}
+            AND create_time &lt;= #{endDate}
+        GROUP BY
+            DATE_FORMAT(create_time, '%Y-%m-%d')
+    </select>
 </mapper>

--
Gitblit v1.9.3