当前使用版本(必填,否则不予处理)

3.5.6

该问题是如何引起的?(确定最新版也有问题再提!!!)

问题对该issues的fix引起 https://github.com/baomidou/mybatis-plus/issues/5745 此段代码挪到上面导致在判断有distinct 的时候直接返回了,没有执行消除order by的处理,继而导致sqlserver语法错误

重现步骤(如果有就写完整)

如有sql语句 select distinct id from table order by id 在分页的时候,会在加上count转换为 select count(1) from (select distinct id from table order by id) a;

报错信息

The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.

Comment From: GitHub-Link

issue 5745

Comment From: nieqiurong

用 3.5.7-SNAPSHOT 试试

Comment From: GitHub-Link

用 3.5.7-SNAPSHOT 试试

谢谢