From 7dfff767d0fae788ba2bf67a707ce41836bd0f42 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 13 十月 2026 14:03:35 +0800
Subject: [PATCH] fix: 优化客户往来查询逻辑,调整应收金额计算方式以避免尾差问题

---
 src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml b/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
index a0a0a2d..30abc5b 100644
--- a/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
+++ b/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
@@ -71,6 +71,7 @@
                                 AND sir.record_id = slp.sales_ledger_id
                                 AND (
                                     (sir.batch_no IS NOT NULL AND sir.batch_no LIKE CONCAT('%-', slp.id))
+                                    OR (sir.batch_no IS NOT NULL AND sir.batch_no LIKE CONCAT('%-', slp.product_model_id, '-%'))
                                     OR (sir.batch_no IS NULL AND sir.product_model_id = slp.product_model_id)
                                 )
                             WHERE sir.approval_status = 1

--
Gitblit v1.9.3