From 7aad06fedc12f0183734088fa44c929ac6ff42b3 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 10 十月 2026 11:54:01 +0800
Subject: [PATCH] feat: 增加多个查询的排序功能以优化数据检索

---
 src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java               |    5 +
 src/main/resources/mapper/account/AccountExpenseMapper.xml                                |    5 
 src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml            |    8 
 src/main/resources/mapper/sales/ReceiptPaymentMapper.xml                                  |   11 +-
 src/main/resources/mapper/production/ProductOrderMapper.xml                               |    1 
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml                              |    4 
 src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml                  |    1 
 src/main/resources/mapper/staff/StaffOnJobMapper.xml                                      |    1 
 src/main/resources/mapper/sales/InvoiceLedgerMapper.xml                                   |    6 
 src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml                             |    3 
 src/main/resources/mapper/staff/StaffContractMapper.xml                                   |    1 
 src/main/resources/mapper/sales/ShipmentApprovalMapper.xml                                |    7 +
 src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml                    |    1 
 src/main/resources/mapper/production/SalesLedgerWorkMapper.xml                            |    4 
 src/main/resources/mapper/account/AccountIncomeMapper.xml                                 |    5 
 src/main/resources/mapper/procurementrecord/CustomStorageMapper.xml                       |   22 ++++
 src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml                   |    1 
 src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml                        |    1 
 src/main/resources/mapper/warehouse/DocumentationMapper.xml                               |    1 
 src/main/resources/mapper/warehouse/WarehouseGoodsShelvesMapper.xml                       |    6 
 src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml                   |  114 +++++++++++-----------
 src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml               |    1 
 src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml                          |   10 +
 src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml                       |    1 
 src/main/resources/mapper/device/DeviceDefectRecordMapper.xml                             |    2 
 src/main/resources/mapper/production/ProductWorkOrderMapper.xml                           |    1 
 src/main/resources/mapper/sales/SalesLedgerMapper.xml                                     |    2 
 src/main/resources/mapper/production/ProductionProductInputMapper.xml                     |    2 
 src/main/resources/mapper/device/DeviceMaintenanceMapper.xml                              |    1 
 src/main/resources/mapper/equipmentenergyconsumption/EquipmentEnergyConsumptionMapper.xml |    5 
 src/main/resources/mapper/basic/SupplierManageMapper.xml                                  |    1 
 src/main/resources/mapper/purchase/ProductRecordMapper.xml                                |    1 
 src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml                            |    1 
 src/main/resources/mapper/officesupplies/OfficeSuppliesMapper.xml                         |    1 
 src/main/resources/mapper/sales/SalesQuotationMapper.xml                                  |    1 
 src/main/resources/mapper/approve/NotificationManagementMapper.xml                        |    1 
 src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml       |    6 
 src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml                          |    1 
 src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml      |    1 
 src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml                         |    1 
 src/main/resources/mapper/production/ProductionProductOutputMapper.xml                    |    2 
 src/main/resources/mapper/waterrecord/WaterRecordMapper.xml                               |    1 
 src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml                      |    5 
 src/main/resources/mapper/lavorissue/LavorIssueMapper.xml                                 |    1 
 src/main/resources/mapper/staff/StaffLeaveMapper.xml                                      |    1 
 src/main/resources/mapper/sales/ShippingInfoMapper.xml                                    |    1 
 src/main/resources/mapper/approve/ApproveProcessMapper.xml                                |    1 
 src/main/resources/mapper/approve/KnowledgeBaseMapper.xml                                 |    2 
 src/main/resources/mapper/oA/OaProjectMapper.xml                                          |    1 
 src/main/java/com/ruoyi/collaborativeApproval/service/impl/NoticeServiceImpl.java         |    3 
 src/main/resources/mapper/device/DeviceRepairMapper.xml                                   |    1 
 src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml               |    1 
 src/main/resources/mapper/production/ProductionProductMainMapper.xml                      |    2 
 src/main/resources/mapper/collaborativeApproval/StaffContactsPersonalMapper.xml           |    4 
 54 files changed, 171 insertions(+), 103 deletions(-)

diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/NoticeServiceImpl.java b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/NoticeServiceImpl.java
index 1cdd838..47b3359 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/NoticeServiceImpl.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/NoticeServiceImpl.java
@@ -42,7 +42,8 @@
 
     @Override
     public List<NoticeDTO> selectCount() {
-        List<Notice> notices = noticeMapper.selectList(Wrappers.lambdaQuery(Notice.class).groupBy(Notice::getType));
+        // 鍙煡 type 涓�鍒楀苟鎸夊叾鍒嗙粍锛堝師鍐欐硶 selectList+groupBy 浼氬甫鍑哄叏閮ㄥ垪锛屽湪 ONLY_FULL_GROUP_BY 涓嬫姤 1055锛�
+        List<Notice> notices = noticeMapper.selectList(Wrappers.lambdaQuery(Notice.class).select(Notice::getType).groupBy(Notice::getType));
         List<NoticeDTO> result = new ArrayList<>();
         for (Notice notice : notices) {
             NoticeDTO notice1 = new NoticeDTO();
diff --git a/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java b/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
index 8a1e066..ee4f455 100644
--- a/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
+++ b/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
@@ -10,6 +10,7 @@
 import com.deepoove.poi.config.Configure;
 import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
 import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
+import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.HackLoopTableRenderPolicy;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.procurementrecord.service.ProcurementRecordService;
@@ -33,6 +34,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URLEncoder;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -129,6 +131,9 @@
         InputStream inputStream = this.getClass().getResourceAsStream("/static/report-template.docx");
         Configure configure = Configure.builder()
                 .bind("paramList", new HackLoopTableRenderPolicy())
+                //鏃ユ湡榛樿鎸塂ate.toString()娓叉煋(濡係un Sep 27 00:00:00 CST 2026)锛岃繖閲岀粺涓�鏍煎紡鍖栦负yyyy-MM-dd
+                .addPreRenderDataCastor((policy, data) -> data instanceof Date
+                        ? DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, (Date) data) : data)
                 .build();
         String finalInspectType = inspectType;
         XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render(
diff --git a/src/main/resources/mapper/account/AccountExpenseMapper.xml b/src/main/resources/mapper/account/AccountExpenseMapper.xml
index 1a8d34b..f51d76e 100644
--- a/src/main/resources/mapper/account/AccountExpenseMapper.xml
+++ b/src/main/resources/mapper/account/AccountExpenseMapper.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+锘�<?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.ruoyi.account.mapper.AccountExpenseMapper">
     <select id="accountExpenseListPage" resultType="com.ruoyi.account.pojo.AccountExpense">
@@ -19,6 +19,7 @@
         <if test="accountExpense.expenseMethod != null and accountExpense.expenseMethod != '' ">
             AND expense_method = #{accountExpense.expenseMethod}
         </if>
+        ORDER BY expense_date DESC, id DESC
     </select>
     <select id="accountExpenseExport" resultType="com.ruoyi.account.pojo.AccountExpense">
         SELECT
@@ -53,7 +54,7 @@
         <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
             AND expense_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
         </if>
-        group by expense_type
+        group by expense_type, sdd.dict_label
     </select>
 
     <select id="report1" resultType="java.math.BigDecimal">
diff --git a/src/main/resources/mapper/account/AccountIncomeMapper.xml b/src/main/resources/mapper/account/AccountIncomeMapper.xml
index e4f3361..0bb40eb 100644
--- a/src/main/resources/mapper/account/AccountIncomeMapper.xml
+++ b/src/main/resources/mapper/account/AccountIncomeMapper.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+锘�<?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.ruoyi.account.mapper.AccountIncomeMapper">
 
@@ -20,6 +20,7 @@
         <if test="accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' ">
             AND income_method = #{accountIncome.incomeMethod}
         </if>
+        ORDER BY income_date DESC, id DESC
     </select>
     <select id="accountIncomeExport" resultType="com.ruoyi.account.pojo.AccountIncome">
         SELECT
@@ -54,7 +55,7 @@
         <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
             AND income_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
         </if>
-        group by income_type
+        group by income_type, sdd.dict_label
     </select>
     <select id="report1" resultType="java.math.BigDecimal">
         SELECT
diff --git a/src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml b/src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml
index a58e90f..f1623c7 100644
--- a/src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml
+++ b/src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml
@@ -37,6 +37,7 @@
                 and rm.return_no like concat('%',#{ew.returnManagementNo},'%')
             </if>
         </where>
+        ORDER BY srao.id DESC
     </select>
 
 </mapper>
diff --git a/src/main/resources/mapper/approve/ApproveProcessMapper.xml b/src/main/resources/mapper/approve/ApproveProcessMapper.xml
index 33b29a9..d400bb4 100644
--- a/src/main/resources/mapper/approve/ApproveProcessMapper.xml
+++ b/src/main/resources/mapper/approve/ApproveProcessMapper.xml
@@ -38,5 +38,6 @@
         <if test="req.approveType != null ">
             and approve_type = #{req.approveType}
         </if>
+        ORDER BY approve_time DESC, approve_id DESC
     </select>
 </mapper>
diff --git a/src/main/resources/mapper/approve/KnowledgeBaseMapper.xml b/src/main/resources/mapper/approve/KnowledgeBaseMapper.xml
index e4819c2..08a5bec 100644
--- a/src/main/resources/mapper/approve/KnowledgeBaseMapper.xml
+++ b/src/main/resources/mapper/approve/KnowledgeBaseMapper.xml
@@ -16,6 +16,6 @@
                 and type = #{knowledgeBase.type}
             </if>
         </where>
-
+        ORDER BY create_time DESC, id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/approve/NotificationManagementMapper.xml b/src/main/resources/mapper/approve/NotificationManagementMapper.xml
index a2e714f..2e80826 100644
--- a/src/main/resources/mapper/approve/NotificationManagementMapper.xml
+++ b/src/main/resources/mapper/approve/NotificationManagementMapper.xml
@@ -15,5 +15,6 @@
                 and type = #{notificationManagement.type}
             </if>
         </where>
+        ORDER BY create_time DESC, id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/basic/SupplierManageMapper.xml b/src/main/resources/mapper/basic/SupplierManageMapper.xml
index ba7fac3..eaff2c4 100644
--- a/src/main/resources/mapper/basic/SupplierManageMapper.xml
+++ b/src/main/resources/mapper/basic/SupplierManageMapper.xml
@@ -34,6 +34,7 @@
                 AND T1.is_white = #{supplierManageDto.isWhite}
             </if>
         </where>
+        ORDER BY T1.maintain_time DESC, T1.id DESC
     </select>
 
     <select id="supplierExportList" resultType="com.ruoyi.basic.excel.SupplierManageExcelDto">
diff --git a/src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml b/src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml
index 08cf865..6472631 100644
--- a/src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml
+++ b/src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml
@@ -17,5 +17,6 @@
                 and n.status = #{ew.status}
             </if>
         </where>
+        ORDER BY n.create_time DESC, n.id DESC
     </select>
 </mapper>
diff --git a/src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml b/src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml
index 03dc024..c6cf219 100644
--- a/src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml
+++ b/src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml
@@ -27,5 +27,6 @@
                 and rrm.category = #{ew.category}
             </if>
         </where>
+        ORDER BY rrm.effective_time DESC, rrm.id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml b/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
index 5da6dff..9c03fc7 100644
--- a/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
+++ b/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
@@ -4,13 +4,13 @@
 
 
     <select id="listPage" resultType="com.ruoyi.collaborativeApproval.dto.SealApplicationManagementDTO">
-        select sam.*, su.user_name as create_user_name, d.dept_name as department,
+        select sam.*, su.user_name as create_user_name,
+        (select d.dept_name from sys_user_dept sud join sys_dept d on d.dept_id = sud.dept_id
+          where sud.user_id = su.user_id order by sud.dept_id desc limit 1) as department,
         su1.nick_name as approveUserName
         from seal_application_management sam
         left join sys_user su on sam.create_user = su.user_id
         left join sys_user su1 on sam.approve_user_id = su1.user_id
-        left join sys_user_dept sud on su.user_id = sud.user_id
-        left join sys_dept d on sud.dept_id = d.dept_id
         <where>
             <if test="ew.applicationNum != null and ew.applicationNum != ''">
                 and sam.application_num like concat('%',#{ew.applicationNum},'%')
diff --git a/src/main/resources/mapper/collaborativeApproval/StaffContactsPersonalMapper.xml b/src/main/resources/mapper/collaborativeApproval/StaffContactsPersonalMapper.xml
index 5003a8d..951d824 100644
--- a/src/main/resources/mapper/collaborativeApproval/StaffContactsPersonalMapper.xml
+++ b/src/main/resources/mapper/collaborativeApproval/StaffContactsPersonalMapper.xml
@@ -10,7 +10,7 @@
             sjlr.staff_no,
             sjlr.staff_name,
             sjlr.sex,
-            sjlr.post_job,
+            (SELECT p.post_name FROM sys_post p WHERE p.post_id = sjlr.sys_post_id LIMIT 1) AS post_job,
             sjlr.adress,
             sjlr.profession,
             sjlr.identity_card,
@@ -22,6 +22,6 @@
         <if test="staffContactsPersonalDTO.staffName != null and staffContactsPersonalDTO.staffName != ''">
             and sjlr.staff_name like concat('%',#{staffContactsPersonalDTO.staffName},'%')
         </if>
-
+        ORDER BY scp.create_time DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/device/DeviceDefectRecordMapper.xml b/src/main/resources/mapper/device/DeviceDefectRecordMapper.xml
index bcd4bd5..a2bb747 100644
--- a/src/main/resources/mapper/device/DeviceDefectRecordMapper.xml
+++ b/src/main/resources/mapper/device/DeviceDefectRecordMapper.xml
@@ -21,6 +21,6 @@
                 and ddr.status = #{deviceDefectRecordDto.status}
             </if>
         </where>
-
+        ORDER BY ddr.id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/device/DeviceMaintenanceMapper.xml b/src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
index 2ed16a4..c9ae3eb 100644
--- a/src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
+++ b/src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
@@ -49,6 +49,7 @@
                 and dm.maintenance_actually_time &lt; date_add(str_to_date(#{deviceMaintenanceDto.maintenanceActuallyTime}, '%Y-%m-%d'), interval 1 day)
             </if>
         </where>
+        ORDER BY dm.id DESC
     </select>
     <select id="detailById" resultType="com.ruoyi.device.dto.DeviceMaintenanceDto">
         select dm.id,
diff --git a/src/main/resources/mapper/device/DeviceRepairMapper.xml b/src/main/resources/mapper/device/DeviceRepairMapper.xml
index d093980..27670c5 100644
--- a/src/main/resources/mapper/device/DeviceRepairMapper.xml
+++ b/src/main/resources/mapper/device/DeviceRepairMapper.xml
@@ -49,6 +49,7 @@
                 and dr.maintenance_time like concat('%',#{deviceRepairDto.maintenanceTimeStr},'%')
             </if>
         </where>
+        ORDER BY dr.id DESC
     </select>
     <select id="detailById" resultType="com.ruoyi.device.dto.DeviceRepairDto">
         select dr.id,
diff --git a/src/main/resources/mapper/equipmentenergyconsumption/EquipmentEnergyConsumptionMapper.xml b/src/main/resources/mapper/equipmentenergyconsumption/EquipmentEnergyConsumptionMapper.xml
index eda1827..d8940a8 100644
--- a/src/main/resources/mapper/equipmentenergyconsumption/EquipmentEnergyConsumptionMapper.xml
+++ b/src/main/resources/mapper/equipmentenergyconsumption/EquipmentEnergyConsumptionMapper.xml
@@ -8,6 +8,7 @@
         <if test="req.name != null and req.name != ''">
             and `name` like concat('%',#{req.name},'%')
         </if>
+        ORDER BY run_date DESC, id DESC
     </select>
     <select id="listPageByTrend" resultType="com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption">
         SELECT
@@ -20,9 +21,7 @@
         <if test="req.name != null and req.name != ''">
             and `name` like concat('%',#{req.name},'%')
         </if>
-        GROUP BY
-            `code`
         ORDER BY
-            update_time DESC;
+            update_time DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/lavorissue/LavorIssueMapper.xml b/src/main/resources/mapper/lavorissue/LavorIssueMapper.xml
index 5d447e1..4c861fb 100644
--- a/src/main/resources/mapper/lavorissue/LavorIssueMapper.xml
+++ b/src/main/resources/mapper/lavorissue/LavorIssueMapper.xml
@@ -36,6 +36,7 @@
                 and t1.adopted_date is null and t1.issue_date &lt; current_date()
             </if>
         </where>
+        ORDER BY t1.Issue_date DESC, t1.id DESC
     </select>
     <select id="list" resultType="com.ruoyi.lavorissue.pojo.LaborIssue">
         select
diff --git a/src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml
index 611d51e..312321e 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml
@@ -10,5 +10,6 @@
                 and sp.name like concat('%',#{spareParts.name},'%')
             </if>
         </where>
+        ORDER BY id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/oA/OaProjectMapper.xml b/src/main/resources/mapper/oA/OaProjectMapper.xml
index c245a39..61f8eae 100644
--- a/src/main/resources/mapper/oA/OaProjectMapper.xml
+++ b/src/main/resources/mapper/oA/OaProjectMapper.xml
@@ -20,6 +20,7 @@
                 and op.status = #{req.status}
             </if>
         </where>
+        ORDER BY op.start_date DESC, op.project_id DESC
     </select>
     <select id="selectByIds" resultType="com.ruoyi.oA.dto.OaProjectDto">
         select op.*,su.nick_name as managerName from oa_project op
diff --git a/src/main/resources/mapper/officesupplies/OfficeSuppliesMapper.xml b/src/main/resources/mapper/officesupplies/OfficeSuppliesMapper.xml
index 7191aa9..1aa4bce 100644
--- a/src/main/resources/mapper/officesupplies/OfficeSuppliesMapper.xml
+++ b/src/main/resources/mapper/officesupplies/OfficeSuppliesMapper.xml
@@ -15,5 +15,6 @@
                 and status = #{req.status}
             </if>
         </where>
+        ORDER BY apply_time DESC, id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/procurementrecord/CustomStorageMapper.xml b/src/main/resources/mapper/procurementrecord/CustomStorageMapper.xml
index ba0e289..8ee0ad8 100644
--- a/src/main/resources/mapper/procurementrecord/CustomStorageMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/CustomStorageMapper.xml
@@ -3,7 +3,25 @@
 <mapper namespace="com.ruoyi.procurementrecord.mapper.CustomStorageMapper">
 
     <select id="listPageCopyByCustom" resultType="com.ruoyi.procurementrecord.pojo.CustomStorage">
-        select t1.*,
+        select ANY_VALUE(t1.id) as id,
+               t1.product_category,
+               t1.specification_model,
+               t1.tax_inclusive_unit_price,
+               ANY_VALUE(t1.item_type) as item_type,
+               ANY_VALUE(t1.inbound_date) as inbound_date,
+               ANY_VALUE(t1.inbound_batches) as inbound_batches,
+               ANY_VALUE(t1.supplier_name) as supplier_name,
+               ANY_VALUE(t1.unit) as unit,
+               ANY_VALUE(t1.tax_inclusive_total_price) as tax_inclusive_total_price,
+               ANY_VALUE(t1.tax_rate) as tax_rate,
+               ANY_VALUE(t1.tax_exclusive_total_price) as tax_exclusive_total_price,
+               ANY_VALUE(t1.create_by) as create_by,
+               ANY_VALUE(t1.create_time) as create_time,
+               ANY_VALUE(t1.update_time) as update_time,
+               ANY_VALUE(t1.create_user) as create_user,
+               ANY_VALUE(t1.update_user) as update_user,
+               ANY_VALUE(t1.tenant_id) as tenant_id,
+               ANY_VALUE(t1.code) as code,
                sum(t1.inbound_num) as inboundNum,
                sum(t1.inbound_num) as inboundNum0,
                sum(t1.tax_inclusive_total_price) as taxInclusiveTotalPrice,
@@ -23,6 +41,6 @@
         </where>
         group by t1.product_category, t1.specification_model, t1.tax_inclusive_unit_price
         HAVING availableStock > 0
-        order by t1.inbound_date desc
+        order by ANY_VALUE(t1.inbound_date) desc
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml b/src/main/resources/mapper/procurementrecord/InboundManagementMapper.xml
index fbaa3e3..7c44463 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 id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml b/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
index b0166ca..c90cff2 100644
--- a/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
@@ -4,10 +4,10 @@
 
     <select id="listProcurementBySalesLedgerId" resultType="com.ruoyi.procurementrecord.dto.ProcurementDto">
         select
-            t1.supplier_name,
+            ANY_VALUE(t1.supplier_name) as supplier_name,
             t2.product_category,
             t2.id,
-            t3.id as recordId,
+            ANY_VALUE(t3.id) as recordId,
             t2.specification_model,
             t2.unit,
             t2.quantity,
@@ -18,9 +18,9 @@
             t2.tax_inclusive_unit_price,
             t2.tax_inclusive_total_price,
             t2.tax_exclusive_total_price,
-            t3.inbound_num as quantityStock
+            ANY_VALUE(t3.inbound_num) as quantityStock
         from  purchase_ledger t1
-        left join sales_ledger_product t2 on t1.id = t2.sales_ledger_id and slp.type = 2
+        left join sales_ledger_product t2 on t1.id = t2.sales_ledger_id and t2.type = 2
         left join procurement_record_storage t3 on t2.id = t3.sales_ledger_product_id
         where t1.purchase_contract_number = #{req.purchaseContractNumber}
         <if test="req.id != null and req.id != ''">
@@ -120,28 +120,28 @@
     <select id="listPageCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
         select
         t3.supplier_name,
-        t3.purchase_contract_number,
+        ANY_VALUE(t3.purchase_contract_number) as purchase_contract_number,
         t2.product_category,
-        t1.id,
-        t1.sales_ledger_product_id,
-        t1.create_user,
+        ANY_VALUE(t1.id) as id,
+        ANY_VALUE(t1.sales_ledger_product_id) as sales_ledger_product_id,
+        ANY_VALUE(t1.create_user) as create_user,
         t2.specification_model,
-        t2.unit,
-        t2.min_stock,
-        t2.tax_rate,
-        t2.tax_inclusive_unit_price,
-        t2.tax_inclusive_total_price,
-        t2.tax_exclusive_total_price,
-        t1.inbound_batches,
+        ANY_VALUE(t2.unit) as unit,
+        ANY_VALUE(t2.min_stock) as min_stock,
+        ANY_VALUE(t2.tax_rate) as tax_rate,
+        ANY_VALUE(t2.tax_inclusive_unit_price) as tax_inclusive_unit_price,
+        ANY_VALUE(t2.tax_inclusive_total_price) as tax_inclusive_total_price,
+        ANY_VALUE(t2.tax_exclusive_total_price) as tax_exclusive_total_price,
+        ANY_VALUE(t1.inbound_batches) as inbound_batches,
         t1.unit_price as unitPrice,
         sum(t1.total_price) as totalPrice,
         sum(t1.inbound_num) as inboundNum,
         sum(t1.inbound_num) as inboundNum0,
-        t1.inbound_num as totalInboundNum,
-        t1.create_time,
-        t1.update_time,
-        t1.create_by,
-        t2.warn_num
+        ANY_VALUE(t1.inbound_num) as totalInboundNum,
+        ANY_VALUE(t1.create_time) as create_time,
+        ANY_VALUE(t1.update_time) as update_time,
+        ANY_VALUE(t1.create_by) as create_by,
+        ANY_VALUE(t2.warn_num) as warn_num
         from  procurement_record_storage t1
         left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2
         left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
@@ -178,25 +178,25 @@
     <select id="listCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
         select
             t3.supplier_name,
-            t3.purchase_contract_number,
+            ANY_VALUE(t3.purchase_contract_number) as purchase_contract_number,
             t2.product_category,
-            t1.id,
-            t1.sales_ledger_product_id,
-            t1.create_user,
-            t2.specification_model,
-            t2.unit,
-            t2.tax_rate,
-            t2.tax_inclusive_unit_price,
-            t2.tax_inclusive_total_price,
-            t2.tax_exclusive_total_price,
-            t1.inbound_batches,
-            t1.inbound_num,
-            t1.inbound_num as inboundNum0,
-            t1.create_time,
-            t1.update_time,
-            t1.create_time as cTime,
-            t1.update_time as uTime,
-            t1.create_by
+            ANY_VALUE(t1.id) as id,
+            ANY_VALUE(t1.sales_ledger_product_id) as sales_ledger_product_id,
+            ANY_VALUE(t1.create_user) as create_user,
+            ANY_VALUE(t2.specification_model) as specification_model,
+            ANY_VALUE(t2.unit) as unit,
+            ANY_VALUE(t2.tax_rate) as tax_rate,
+            ANY_VALUE(t2.tax_inclusive_unit_price) as tax_inclusive_unit_price,
+            ANY_VALUE(t2.tax_inclusive_total_price) as tax_inclusive_total_price,
+            ANY_VALUE(t2.tax_exclusive_total_price) as tax_exclusive_total_price,
+            ANY_VALUE(t1.inbound_batches) as inbound_batches,
+            ANY_VALUE(t1.inbound_num) as inbound_num,
+            ANY_VALUE(t1.inbound_num) as inboundNum0,
+            ANY_VALUE(t1.create_time) as create_time,
+            ANY_VALUE(t1.update_time) as update_time,
+            ANY_VALUE(t1.create_time) as cTime,
+            ANY_VALUE(t1.update_time) as uTime,
+            ANY_VALUE(t1.create_by) as create_by
         from  procurement_record_storage t1
                   left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2
                   left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
@@ -205,27 +205,27 @@
     </select>
     <select id="listCopyOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
         select
-            t3.customer_contract_no,
-            t3.sales_contract_no,
+            ANY_VALUE(t3.customer_contract_no) as customer_contract_no,
+            ANY_VALUE(t3.sales_contract_no) as sales_contract_no,
             t3.customer_name,
             t2.product_category,
-            t1.id,
-            t1.sales_ledger_product_id,
-            t1.create_user,
-            t2.specification_model,
-            t2.unit,
-            t2.tax_rate,
-            t2.tax_inclusive_unit_price,
-            t2.tax_inclusive_total_price,
-            t2.tax_exclusive_total_price,
-            t1.inbound_batches,
-            t1.inbound_num,
-            t1.inbound_num as inboundNum0,
-            t1.create_time,
-            t1.update_time,
-            t1.create_time as cTime,
-            t1.update_time as uTime,
-            t1.create_by
+            ANY_VALUE(t1.id) as id,
+            ANY_VALUE(t1.sales_ledger_product_id) as sales_ledger_product_id,
+            ANY_VALUE(t1.create_user) as create_user,
+            ANY_VALUE(t2.specification_model) as specification_model,
+            ANY_VALUE(t2.unit) as unit,
+            ANY_VALUE(t2.tax_rate) as tax_rate,
+            ANY_VALUE(t2.tax_inclusive_unit_price) as tax_inclusive_unit_price,
+            ANY_VALUE(t2.tax_inclusive_total_price) as tax_inclusive_total_price,
+            ANY_VALUE(t2.tax_exclusive_total_price) as tax_exclusive_total_price,
+            ANY_VALUE(t1.inbound_batches) as inbound_batches,
+            ANY_VALUE(t1.inbound_num) as inbound_num,
+            ANY_VALUE(t1.inbound_num) as inboundNum0,
+            ANY_VALUE(t1.create_time) as create_time,
+            ANY_VALUE(t1.update_time) as update_time,
+            ANY_VALUE(t1.create_time) as cTime,
+            ANY_VALUE(t1.update_time) as uTime,
+            ANY_VALUE(t1.create_by) as create_by
         from  procurement_record_storage t1
                   left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1
                   left join sales_ledger t3 on t3.id = t2.sales_ledger_id
diff --git a/src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml b/src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
index 1b84282..d3f0adc 100644
--- a/src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
@@ -39,6 +39,7 @@
                 and sl.sales_contract_no like concat('%',#{req.salesContractNo},'%')
             </if>
         </where>
+        ORDER BY rm.make_time DESC, rm.id DESC
     </select>
     <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto">
      select rm.*,
diff --git a/src/main/resources/mapper/production/ProductOrderMapper.xml b/src/main/resources/mapper/production/ProductOrderMapper.xml
index 6b993bf..85a3056 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..f14394c 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..2560939 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.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 a122e90..0fb44d6 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -49,7 +49,7 @@
                 and ppm.status = #{c.status}
             </if>
         </where>
-        order by ppm.id
+        order by 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..931154f 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.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 d9ddde7..5addbe2 100644
--- a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
+++ b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+锘�<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.production.mapper.SalesLedgerProductionAccountingMapper">
 
@@ -22,7 +22,7 @@
         FROM
         sales_ledger_production_accounting t4
         LEFT JOIN sales_ledger T1 ON T1.id = t4.sales_ledger_id
-        left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id and slp.type = 1
+        left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id and t3.type = 1
         <where>
             t3.type = 1
             <if test="salesLedgerDto.schedulingUserName != null and salesLedgerDto.schedulingUserName != '' ">
@@ -84,7 +84,7 @@
             </if>
 
         </where>
-        GROUP BY slpa.scheduling_user_name
+        GROUP BY slpa.scheduling_user_id, slpa.scheduling_user_name
 
     </select>
 
@@ -115,7 +115,7 @@
                  left join product_process pp on pp.name = slpa.process
         where  slpa.scheduling_user_id = #{ew.userId}
           and slpa.scheduling_date like concat(#{ew.date}, '%')
-        group by slpa.scheduling_user_id
+        group by slpa.scheduling_user_id, pp.type
 
     </select>
 
diff --git a/src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml b/src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml
index 4cff920..42e67a2 100644
--- a/src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml
+++ b/src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+锘�<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.production.mapper.SalesLedgerSchedulingMapper">
 
@@ -67,6 +67,7 @@
                 LEFT join sales_ledger_scheduling t3 on T1.id = t3.sales_ledger_id
         where T1.id is not null and T2.type = 1
         GROUP BY T2.id
+        ORDER BY T2.id DESC
     </select>
     <select id="listPageProcess" resultType="com.ruoyi.production.dto.SalesLedgerSchedulingProcessDto">
         SELECT
@@ -91,7 +92,7 @@
         FROM
         sales_ledger_scheduling T2
         LEFT JOIN sales_ledger T1 ON T1.id = T2.sales_ledger_id
-        left join sales_ledger_product t3 on T2.sales_ledger_product_id = t3.id and slp.type = 1
+        left join sales_ledger_product t3 on T2.sales_ledger_product_id = t3.id and t3.type = 1
         <where>
             t3.type = 1
             <if test="salesLedgerDto.status != null and salesLedgerDto.status != '' ">
diff --git a/src/main/resources/mapper/production/SalesLedgerWorkMapper.xml b/src/main/resources/mapper/production/SalesLedgerWorkMapper.xml
index 4ec771f..d392f89 100644
--- a/src/main/resources/mapper/production/SalesLedgerWorkMapper.xml
+++ b/src/main/resources/mapper/production/SalesLedgerWorkMapper.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+锘�<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.production.mapper.SalesLedgerWorkMapper">
 
@@ -28,7 +28,7 @@
         FROM
         sales_ledger_work t4
         LEFT JOIN sales_ledger T1 ON T1.id = t4.sales_ledger_id
-        left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id and slp.type = 1
+        left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id and t3.type = 1
         left join sales_ledger_scheduling t2 on t4.sales_ledger_scheduling_id = t2.id
         <where>
             t3.type = 1
diff --git a/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml b/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
index c5c007e..add3d8d 100644
--- a/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
+++ b/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
@@ -81,6 +81,7 @@
                 or pl.purchase_contract_number LIKE CONCAT('%', #{supplierNameOrContractNo}, '%')
             </if>
         </where>
+        ORDER BY pr.payment_date DESC, pr.id DESC
     </select>
 
     <select id="selectPaymentRegistrationById" parameterType="Long" resultMap="PaymentRegistrationDtoResult">
@@ -145,7 +146,7 @@
              FROM payment_registration
              WHERE supplier_id = #{supplierId}
         ) T1
-        ORDER BY T1.happenTime ASC
+        ORDER BY T1.happenTime DESC
 
     </select>
 
@@ -197,13 +198,14 @@
                 T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
             </if>
         </where>
-        GROUP BY T1.supplier_name
+        GROUP BY T1.supplier_id, T1.supplier_name
+        ORDER BY invoiceAmount DESC
     </select>
 
     <select id="supplierNameListPageDetails" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
         SELECT
-        T1.supplier_id,
-        T1.supplier_name,
+        ANY_VALUE(T1.supplier_id) AS supplier_id,
+        ANY_VALUE(T1.supplier_name) AS supplier_name,
         SUM(contract_amount) AS invoiceAmount,
         IFNULL( SUM(T2.current_payment_amount) , 0 ) AS paymentAmount,
         IFNULL((IFNULL(SUM(contract_amount),0)  - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount,
diff --git a/src/main/resources/mapper/purchase/ProductRecordMapper.xml b/src/main/resources/mapper/purchase/ProductRecordMapper.xml
index aa850cb..c306ff3 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 tr.issue_date DESC, pr.id DESC
     </select>
     <select id="getProductRecordById" resultType="com.ruoyi.purchase.dto.ProductRecordDto">
         SELECT
diff --git a/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml b/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
index 8976a3a..ef23538 100644
--- a/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
+++ b/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
@@ -35,5 +35,6 @@
         <if test="params.no != null and params.no != '' ">
             AND pro.no LIKE CONCAT('%',#{params.no},'%')
         </if>
+        ORDER BY pro.prepared_at DESC, pro.id DESC
     </select>
 </mapper>
diff --git a/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml b/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
index 5bda4f6..720978e 100644
--- a/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
+++ b/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
@@ -43,6 +43,7 @@
         <if test="qualityUnqualified.entryDateEnd != null and qualityUnqualified.entryDateEnd != '' ">
             AND  check_time &lt;= DATE_FORMAT(#{qualityUnqualified.entryDateEnd},'%Y-%m-%d')
         </if>
+        ORDER BY qu.check_time DESC, qu.id DESC
     </select>
     <select id="qualityUnqualifiedExport" resultType="com.ruoyi.quality.pojo.QualityUnqualified">
         SELECT
diff --git a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
index 2874f48..444b982 100644
--- a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+锘�<?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
@@ -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">
@@ -85,6 +86,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="invoiceLedgerInfo" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
@@ -123,7 +125,7 @@
                 T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%')
             </if>
         </where>
-        GROUP BY T1.customer_name
+        GROUP BY T1.customer_id, T1.customer_name
     </select>
 
     <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
diff --git a/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml b/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml
index 9edbea4..c4276b0 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.id DESC
     </select>
 
     <select id="invoiceRegisAndProductExcelDtoList" resultType="com.ruoyi.sales.excel.InvoiceRegisAndProductExcelDto">
@@ -67,6 +68,6 @@
                  JOIN sales_ledger T2 ON T1.sales_ledger_id = T2.id
                  JOIN customer T3 ON T1.customer_id = T3.id
                 JOIN invoice_registration_product T4 ON T1.id = T4.invoice_registration_id
-        ORDER BY T1.id ASC
+        ORDER BY T1.id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
index 975d120..3364456 100644
--- a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
+++ b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+锘�<?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
@@ -29,7 +29,7 @@
                 AND T4.customer_id = #{receiptPaymentDto.customerId}
             </if>
         </where>
-        ORDER BY T1.create_time ASC
+        ORDER BY T1.create_time DESC
     </select>
 
     <select id="receiptPaymentInfo" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
@@ -90,7 +90,7 @@
         FROM invoice_ledger_file
         GROUP BY invoice_ledger_id
         ) T4 ON T4.invoice_ledger_id = T1.id
-        LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
+        LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and T5.type = 1
         LEFT JOIN (
         SELECT
         SUM(receipt_payment_amount) AS receipt_payment_amount_total,
@@ -347,6 +347,7 @@
                 LEFT JOIN invoice_ledger T2 ON T1.invoice_ledger_id = T2.id
         WHERE
             T2.invoice_registration_product_id = #{invoiceRegistrationProductId}
+        ORDER BY T1.receipt_payment_date DESC
     </select>
     <select id="bindInvoiceNoRegListAll" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
         SELECT
@@ -378,7 +379,7 @@
                 GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
             FROM invoice_ledger_file GROUP BY invoice_ledger_id
         ) T4 ON T4.invoice_ledger_id = T1.id
-                 LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
+                 LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and T5.type = 1
                  LEFT JOIN (
             SELECT SUM(receipt_payment_amount) AS receipt_payment_amount_total,invoice_ledger_id FROM receipt_payment GROUP
                 BY invoice_ledger_id
@@ -414,7 +415,7 @@
         GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
         FROM invoice_ledger_file GROUP BY invoice_ledger_id
         ) T4 ON T4.invoice_ledger_id = T1.id
-        LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
+        LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and T5.type = 1
         LEFT JOIN (
         SELECT SUM(receipt_payment_amount) AS receipt_payment_amount_total,invoice_ledger_id FROM receipt_payment GROUP
         BY invoice_ledger_id
diff --git a/src/main/resources/mapper/sales/SalesLedgerMapper.xml b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
index 85f62c0..189474a 100644
--- a/src/main/resources/mapper/sales/SalesLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
@@ -40,6 +40,7 @@
                 T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%')
             </if>
         </where>
+        ORDER BY T1.entry_date DESC, T1.id DESC
     </select>
 
     <select id="selectSalesLedgerListPage" resultType="com.ruoyi.sales.pojo.SalesLedger">
@@ -119,6 +120,7 @@
             and sl.customer_name like concat('%',#{ew.customerName},'%')
             </if>
         </where>
+        ORDER BY sl.entry_date DESC, sl.id DESC
     </select>
 
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 73026c8..a022a4b 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -106,8 +106,8 @@
             resultType="com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto">
         SELECT
         slp.product_category AS productCategory,
-        slp.specification_model AS specificationModel,
-        sl.supplier_name AS supplierName,
+        ANY_VALUE(slp.specification_model) AS specificationModel,
+        ANY_VALUE(sl.supplier_name) AS supplierName,
         SUM(slp.quantity) AS purchaseNum,
         SUM(slp.tax_inclusive_total_price) AS purchaseAmount,
         COUNT(DISTINCT slp.sales_ledger_id) AS purchaseTimes,
diff --git a/src/main/resources/mapper/sales/SalesQuotationMapper.xml b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
index 1e358ca..4d17025 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.quotation_date DESC, t1.id DESC
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/ShipmentApprovalMapper.xml b/src/main/resources/mapper/sales/ShipmentApprovalMapper.xml
index 68cd664..74da023 100644
--- a/src/main/resources/mapper/sales/ShipmentApprovalMapper.xml
+++ b/src/main/resources/mapper/sales/ShipmentApprovalMapper.xml
@@ -3,8 +3,12 @@
 <mapper namespace="com.ruoyi.sales.mapper.ShipmentApprovalMapper">
 
     <select id="listPage" resultType="com.ruoyi.sales.pojo.ShipmentApproval">
-        SELECT *,
+        SELECT sa.*,
+        slp.product_category, slp.specification_model, slp.unit, slp.quantity, slp.min_stock,
+        slp.tax_rate, slp.tax_inclusive_unit_price, slp.tax_inclusive_total_price, slp.tax_exclusive_total_price,
+        slp.invoice_type, slp.type,
         si.shipping_car_number,
+        si.shipping_date,
         T2.nick_name AS entry_person_name
         FROM shipment_approval sa
                  LEFT JOIN shipping_info si ON sa.shipping_info_id = si.id
@@ -20,5 +24,6 @@
                 AND  sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%')
             </if>
         </where>
+        ORDER BY sa.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 955a89f..f422f7d 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.shipping_date DESC, s.id DESC
     </select>
     <select id="getReturnManagementDtoById" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto">
         SELECT
diff --git a/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml b/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
index 7dbb388..c676376 100644
--- a/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
+++ b/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
@@ -39,6 +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
     </select>
 
     <!-- 鏌ヨ鎸囧畾鏃ユ湡娌℃湁鑰冨嫟璁板綍鐨勫湪鑱屽憳宸ワ紙鍦ㄦ寚瀹氭椂闂翠箣鍓嶅叆鑱岀殑锛� -->
diff --git a/src/main/resources/mapper/staff/StaffContractMapper.xml b/src/main/resources/mapper/staff/StaffContractMapper.xml
index ac2ad70..cd3f1c0 100644
--- a/src/main/resources/mapper/staff/StaffContractMapper.xml
+++ b/src/main/resources/mapper/staff/StaffContractMapper.xml
@@ -11,5 +11,6 @@
         <if test="staffContract.staffOnJobId != null">
             AND soj.id = #{staffContract.staffOnJobId}
         </if>
+        ORDER BY sc.contract_start_time DESC, sc.id DESC
     </select>
 </mapper>
diff --git a/src/main/resources/mapper/staff/StaffLeaveMapper.xml b/src/main/resources/mapper/staff/StaffLeaveMapper.xml
index 4637ff0..c9f0fca 100644
--- a/src/main/resources/mapper/staff/StaffLeaveMapper.xml
+++ b/src/main/resources/mapper/staff/StaffLeaveMapper.xml
@@ -30,6 +30,7 @@
         <if test="c.staffName != null and c.staffName != '' ">
             AND soj.staff_name LIKE CONCAT('%',#{c.staffName},'%')
         </if>
+        ORDER BY staff_leave.id DESC
     </select>
     <select id="staffLeaveList" resultType="com.ruoyi.staff.dto.StaffLeaveDto">
         SELECT
diff --git a/src/main/resources/mapper/staff/StaffOnJobMapper.xml b/src/main/resources/mapper/staff/StaffOnJobMapper.xml
index fe35886..a6b8c4d 100644
--- a/src/main/resources/mapper/staff/StaffOnJobMapper.xml
+++ b/src/main/resources/mapper/staff/StaffOnJobMapper.xml
@@ -24,6 +24,7 @@
         <if test="staffOnJob.entryDateEnd != null and staffOnJob.entryDateEnd != '' ">
             AND contract_expire_time &lt;= DATE_FORMAT(#{staffOnJob.entryDateEnd},'%Y-%m-%d')
         </if>
+        ORDER BY staff_on_job.sign_date DESC, staff_on_job.id DESC
     </select>
     <select id="staffOnJobList" resultType="com.ruoyi.staff.dto.StaffOnJobDto">
         SELECT
diff --git a/src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml b/src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml
index 18b2082..6285451 100644
--- a/src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml
+++ b/src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml
@@ -51,6 +51,7 @@
         <if test="documentationBorrowManagement.entryDateEnd != null and documentationBorrowManagement.entryDateEnd != ''">
             and borrow_date &lt;= DATE_FORMAT(#{documentationBorrowManagement.entryDateEnd},'%Y-%m-%d')
         </if>
+        ORDER BY borrow_date DESC, id DESC
     </select>
     <select id="export" resultType="com.ruoyi.warehouse.dto.DocumentationBorrowManagementDto">
         select dbm.*,doc.doc_name
diff --git a/src/main/resources/mapper/warehouse/DocumentationMapper.xml b/src/main/resources/mapper/warehouse/DocumentationMapper.xml
index 91f17a9..2098595 100644
--- a/src/main/resources/mapper/warehouse/DocumentationMapper.xml
+++ b/src/main/resources/mapper/warehouse/DocumentationMapper.xml
@@ -32,6 +32,7 @@
         <if test="documentation.id != null">
             and doc.id = #{documentation.id}
         </if>
+        ORDER BY id DESC
     </select>
     <select id="listByDocumentClassificationId" resultType="com.ruoyi.warehouse.dto.DocumentationDto">
         SELECT
diff --git a/src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml b/src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml
index 06202f8..bda76df 100644
--- a/src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml
+++ b/src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml
@@ -28,6 +28,7 @@
         <if test="documentationReturnManagement.entryDateEnd != null and documentationReturnManagement.entryDateEnd != ''">
             and return_date &lt;= DATE_FORMAT(#{documentationReturnManagement.entryDateEnd},'%Y-%m-%d')
         </if>
+        ORDER BY return_date DESC, id DESC
     </select>
 
     <select id="exportrevent" resultType="com.ruoyi.warehouse.dto.ReturnExportDto">
diff --git a/src/main/resources/mapper/warehouse/WarehouseGoodsShelvesMapper.xml b/src/main/resources/mapper/warehouse/WarehouseGoodsShelvesMapper.xml
index 8493e2d..d708f69 100644
--- a/src/main/resources/mapper/warehouse/WarehouseGoodsShelvesMapper.xml
+++ b/src/main/resources/mapper/warehouse/WarehouseGoodsShelvesMapper.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" ?>
+锘�<?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.warehouse.mapper.WarehouseGoodsShelvesMapper">
@@ -19,7 +19,7 @@
         <where>
             1=1
             <if test="warehouseGoodsShelves.goodsShelvesName != null and warehouseGoodsShelves.goodsShelvesName != ''">
-                and wgs.goods_shelves_name like concat('%',#{warehouseGoodsShelves.goodsShelvesName},'%')
+                and wgs.name like concat('%',#{warehouseGoodsShelves.goodsShelvesName},'%')
             </if>
             <if test="warehouseGoodsShelves.warehouseId != null">
                 and wgs.warehouse_id = #{warehouseGoodsShelves.warehouseId}
@@ -35,7 +35,7 @@
         <where>
             1=1
             <if test="warehouseGoodsShelves.goodsShelvesName != null and warehouseGoodsShelves.goodsShelvesName != ''">
-                and goods_shelves_name like concat('%',#{warehouseGoodsShelves.goodsShelvesName},'%')
+                and wgs.name like concat('%',#{warehouseGoodsShelves.goodsShelvesName},'%')
             </if>
             <if test="warehouseGoodsShelves.warehouseId != null">
                 and warehouse_id = #{warehouseGoodsShelves.warehouseId}
diff --git a/src/main/resources/mapper/waterrecord/WaterRecordMapper.xml b/src/main/resources/mapper/waterrecord/WaterRecordMapper.xml
index e0a9135..491ef9a 100644
--- a/src/main/resources/mapper/waterrecord/WaterRecordMapper.xml
+++ b/src/main/resources/mapper/waterrecord/WaterRecordMapper.xml
@@ -13,5 +13,6 @@
                 and t2.device_name like concat('%',#{req.deviceName},'%')
             </if>
         </where>
+        ORDER BY t1.id DESC
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3