From 737bbdc3acf3796f162592e6dc804d26a7d6c0f4 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 28 十月 2026 19:40:31 +0800
Subject: [PATCH] fix(list): 各业务台账列表按业务日期倒序排列

---
 src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml          |    2 +-
 src/main/resources/mapper/account/AccountStatementMapper.xml                   |    2 +-
 src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml |    2 +-
 src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml    |    2 +-
 src/main/resources/mapper/stock/StockOutRecordMapper.xml                       |    6 +++---
 src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml       |    2 +-
 src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml    |    2 +-
 src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml    |    2 +-
 src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml            |    2 +-
 9 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/main/resources/mapper/account/AccountStatementMapper.xml b/src/main/resources/mapper/account/AccountStatementMapper.xml
index bb8cab8..7bf3452 100644
--- a/src/main/resources/mapper/account/AccountStatementMapper.xml
+++ b/src/main/resources/mapper/account/AccountStatementMapper.xml
@@ -43,7 +43,7 @@
                       AND lj.statement_month BETWEEN DATE_FORMAT(#{req.startDate}, '%Y-%m') AND DATE_FORMAT(#{req.endDate}, '%Y-%m'))
                   )
             </if>
-    ORDER BY lj.statement_month DESC
+    ORDER BY lj.statement_month DESC, lj.id DESC
     </select>
     <select id="selectVatDtoPage" resultType="com.ruoyi.purchase.dto.VatDto">
     SELECT
diff --git a/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml b/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
index f4d6284..3764b11 100644
--- a/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
+++ b/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
@@ -44,7 +44,7 @@
                 AND A.apply_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
-        order by A.id desc
+        order by A.apply_date desc, A.id desc
     </select>
 
     <select id="getInboundBatchesBySupplier"
diff --git a/src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml b/src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml
index a164b5c..8cc088a 100644
--- a/src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml
+++ b/src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml
@@ -42,7 +42,7 @@
                 AND api.issue_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
-        order by api.id desc
+        order by api.issue_date desc, api.id desc
     </select>
     <select id="getInboundBatchesBySupplier"
             resultType="com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo">
diff --git a/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml b/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
index ed247e5..0610603 100644
--- a/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
+++ b/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
@@ -44,7 +44,7 @@
                 AND app.payment_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
-        order by app.id desc
+        order by app.payment_date desc, app.id desc
     </select>
     <select id="selectPayment" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
         SELECT DATE_FORMAT(payment_date, #{dateFormat}) AS dateStr,
diff --git a/src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml b/src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml
index 4121614..c79da14 100644
--- a/src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml
+++ b/src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml
@@ -25,7 +25,7 @@
                 AND A.apply_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
-        order by A.id desc
+        order by A.apply_date desc, A.id desc
     </select>
     <select id="getOutboundBatchesByCustomer"
             resultType="com.ruoyi.account.bean.vo.sales.SalesOutboundVo">
diff --git a/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml b/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
index 6a35890..e99d781 100644
--- a/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
+++ b/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
@@ -45,7 +45,7 @@
                 AND A.collection_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
-        order by A.id desc
+        order by A.collection_date desc, A.id desc
     </select>
     <select id="existsByStockOutRecordId" resultType="java.lang.Boolean">
         SELECT COUNT(*) > 0
diff --git a/src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml b/src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml
index e69d79d..1ebea04 100644
--- a/src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml
+++ b/src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml
@@ -42,7 +42,7 @@
                 AND asi.issue_date BETWEEN #{req.startDate} AND #{req.endDate}
             </if>
         </where>
-        order by asi.id desc
+        order by asi.issue_date desc, asi.id desc
     </select>
 
 </mapper>
diff --git a/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml b/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
index 4a15bbf..1d15702 100644
--- a/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
+++ b/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
@@ -39,7 +39,7 @@
             and personal_attendance_records.date &gt;= #{params.date}
             and personal_attendance_records.date &lt; DATE_ADD(DATE(#{params.date}), INTERVAL 1 DAY)
         </if>
-        order by personal_attendance_records.id desc
+        order by personal_attendance_records.date desc, personal_attendance_records.id desc
     </select>
 
     <!-- 鏌ヨ鎸囧畾鏃ユ湡鏈夋帓鐝紙闈炶鍋囷級浣嗘病鏈夎�冨嫟璁板綍鐨勫湪鑱屽憳宸ワ紝娌℃帓鐝涓轰紤鎭笉鏍囪缂哄嫟 -->
diff --git a/src/main/resources/mapper/stock/StockOutRecordMapper.xml b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
index f197fa2..9ea5d3a 100644
--- a/src/main/resources/mapper/stock/StockOutRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
@@ -62,7 +62,7 @@
                 and p.id in (select id from product_tree)
             </if>
         </where>
-        order by sor.id desc
+        order by sor.create_time desc, sor.id desc
     </select>
     <select id="listStockOutRecordExportData" resultType="com.ruoyi.stock.execl.StockOutRecordExportData">
         SELECT
@@ -89,7 +89,7 @@
                 and sor.record_type = #{params.recordType}
             </if>
         </where>
-        order by sor.id desc
+        order by sor.create_time desc, sor.id desc
     </select>
 
     <select id="listPageAccountSales" resultType="com.ruoyi.account.bean.vo.sales.SalesOutboundVo">
@@ -123,6 +123,6 @@
         <if test="req.startDate != null and req.endDate != null">
             AND DATE(s.shipping_date) BETWEEN #{req.startDate} AND #{req.endDate}
         </if>
-        order by sor.id DESC
+        order by s.shipping_date desc, sor.id desc
     </select>
 </mapper>

--
Gitblit v1.9.3