From f568916d4fc630a6c26a4de74d6a6853d87ef114 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期五, 09 十月 2026 21:01:52 +0800
Subject: [PATCH] feat: 更新查询顺序以首先显示多个服务和映射器中的最新记录

---
 src/main/resources/mapper/production/ProductWorkOrderMapper.xml                |    1 +
 src/main/java/com/ruoyi/sales/service/impl/WeighingRecordServiceImpl.java      |    2 ++
 src/main/resources/mapper/production/ProductionProductInputMapper.xml          |    2 +-
 src/main/resources/mapper/stock/StockOutRecordMapper.xml                       |    2 +-
 src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml |    1 +
 src/main/resources/mapper/purchase/ProductRecordMapper.xml                     |    1 +
 src/main/resources/mapper/sales/ReceiptPaymentMapper.xml                       |    2 +-
 src/main/resources/mapper/stock/StockInventoryMapper.xml                       |    2 ++
 src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java       |    6 +++---
 src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml        |    1 +
 src/main/resources/mapper/sales/SalesQuotationMapper.xml                       |    1 +
 src/main/resources/mapper/sales/ShippingInfoMapper.xml                         |    1 +
 src/main/resources/mapper/stock/StockInRecordMapper.xml                        |    2 +-
 src/main/java/com/ruoyi/account/service/impl/BorrowInfoServiceImpl.java        |    2 ++
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java  |    4 +++-
 src/main/resources/mapper/production/ProductOrderMapper.xml                    |    1 +
 src/main/resources/mapper/production/ProductionProductOutputMapper.xml         |    2 +-
 src/main/resources/mapper/sales/InvoiceLedgerMapper.xml                        |    1 +
 src/main/resources/mapper/production/ProductionProductMainMapper.xml           |    2 +-
 src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml                  |    1 +
 20 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/ruoyi/account/service/impl/BorrowInfoServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/BorrowInfoServiceImpl.java
index 74692c4..5f15209 100644
--- a/src/main/java/com/ruoyi/account/service/impl/BorrowInfoServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/BorrowInfoServiceImpl.java
@@ -56,6 +56,8 @@
                 borrowInfoLambdaQueryWrapper.like(BorrowInfo::getBorrowerName, borrowInfo.getBorrowerName());
             }
         }
+        // 鏈�鏂板�熸鍦ㄥ墠
+        borrowInfoLambdaQueryWrapper.orderByDesc(BorrowInfo::getCreateTime);
         return AjaxResult.success(borrowInfoMapper.selectPage(page, borrowInfoLambdaQueryWrapper));
     }
 
diff --git a/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java
index d89119f..ae61afa 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java
@@ -405,7 +405,7 @@
         QueryWrapper<InvoiceRegistrationProduct> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId());
         queryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId());
-        queryWrapper.orderByAsc("create_time");
+        queryWrapper.orderByDesc("create_time");
         List<InvoiceRegistrationProduct> allList = invoiceRegistrationProductMapper.selectList(queryWrapper);
 
         int index = -1;
@@ -435,7 +435,7 @@
         QueryWrapper<InvoiceRegistrationProduct> newQueryWrapper = new QueryWrapper<>();
         newQueryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId());
         newQueryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId());
-        newQueryWrapper.orderByAsc("create_time");
+        newQueryWrapper.orderByDesc("create_time");
         List<InvoiceRegistrationProduct> remainList = invoiceRegistrationProductMapper.selectList(newQueryWrapper);
 
         // 鏌ヨ閿�鍞彴璐︿骇鍝�
@@ -467,7 +467,7 @@
         QueryWrapper<InvoiceRegistrationProduct> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId());
         queryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId());
-        queryWrapper.orderByAsc("create_time");
+        queryWrapper.orderByDesc("create_time");
         List<InvoiceRegistrationProduct> list = invoiceRegistrationProductMapper.selectList(queryWrapper);
 
         if (CollectionUtils.isEmpty(list)) {
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
index c21e1ae..ee212ff 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -125,8 +125,10 @@
                     } else {
                         item.setShippingStatus("宸插彂璐�");
                     }
+                } else {
+                    // 娌℃湁浠讳綍纾呭崟 鈫� 鏈彂璐�
+                    item.setShippingStatus("鏈彂璐�");
                 }
-                item.setShippingStatus("鏈彂璐�");
             });
             // 寮�绁�
             InvoiceRegistrationProductDto invoiceRegistrationProductDto = new InvoiceRegistrationProductDto();
