From 9feb6d89a63090196532229116e592b56a71793c Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 22 四月 2026 17:05:23 +0800
Subject: [PATCH] feat(home): 首页质量统计已检测数逐展示数据有误

---
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 46db172..e7791c9 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -278,4 +278,20 @@
                                  FROM product_tree);
 
     </select>
+
+    <select id="selectSalesLedgerProductTotals" resultType="com.ruoyi.sales.dto.SalesLedgerProductTotalsDto">
+        SELECT
+            slp.sales_ledger_id AS salesLedgerId,
+            COALESCE(SUM(slp.quantity), 0) AS totalQuantity,
+            COALESCE(SUM(COALESCE(slp.settle_total_area, slp.actual_total_area, 0)), 0) AS totalArea
+        FROM sales_ledger_product slp
+        WHERE slp.sales_ledger_id IN
+        <foreach collection="salesLedgerIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <if test="type != null">
+            AND slp.type = #{type}
+        </if>
+        GROUP BY slp.sales_ledger_id
+    </select>
 </mapper>

--
Gitblit v1.9.3