1 Star 0 Fork 835

GSAM / Mybatis_PageHelper

forked from abel533 / Mybatis_PageHelper 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

#Mybatis分页插件 - PageHelper

如果你也在用Mybatis,建议尝试该分页插件,这一定是最方便使用的分页插件。

分页插件支持任何复杂的单表、多表分页,部分特殊情况请看重要提示

想要使用分页插件?请看如何使用分页插件

##物理分页

该插件目前支持以下数据库的物理分页:

  1. Oracle
  2. Mysql
  3. MariaDB
  4. SQLite
  5. Hsqldb
  6. PostgreSQL
  7. DB2
  8. SqlServer(2005,2008)
  9. Informix
  10. H2
  11. SqlServer2012

配置dialect属性时,可以使用小写形式:

oracle,mysql,mariadb,sqlite,hsqldb,postgresql,db2,sqlserver,informix,h2,sqlserver2012

在4.0.0版本以后,dialect参数可以不配置,系统能自动识别这里提到的所有数据库。

对于不支持的数据库,可以实现com.github.pagehelper.parser.Parser接口,然后配置到dialect参数中(4.0.2版本增加)。

特别注意:使用SqlServer2012数据库时,需要手动指定sqlserver2012,否则会使用2005的方式进行分页。

##MyBatis工具网站:http://mybatis.tk

##分页插件支持MyBatis3.2.0~3.3.0(包含)

##分页插件最新版本为4.1.6

###Maven坐标

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

###下载JAR包

分页插件pagehelper.jar:

###由于使用了sql解析工具,你还需要下载jsqlparser.jar

####4.1.0及以后版本需要0.9.5版本

####4.1.0以前版本需要0.9.1版本

##4.1.7-SNAPSHOT

  • 解决多个with(nolock)时出错的问题
  • 新增sqlCacheClass参数,该参数可选,可以设置sql缓存实现类,默认为SimpleCache,当项目包含guava时,使用GuavaCache,也可以通过参数sqlCacheClass指定自己的实现类,有关详情看com.github.pagehelper.cache包。

##4.1.6更新日志

  • 通过间接处理字符串解决SqlServer中不支持with(nolock)的问题#86,详情可以看SqlServerParserSqlServer2012Dialect

##4.1.5更新日志

  • 更新PageProviderSqlSource,支持3.4.0版本的Provider注解方式的分页#102
  • 解决SqlUtil未初始化PARAMS属性导致的错误

##4.1.4更新日志

  • 解决closeConn未设置时,默认值被覆盖变成false的问题#97
  • closeConn不只对动态数据源有效,当没有设置dialect属性自动获取数据库类型的时候同样有效
  • 解决关闭tomcat的时候提示线程安全问题#98,这个问题不会导致内存溢出,已经增加处理

##4.1.3更新日志

  • 解决反射类没有完全捕获异常的问题#94
  • 把SqlServer类所有private都改成了protected,方便继承修改#93

##4.1.2更新日志

  • 增加可配参数closeConn,当使用动态数据源时,分页插件获取jdbcUrl后,控制是否关闭当前连接,默认true关闭
  • count查询改为count(0),分库分表情况下的效率可能更高

##4.1.1更新日志:

  • 解决动态数据源时获取连接后未关闭的严重bug#80
  • 解决动态数据源时SqlSource和parser绑定导致不能切换方言的问题

##4.1.0更新日志:

  • 增加autoRuntimeDialect参数,允许在运行时根据多数据源自动识别对应方言的分页(暂时不支持自动选择sqlserver2012,只能使用sqlserver)。
  • 去掉了4.0.3版本增加的returnPageInfo参数,接口返回值不支持PageInfo类型,可以使用下面ISelect中演示的方法获取
  • 增加对SqlServer2012的支持,需要手动指定dialect=sqlserver2012,否则会使用2005的方式进行分页
  • jsqlparser升级到0.9.4版本,使用jar包时必须用最新的0.9.4版本,使用Maven会自动依赖0.9.4
  • 增加ISelect接口,方便调用,使用方法可以参考src/test/java/com.github.pagehelper.test.basic.TestISelect测试。

##项目文档wiki

###如何使用分页插件

如果要使用分页插件,这篇文档一定要看,看完肯定没有问题。

如果和Spring集成不熟悉,可以参考下面两个MyBatis和Spring集成的框架

只有基础的配置信息,没有任何现成的功能,作为新手入门搭建框架的基础

这两个集成框架集成了MyBatis分页插件和MyBatis通用Mapper。

###如何使用排序插件

###更新日志

包含全部的详细的更新日志。

###重要提示

提示很重要,建议一定看一遍!

###提交(gitosc)BUG

##相关链接

对应于oschub的项目地址:http://git.oschina.net/free/Mybatis_PageHelper

对应于github的项目地址:https://github.com/pagehelper/Mybatis-PageHelper

Mybatis-Sample(分页插件测试项目):http://git.oschina.net/free/Mybatis-Sample

Mybatis项目:https://github.com/mybatis/mybatis-3

Mybatis文档:http://mybatis.github.io/mybatis-3/zh/index.html

Mybatis专栏:

作者博客:

作者邮箱: abel533@gmail.com

Mybatis工具群: Mybatis工具

The MIT License (MIT) Copyright (c) 2014 abel533@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Mybatis分页插件 expand collapse
MIT
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
1
https://gitee.com/dushuren/Mybatis_PageHelper.git
git@gitee.com:dushuren/Mybatis_PageHelper.git
dushuren
Mybatis_PageHelper
Mybatis_PageHelper
master

Search