diff --git a/src/main/java/com/ruoyi/sales/service/impl/WeighingRecordServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/WeighingRecordServiceImpl.java
index b909f95..4859cdc 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/WeighingRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/WeighingRecordServiceImpl.java
@@ -53,6 +53,8 @@
         // 鍙戣揣鍗曚綅锛堢簿纭煡璇紝鍙�夛級
         queryWrapper.eq(StringUtils.isNotBlank(weighingRecord.getShipUnit()),
                 WeighingRecord::getShipUnit, weighingRecord.getShipUnit());
+        // 鏈�鏂拌繃纾呭湪鍓�
+        queryWrapper.orderByDesc(WeighingRecord::getCreateTime);
         return weighingRecordMapper.selectPage(page, queryWrapper);
     }
 
diff --git a/src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml b/src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml
index fbaa3e3..58d2ba4 100644
--- a/src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml
@@ -12,5 +12,6 @@
                 and supplier_name like concat('%',#{req.supplierName},'%')
             </if>
         </where>
+        order by create_time desc, id desc
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/production/ProductOrderMapper.xml b/src/main/resources/mapper/production/ProductOrderMapper.xml
index 6b993bf..2a0e356 100644
--- a/src/main/resources/mapper/production/ProductOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductOrderMapper.xml
@@ -64,6 +64,7 @@
                 and po.create_time between #{c.startTime} and #{c.endTime}
             </if>
         </where>
+        order by po.create_time desc, po.id desc
     </select>
     <select id="listProcessRoute" resultType="com.ruoyi.production.pojo.ProcessRoute">
         select pr.*
diff --git a/src/main/resources/mapper/production/ProductWorkOrderMapper.xml b/src/main/resources/mapper/production/ProductWorkOrderMapper.xml
index 14b883e..ee2212e 100644
--- a/src/main/resources/mapper/production/ProductWorkOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductWorkOrderMapper.xml
@@ -48,6 +48,7 @@
             <if test="c.productOrderId != null and c.productOrderId != ''">
                and pwo.product_order_id = #{c.productOrderId}
             </if>
+            order by pwo.create_time desc, pwo.id desc
     </select>
     <select id="getProductWorkOrderFlowCard" resultType="com.ruoyi.production.dto.ProductWorkOrderDto">
         SELECT
diff --git a/src/main/resources/mapper/production/ProductionProductInputMapper.xml b/src/main/resources/mapper/production/ProductionProductInputMapper.xml
index 65e2b96..08db147 100644
--- a/src/main/resources/mapper/production/ProductionProductInputMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductInputMapper.xml
@@ -26,7 +26,7 @@
                 and ppm.id = #{c.productMainId}
             </if>
         </where>
-        order by ppi.id
+        order by ppi.create_time desc, ppi.id desc
     </select>
 
     <delete id="deleteByProductMainIds" parameterType="java.util.List">
diff --git a/src/main/resources/mapper/production/ProductionProductMainMapper.xml b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
index 4e482f2..ff9fda8 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -47,7 +47,7 @@
                 and ppm.status = #{c.status}
             </if>
         </where>
-        order by ppm.id
+        order by ppm.create_time desc, ppm.id desc
 
     </select>
     <select id="getOrderByMainId" resultType="com.ruoyi.production.pojo.ProductOrder">
diff --git a/src/main/resources/mapper/production/ProductionProductOutputMapper.xml b/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
index 3b44135..e01df32 100644
--- a/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
@@ -24,7 +24,7 @@
                 and ppm.id = #{c.productMainId}
             </if>
         </where>
-        order by ppo.id
+        order by ppo.create_time desc, ppo.id desc
     </select>
 
     <delete id="deleteByProductMainIds" parameterType="java.util.List">
diff --git a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
index fc27323..fb470e5 100644
--- a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
+++ b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
@@ -84,6 +84,7 @@
             </if>
         </where>
         GROUP BY slpa.scheduling_user_id, slpa.scheduling_user_name
+        order by slpa.scheduling_date desc, slpa.id desc
     </select>
 
     <select id="selectDailyWagesStats" resultType="java.util.Map">
diff --git a/src/main/resources/mapper/purchase/ProductRecordMapper.xml b/src/main/resources/mapper/purchase/ProductRecordMapper.xml
index aa850cb..4045c72 100644
--- a/src/main/resources/mapper/purchase/ProductRecordMapper.xml
+++ b/src/main/resources/mapper/purchase/ProductRecordMapper.xml
@@ -42,6 +42,7 @@
         <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''">
             and tr.purchase_contract_number like concat('%',#{c.purchaseContractNumber},'%')
         </if>
+        ORDER BY pr.created_at DESC, pr.id DESC
     </select>
     <select id="getProductRecordById" resultType="com.ruoyi.purchase.dto.ProductRecordDto">
         SELECT
diff --git a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
index 150f817..b4c3f98 100644
--- a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
@@ -43,6 +43,7 @@
                 AND DATE_FORMAT(T1.invoice_date,'%Y-%m-%d') = DATE_FORMAT(#{invoiceLedgerDto.invoiceDate},'%Y-%m-%d')
             </if>
         </where>
+        ORDER BY T1.invoice_date DESC, T1.id DESC
     </select>
 
     <select id="invoiceLedgerList" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
diff --git a/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml b/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml
index 9edbea4..609b6ec 100644
--- a/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml
+++ b/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml
@@ -32,6 +32,7 @@
             GROUP BY
                 invoice_registration_id
         ) T4 ON T1.id = T4.invoice_registration_id
+    ORDER BY T1.create_time DESC, T1.id DESC
     </select>
 
     <select id="invoiceRegisAndProductExcelDtoList" resultType="com.ruoyi.sales.excel.InvoiceRegisAndProductExcelDto">
diff --git a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
index 33268ed..9ec8ba9 100644
--- a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
+++ b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
@@ -29,7 +29,7 @@
                 AND T4.customer_id = #{receiptPaymentDto.customerId}
             </if>
         </where>
-        ORDER BY T1.create_time ASC
+        ORDER BY T1.create_time DESC, T1.id DESC
     </select>
 
     <select id="receiptPaymentInfo" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
diff --git a/src/main/resources/mapper/sales/SalesQuotationMapper.xml b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
index 1e358ca..10157c6 100644
--- a/src/main/resources/mapper/sales/SalesQuotationMapper.xml
+++ b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
@@ -18,5 +18,6 @@
         <if test="salesQuotationDto.status != null and salesQuotationDto.status != '' ">
             AND t1.status = #{salesQuotationDto.status}
         </if>
+        order by t1.create_time desc, t1.id desc
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/ShippingInfoMapper.xml b/src/main/resources/mapper/sales/ShippingInfoMapper.xml
index 82c67b2..cc4240e 100644
--- a/src/main/resources/mapper/sales/ShippingInfoMapper.xml
+++ b/src/main/resources/mapper/sales/ShippingInfoMapper.xml
@@ -57,6 +57,7 @@
             sl.customer_name
         FROM shipping_info s
                  LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
+        order by s.create_time desc, s.id desc
     </select>
     <select id="getReturnManagementDtoById" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto">
         SELECT
diff --git a/src/main/resources/mapper/stock/StockInRecordMapper.xml b/src/main/resources/mapper/stock/StockInRecordMapper.xml
index d5c3f38..81348f5 100644
--- a/src/main/resources/mapper/stock/StockInRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -27,7 +27,7 @@
                 and sir.record_type = #{params.recordType}
             </if>
         </where>
-        order by sir.id desc
+        order by sir.create_time desc, sir.id desc
     </select>
     <select id="listStockInRecordExportData" resultType="com.ruoyi.stock.execl.StockInRecordExportData">
         SELECT
diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index 9db56f9..949d24d 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -72,6 +72,7 @@
         <if test="ew.productName != null and ew.productName !=''">
             and p.product_name like concat('%',#{ew.productName},'%')
         </if>
+        order by si.update_time desc, si.id desc
     </select>
     <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
         select si.qualitity,
@@ -114,6 +115,7 @@
                 and sir.create_time &lt;= #{ew.endMonth}
             </if>
         </where>
+        order by sir.update_time desc, sir.id desc
     </select>
 
     <select id="stockInAndOutRecord" resultType="com.ruoyi.stock.dto.StockInventoryDto">
diff --git a/src/main/resources/mapper/stock/StockOutRecordMapper.xml b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
index a441de9..65c3116 100644
--- a/src/main/resources/mapper/stock/StockOutRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
@@ -42,7 +42,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="listStockOutRecordExportData" resultType="com.ruoyi.stock.execl.StockOutRecordExportData">
         SELECT

--
Gitblit v1.9.3