码迷,mamicode.com
首页 > 其他好文 > 详细

Mybatis 分页实现

时间:2017-10-05 20:27:48      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:config   span   color   nbsp   end   enc   http   tar   detail   

 一、插件 PageHelper(推荐使用) 原理:利用Mybatis的拦截器,截获需要分页的sql语句,在语句后面加分页条件,及获取总记录数等属性。

  注意 插件属性类

  参考一

  参考二

  实例:

    第一步:在pom.xml中添加PageHelper关联的jar 

<dependency>
           <groupId>com.github.pagehelper</groupId>
           <artifactId>pagehelper</artifactId>
         <version>5.0.0</version>
</dependency>

    第二步:在mybatis-config.xml   mybatis的配置文件中添加PageHelper插件及属性。

    

  

Mybatis 分页实现

标签:config   span   color   nbsp   end   enc   http   tar   detail   

原文地址:http://www.cnblogs.com/watermelonban/p/7629889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!