zlwu 11 kuukautta sitten
vanhempi
commit
67a826b813

+ 3 - 0
backend/ruoyi-modules/ruoyi-xg/src/main/java/org/dromara/xg/service/impl/XgStudentMsgBatchServiceImpl.java

@@ -896,6 +896,9 @@ public class XgStudentMsgBatchServiceImpl implements IXgStudentMsgBatchService {
         // 第二步:根据部门ID列表和条件分页查询学生信息批次数据
         com.baomidou.mybatisplus.extension.plugins.pagination.Page<XgStudentMsgBatchVo> page = pageQuery
                 .build();
+        // 保证最终排序规则严格按照 Mapper XML 中的
+        // ORDER BY student_no DESC, create_time DESC 执行
+        pageQuery.disableDefaultOrder();
         com.baomidou.mybatisplus.extension.plugins.pagination.Page<XgStudentMsgBatchVo> result = baseMapper
                 .selectPageByDeptIds(page, batchId, filteredDeptIds, name, studentNo, phone, infoStatus);
 

+ 7 - 1
backend/ruoyi-modules/ruoyi-xg/src/main/java/org/dromara/xg/service/impl/XgStudentMsgServiceImpl.java

@@ -186,6 +186,10 @@ public class XgStudentMsgServiceImpl implements IXgStudentMsgService {
                 .map(String::valueOf)
                 .collect(Collectors.toList());
 
+        // 关闭 PageQuery 的默认排序(create_time desc),避免与 XML 中的 ORDER BY 冲突
+        // 保证最终排序规则严格按照 Mapper XML 中的
+        // ORDER BY student_no DESC, create_time DESC 执行
+        pageQuery.disableDefaultOrder();
         Page<XgStudentMsgVo> result = baseMapper.selectPageByDeptIds(pageQuery.build(), lqw, classIdList);
         return TableDataInfo.build(result);
     }
@@ -726,7 +730,9 @@ public class XgStudentMsgServiceImpl implements IXgStudentMsgService {
         List<String> classIdList = filteredDeptIds.stream()
                 .map(String::valueOf)
                 .collect(Collectors.toList());
-
+        // 保证最终排序规则严格按照 Mapper XML 中的
+        // ORDER BY student_no DESC, create_time DESC 执行
+        // pageQuery.disableDefaultOrder();
         Page<XgStudentMsgVo> result = baseMapper.selectPageByDeptIds(
                 new Page<>(bo.getPageNum(), bo.getPageSize()), lqw, classIdList);
         return TableDataInfo.build(result);