不支持该SQL转换为分页查询!
sql中使用order by进行排序,代码开发的时候使用PageHelper分页时,出现该问题;
解决方案:
原文链接: https://blog.csdn.net/ma726518972/article/details/104000679/
一:增加手写 count 查询支持
分页插件会优先通过当前查询的 msId + countSuffix 查找手写的分页查询。
如果存在就使用手写的 count 查询,如果不存在,仍然使用之前的方式自动创建 count 查询。
例如,如果存在下面两个查询:
<select id="selectLeftjoin" resultType="com.github.pagehelper.model.User">
select a.id,b.name,a.py from user a
left join user b on a.id = b.id
order by a.id
</select>
<select id="selectLeftjoin_COUNT" resultType="Long">
select count(distinct a.id) from user a
left join user b on a.id = b.id
</select>
二:检查sql中是否有[],在navicat中,会自动为表名和字段加 [],navicat能执行,pagehelper不能识别,去掉中括号后,就解决了。