Mybatis-PageHelper自定义查询COUNT


使Mybatis-PageHelper用分页插件,可写自定义查询COUNT的SQL语句,在列表查询的id后面加上后缀_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>

详细请参考:https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/Changelog.md#504---2017-08-01


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM