From d5e4005d30bb2b6116cbb0e44da2c54b8ab88708 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期五, 22 五月 2026 10:42:21 +0800
Subject: [PATCH] fix(stock): 修复库存查询中多余的字符导致SQL语法错误
---
src/main/resources/mapper/stock/StockInRecordMapper.xml | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/stock/StockInRecordMapper.xml b/src/main/resources/mapper/stock/StockInRecordMapper.xml
index 2327375..5545c1e 100644
--- a/src/main/resources/mapper/stock/StockInRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -31,6 +31,12 @@
<if test="params.productName != null and params.productName != ''">
and p.product_name like concat('%',#{params.productName},'%')
</if>
+ <if test="params.model != null and params.model != ''">
+ and pm.model like concat('%',#{params.model},'%')
+ </if>
+ <if test="params.batchNo != null and params.batchNo != ''">
+ and sir.batch_no like concat('%',#{params.batchNo},'%')
+ </if>
<if test="params.type != null and params.type != ''">
and sir.type = #{params.type}
</if>
@@ -87,7 +93,7 @@
LEFT JOIN purchase_ledger pl
ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id)
-- 浜у搧鍏宠仈涓嶅姩
- LEFT JOIN sales_ledger_product slp ON pl.id = slp.product_id
+ LEFT JOIN sales_ledger_product slp ON pl.id = slp.sales_ledger_id
LEFT JOIN product_model pm ON sir.product_model_id = pm.id
LEFT JOIN product p ON pm.product_id = p.id
-- 鏉′欢
@@ -96,6 +102,9 @@
<if test="req.inboundBatches != null and req.inboundBatches != ''">
AND sir.inbound_batches LIKE CONCAT('%',#{req.inboundBatches},'%')
</if>
+ <if test="req.supplierId != null">
+ AND pl.supplier_id = #{req.supplierId}
+ </if>
<if test="req.supplierName != null and req.supplierName != ''">
AND pl.supplier_name LIKE CONCAT('%',#{req.supplierName},'%')
</if>
--
Gitblit v1.9.3