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/purchase/AccountPurchasePaymentMapper.xml |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml b/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
index 380548e..77e07c5 100644
--- a/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
+++ b/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
@@ -24,10 +24,12 @@
                sm.supplier_name,
                sm.bank_account_num,
                sm.bank_account_name,
-               apa.invoice_application_no AS invoiceApplicationNo
+               apa.invoice_application_no AS invoiceApplicationNo,
+               if(asd.receipt_number is not null, true, false) as isAccountStatemen
         from account_purchase_payment app
         left join supplier_manage sm on app.supplier_id = sm.id
         left join account_payment_application apa on app.account_payment_application_id=apa.id
+        left join account_statement_details asd on app.payment_number = asd.receipt_number
          <where>
             <if test="req.supplierId != null">
                  AND app.supplier_id = #{req.supplierId}
@@ -42,6 +44,7 @@
                 AND app.payment_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
+        order by app.id desc
     </select>
     <select id="selectPayment" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
         SELECT DATE_FORMAT(payment_date, #{dateFormat}) AS dateStr,
@@ -51,5 +54,13 @@
         GROUP BY dateStr
         ORDER BY dateStr
     </select>
+    <select id="selectStockInRecordIdsByPurchaseLedgerId" resultType="java.lang.Long">
+        SELECT sir.id
+        FROM stock_in_record sir
+        LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id
+        WHERE sir.approval_status = 1
+          AND sir.record_type IN ('7','10')
+          AND IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id) = #{purchaseLedgerId}
+    </select>
 
 </mapper>

--
Gitblit v1.9.3