Prechádzať zdrojové kódy

fix: listUser 接口排序修复,将 ORDER BY 从无意义的首层查询移到 XML 结果集

首层查询只做筛选无分页,orderByDesc 被第二层 IN 查询丢弃导致始终按 id 升序。
排序逻辑移至 XML 的 ORDER BY t1.id DESC,确保分页结果按 id 倒序排列。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 1 deň pred
rodič
commit
c49266be52

+ 1 - 0
car-wash-mapper/src/main/resources/mappers/UserMapper.xml

@@ -97,6 +97,7 @@
             <foreach collection="list" item="item" open="(" separator="," close=")">
                 #{item}
             </foreach>
+            ORDER BY t1.id DESC
         </if>
         <if test="list==null">
 

+ 0 - 1
car-wash-service/src/main/java/com/kym/service/impl/UserServiceImpl.java

@@ -280,7 +280,6 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
                 .eq(CommUtil.isNotEmptyAndNull(params.getMobilePhone()), User::getMobilePhone, params.getMobilePhone())
                 .eq(CommUtil.isNotEmptyAndNull(params.getStationId()), User::getStationId, params.getStationId())
                 .eq(CommUtil.isNotEmptyAndNull(params.getStatus()), User::getStatus, params.getStatus())
-                .orderByDesc(User::getId)
                 .list().stream().map(User::getId)
                 .toList();
         if (CommUtil.isEmptyOrNull(userIds)) {