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 | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/sales/SalesLedgerMapper.xml b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
index 712fd9b..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,11 +79,18 @@
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,
T1.tenant_id,
T1.contract_amount,
+ T1.net_contract_amount,
T1.contract_amount AS noInvoiceAmountTotal,
T1.execution_date,
T2.nick_name AS entry_person_name,
@@ -93,6 +128,12 @@
</if>
<if test="salesLedgerDto.entryDateEnd != null and salesLedgerDto.entryDateEnd != '' ">
AND T1.entry_date <= 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
@@ -137,7 +178,7 @@
and c.customer_name like concat('%',#{customerName},'%')
</if>
</where>
- order by sl.create_time desc
+ order by sl.entry_date desc
</select>
</mapper>
--
Gitblit v1.9.3