From 1c8cd78e9edb730764199e0d943c5143fbb5ff17 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 12 六月 2026 15:29:48 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New_pro

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

diff --git a/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml b/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
index 8b23627..f4d6284 100644
--- a/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
+++ b/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
@@ -44,6 +44,7 @@
                 AND A.apply_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
+        order by A.id desc
     </select>
 
     <select id="getInboundBatchesBySupplier"
@@ -87,12 +88,14 @@
     </select>
 
     <select id="existsByStockInRecordId" resultType="java.lang.Boolean">
-         SELECT COUNT(*) > 0
+        SELECT COUNT(*) > 0
         FROM account_payment_application
-        WHERE  status != 2
-        <foreach collection="stockInRecordIds" item="id" open="(" separator=" OR " close=")">
-            FIND_IN_SET(#{id}, stock_in_record_ids)
-        </foreach>
+        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