From 2c19f00b211b7ffb1a265d67991d92f2b194b1f5 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 08 六月 2026 11:33:47 +0800
Subject: [PATCH] feat(financial): 新增凭证分录科目明细字段

---
 src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml b/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
index f1f5c5b..f7a6936 100644
--- a/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
+++ b/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
@@ -18,6 +18,7 @@
         <result column="apply_date" property="applyDate" />
         <result column="remark" property="remark" />
         <result column="status" property="status" />
+        <result column="payment_status" property="paymentStatus" />
         <result column="payment_amount" property="paymentAmount" />
     </resultMap>
      <select
@@ -25,7 +26,8 @@
          resultType="com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo">
         select * from (select apa.*,
                sm.supplier_name,
-               GROUP_CONCAT(sir.inbound_batches SEPARATOR ',') AS inboundBatches
+               GROUP_CONCAT(sir.inbound_batches SEPARATOR ',') AS inboundBatches,
+               IFNULL((SELECT SUM(app.payment_amount) FROM account_purchase_payment app WHERE app.account_payment_application_id = apa.id), 0) AS paidAmount
         from account_payment_application apa
         left join supplier_manage sm on apa.supplier_id = sm.id
         left join stock_in_record sir on FIND_IN_SET(sir.id, apa.stock_in_record_ids) > 0
@@ -39,6 +41,9 @@
             </if>
              <if test="req.status != null">
                  AND A.status = #{req.status}
+            </if>
+            <if test="req.paymentStatus != null">
+                 AND A.payment_status = #{req.paymentStatus}
             </if>
             <if test="req.startDate != null and req.endDate != null">
                 AND A.apply_date BETWEEN #{req.startDate} AND #{req.endDate}
@@ -87,12 +92,14 @@
     </select>
 
     <select id="existsByStockInRecordId" resultType="java.lang.Boolean">
-         SELECT COUNT(*) > 0
+        SELECT COUNT(*) > 0
         FROM account_payment_application
-        WHERE
-        <foreach collection="stockInRecordIds" item="id" open="(" separator=" OR " close=")">
-            FIND_IN_SET(#{id}, stock_in_record_ids)
+        WHERE status != 2
+        AND (
+        <foreach collection="stockInRecordIds" item="id" separator=" OR ">
+            FIND_IN_SET(#{id}, stock_in_record_ids) > 0
         </foreach>
+        )
     </select>
 
 </mapper>

--
Gitblit v1.9.3