From 4ea1509f0e88ee331e821459d4eefb0c9902b3e7 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 12 八月 2026 13:16:04 +0800
Subject: [PATCH] feat(account): 实现采购付款和销售回款功能

---
 src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml b/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
index c3d6b00..66ae5e4 100644
--- a/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
+++ b/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
@@ -20,13 +20,17 @@
     </resultMap>
     <select id="listPageAccountSalesCollection"
             resultType="com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo">
-       select * from (select ascc.*,
+       select
+           A.* ,
+           if(asd.receipt_number is not null, true, false) as isAccountStatemen
+       from (select ascc.*,
                c.customer_name,
                GROUP_CONCAT(sour.outbound_batches SEPARATOR ',') AS outboundBatches
         from account_sales_collection ascc
         left join customer c on ascc.customer_id = c.id
         left join stock_out_record sour on FIND_IN_SET(sour.id, ascc.stock_out_record_ids) > 0
         GROUP BY ascc.id)A
+       left join account_statement_details asd on A.collection_number = asd.receipt_number
          <where>
             <if test="req.customerId != null">
                  AND A.customer_id = #{req.customerId}
@@ -41,7 +45,7 @@
                 AND A.collection_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
-
+        order by A.id desc
     </select>
     <select id="existsByStockOutRecordId" resultType="java.lang.Boolean">
         SELECT COUNT(*) > 0
@@ -93,5 +97,13 @@
          GROUP BY dateStr
          ORDER BY dateStr
     </select>
+    <select id="selectStockOutRecordIdsBySalesLedgerId" resultType="java.lang.Long">
+        SELECT sor.id
+        FROM stock_out_record sor
+        JOIN shipping_info s ON sor.record_id = s.id
+        WHERE s.sales_ledger_id = #{salesLedgerId}
+          AND sor.record_type = '13'
+          AND sor.approval_status = 1
+    </select>
 
 </mapper>

--
Gitblit v1.9.3