From a9e96fd58f95a5e1c40628afa2f6f5961d0ad0d2 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 25 五月 2026 17:38:11 +0800
Subject: [PATCH] refactor(approve): 优化部门列表查询逻辑

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

diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index d824291..4d8aece 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -11,6 +11,7 @@
         T1.warn_num,
         T1.quantity,
         T1.single_quantity,
+        T1.total_quantity,
         T1.min_stock,
         T1.tax_rate,
         T1.tax_inclusive_unit_price,
@@ -34,10 +35,10 @@
         WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >0 THEN 1
         ELSE 0
         END as has_sufficient_stock,
-        (IFNULL(T1.quantity, 0) * IFNULL(NULLIF(T1.single_quantity, 0), 1) - IFNULL(t3.shipped_quantity, 0)) as no_quantity,
+        (IFNULL(NULLIF(T1.total_quantity, 0), IFNULL(T1.quantity, 0) * IFNULL(NULLIF(T1.single_quantity, 0), 1)) - IFNULL(t3.shipped_quantity, 0)) as no_quantity,
         CASE
          WHEN IFNULL(t3.shipped_quantity, 0) = 0 THEN '寰呭彂璐�'
-         WHEN (IFNULL(T1.quantity, 0) * IFNULL(NULLIF(T1.single_quantity, 0), 1) - IFNULL(t3.shipped_quantity, 0)) > 0 THEN '閮ㄥ垎鍙戣揣'
+         WHEN (IFNULL(NULLIF(T1.total_quantity, 0), IFNULL(T1.quantity, 0) * IFNULL(NULLIF(T1.single_quantity, 0), 1)) - IFNULL(t3.shipped_quantity, 0)) > 0 THEN '閮ㄥ垎鍙戣揣'
         ELSE '宸插彂璐�'
         END as shippingStatus,
         CASE

--
Gitblit v1.9.3