美文网首页
SpringBoot使用PageHelper当超过最大页数后仍然

SpringBoot使用PageHelper当超过最大页数后仍然

作者: _灯火阑珊处 | 来源:发表于2019-03-28 18:24 被阅读0次
在SpringBoot中使用PageHelper分页插件时,如果设置pagehelper.reasonable=true时,pageNum<=0 时会查询第一页, pageNum>pages(超过总数时),会查询最后一页
也就是即使传入页数大于总页数,仍然会返回数据
在配置文件中,将 pagehelper.reasonable 改为 false 即可

pagehelper.reasonable=false

官方文档中写道:

reasonable:分页合理化参数,默认值为false。当该参数设置为 true 时,pageNum<=0 时会查询第一页, pageNum>pages(超过总数时),会查询最后一页。默认false 时,直接根据参数进行查询。

相关文章

网友评论

      本文标题:SpringBoot使用PageHelper当超过最大页数后仍然

      本文链接:https://www.haomeiwen.com/subject/vqpcbqtx.html