From 684e4306a08feeae188070f264148e6765da8dcf Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期日, 20 九月 2026 19:25:15 +0800
Subject: [PATCH] feat(account): 更新往来付款回款流水表及接口

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

diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index 0068503..487000b 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -86,6 +86,48 @@
         </if>
     </select>
 
+    <!-- 鎶ュ簾鍝侀�夋枡锛氬彧鏌ヤ骇鍝佹爲銆屽嵄搴熷缃鐢熷嵄搴熴�嶅ぇ绫伙紙鍚叾鎵�鏈夊瓙鑺傜偣锛変笅鐨勫悎鏍煎簱瀛橈紝甯︽壒鍙枫��
+         澶х被鍚嶆寜涓氬姟鍙e緞鍐欐鍦ㄨ繖閲岋紝鏀瑰彛寰勫彧闇�鏀硅繖涓�澶勩��
+         璇ユ煡璇互 WITH 寮�澶达紝鑰屾暟鎹潈闄愭嫤鎴櫒鍙鐞� select 寮�澶寸殑 SQL锛屽洜姝や笉浼氳拷鍔� dept_id/create_user,
+         涓庛�屽簱瀛樻槸鍏辩敤鍩虹鏁版嵁銆侀�夋枡涓嶅簲鍙楀缓鍗曚汉闄愬埗銆嶇殑鍙e緞涓�鑷达紱淇濈暀 /*data_scope*/ 鏍囪璁╄繖涓剰鍥炬樉寮忓彲璇汇��
+         涓嶅奖鍝嶅師 pagestockInventory -->
+    <select id="selectScrapStockPage" resultType="com.ruoyi.stock.dto.StockInventoryDto">
+        WITH RECURSIVE scrap_product_tree AS (
+            SELECT id
+            FROM product
+            WHERE product_name = '鍗卞簾澶勭疆娆$敓鍗卞簾'
+            UNION ALL
+            SELECT p.id
+            FROM product p
+            INNER JOIN scrap_product_tree t ON p.parent_id = t.id
+        )
+        select /*data_scope*/ si.id,
+        si.product_model_id,
+        si.batch_no,
+        si.qualitity,
+        COALESCE(si.locked_quantity, 0) as locked_quantity,
+        (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity,
+        si.remark,
+        si.version,
+        pm.model,
+        pm.unit,
+        p.product_name
+        from stock_inventory si
+        left join product_model pm on si.product_model_id = pm.id
+        left join product p on pm.product_id = p.id
+        where pm.product_id in (select id from scrap_product_tree)
+        <if test="ew.productModelId != null">
+            and si.product_model_id = #{ew.productModelId}
+        </if>
+        <if test="ew.batchNo != null and ew.batchNo != ''">
+            and si.batch_no like concat('%',#{ew.batchNo},'%')
+        </if>
+        <if test="ew.productName != null and ew.productName != ''">
+            and p.product_name like concat('%',#{ew.productName},'%')
+        </if>
+        order by si.update_time desc
+    </select>
+
     <select id="pageListCombinedStockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto">
         WITH RECURSIVE product_tree AS (
         SELECT id

--
Gitblit v1.9.3