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/sales/SalesLedgerMapper.xml |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/sales/SalesLedgerMapper.xml b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
index 2d6b7f8..95cb482 100644
--- a/src/main/resources/mapper/sales/SalesLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
@@ -13,6 +13,22 @@
 
     </select>
 
+    <!-- 浠e偍閲戦锛氳瀹㈡埛鍏ㄩ儴銆岀被鍨�=浠e偍銆嶅彴璐﹀悎鍚岄噾棰濆悎璁°�傝法瀹㈡埛姹囨�伙紝鍔� /*data_scope*/ 璺宠繃鏁版嵁鏉冮檺锛�
+         鍚﹀垯闈炵鐞嗗憳鐪嬪埌鐨勬槸琚� dept_id 杩囨护杩囩殑閮ㄥ垎閲戦锛屼細鎶娿�屽凡瓒呬俊鎵樺熀閲戙�嶈鍒ゆ垚鏈秴 -->
+    <select id="selectDepositAmountByCustomerIds" resultType="com.ruoyi.sales.dto.CustomerDepositAmountDto">
+        select /*data_scope*/ customer_id as customerId,
+        IFNULL(sum(contract_amount), 0) as depositTotalAmount
+        from sales_ledger
+        where ledger_type = '浠e偍'
+        <if test="customerIds != null and customerIds.size() > 0">
+            and customer_id in
+            <foreach collection="customerIds" item="cid" open="(" separator="," close=")">
+                #{cid}
+            </foreach>
+        </if>
+        group by customer_id
+    </select>
+
     <select id="selectSalesLedgerList" resultType="com.ruoyi.sales.pojo.SalesLedger">
         SELECT
         T1.id,
@@ -23,6 +39,12 @@
         T1.salesman,
         T1.customer_id,
         T1.customer_name,
+        T1.ledger_type,
+        T1.oil_depot_id,
+        T1.oil_depot_name,
+        T1.tank_id,
+        T1.tank_no,
+        T1.approval_status,
         T1.entry_person,
         T1.remarks,
         T1.attachment_materials,
@@ -39,6 +61,12 @@
             <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' ">
                 T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%')
             </if>
+            <if test="salesLedgerDto.ledgerType != null and salesLedgerDto.ledgerType != '' ">
+                AND T1.ledger_type = #{salesLedgerDto.ledgerType}
+            </if>
+            <if test="salesLedgerDto.approvalStatus != null and salesLedgerDto.approvalStatus != '' ">
+                AND T1.approval_status = #{salesLedgerDto.approvalStatus}
+            </if>
         </where>
     </select>
 
@@ -51,6 +79,12 @@
         T1.salesman,
         T1.customer_id,
         T1.customer_name,
+        T1.ledger_type,
+        T1.oil_depot_id,
+        T1.oil_depot_name,
+        T1.tank_id,
+        T1.tank_no,
+        T1.approval_status,
         T1.entry_person,
         T1.remarks,
         T1.attachment_materials,
@@ -95,6 +129,12 @@
             <if test="salesLedgerDto.entryDateEnd != null and salesLedgerDto.entryDateEnd != '' ">
                 AND T1.entry_date &lt;= DATE_FORMAT(#{salesLedgerDto.entryDateEnd},'%Y-%m-%d')
             </if>
+            <if test="salesLedgerDto.ledgerType != null and salesLedgerDto.ledgerType != '' ">
+                AND T1.ledger_type = #{salesLedgerDto.ledgerType}
+            </if>
+            <if test="salesLedgerDto.approvalStatus != null and salesLedgerDto.approvalStatus != '' ">
+                AND T1.approval_status = #{salesLedgerDto.approvalStatus}
+            </if>
         </where>
         order by T1.entry_date desc
     </select>

--
Gitblit v1.9.3