From 5f73eb1fb9d04040fe6ba377d5ae582024429f2f Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期日, 20 九月 2026 14:15:02 +0800
Subject: [PATCH] feat(sales): 添加客户交易详情中的付款金额字段

---
 src/main/resources/mapper/stock/StockInventoryMapper.xml |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index fac5842..0068503 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -122,6 +122,13 @@
         product_id,
         'combined' as stockType,
         (
+        select sir.tank_no
+        from stock_in_record sir
+        where sir.product_model_id = combined.product_model_id
+        order by sir.id desc
+        limit 1
+        ) as tank_no,
+        (
         select sir.oil_product
         from stock_in_record sir
         where sir.product_model_id = combined.product_model_id
@@ -336,7 +343,15 @@
             unit,
             product_name,
             product_id,
-            'combined' as stockType
+            'combined' as stockType,
+            (
+            select sir.tank_no
+            from stock_in_record sir
+            where sir.product_model_id = combined.product_model_id
+            and (sir.batch_no = combined.batch_no or (combined.batch_no is null and sir.batch_no is null))
+            order by sir.id desc
+            limit 1
+            ) as tank_no
         from (
             select
             si.batch_no,
@@ -1126,7 +1141,7 @@
         product_name,
         product_id
         order by
-        batch_no
+        MAX(update_time) desc
     </select>
 
 </mapper>

--
Gitblit v1.9.3