转载

Mybatis 分页插件 PageHelper 5.1.5 发布

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

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

  1. Oracle

  2. Mysql

  3. MariaDB

  4. SQLite

  5. Hsqldb

  6. PostgreSQL

  7. DB2

  8. SqlServer(2005+)

  9. Informix

  10. H2

  11. SqlServer2012

  12. Derby

  13. Phoenix

  14. 达梦数据库

5.1.5 更新日志

  • 优化代码,去掉没必要的校验( by lenosp )

  • 解决 pageKey 多处理一次的小问题 #268

  • 新增 gitee 提供的 javadoc 文档( https://apidoc.gitee.com/free/Mybatis_PageHelper )

  • 解决默认反射不带缓存的问题 fixed #275

  • 优化mysql ifnull函数导致分页性能问题 ( by miaogr )(这个修改最终改成了下面的  aggregateFunctions

  • jsqlparser 升级为 1.2 版本,和 1.0 有不兼容的情况,已经解决。 fixed 273

  • 去掉 PageInfo 中存在歧义的 g(s)etFirstPage 和 g(s)etLastPage 两个方法

  • 抛出排序时解析失败的异常 fixed #257

  • 解决 Spring <bean> 方式配置时,没有  properties 属性时的初始化问题 fixed #26

  • 修复Oracle分页会漏查数据的问题 ( by muyun12 )

  • 新增 aggregateFunctions 参数( CountSqlParser ), 允许手动添加聚合函数(影响行数),所有以聚合函数开头的函数,在进行 count 转换时,会套一层。其他函数和列会被替换为 count(0),其中count列可以自己配置。

增加 aggregateFunctions 参数后,和原先最大的区别是,如果存在  select ifnull(xxx, yy) from table ... ,原先的 count 查询是  select count(0) from (select ifnull(xxx, yy) from table ...) temp_count ,现在会区别聚合函数,如果不是聚合函数,就会变成  select count(0) from table ...

默认包含的聚合函数前缀如下:

"APPROX_COUNT_DISTINCT," +
"ARRAY_AGG," +
"AVG," +
"BIT_" +
//"BIT_AND," +
//"BIT_OR," +
//"BIT_XOR," +
"BOOL_," +
//"BOOL_AND," +
//"BOOL_OR," +
"CHECKSUM_AGG," +
"COLLECT," +
"CORR," +
//"CORR_," +
//"CORRELATION," +
"COUNT," +
//"COUNT_BIG," +
"COVAR," +
//"COVAR_POP," +
//"COVAR_SAMP," +
//"COVARIANCE," +
//"COVARIANCE_SAMP," +
"CUME_DIST," +
"DENSE_RANK," +
"EVERY," +
"FIRST," +
"GROUP," +
//"GROUP_CONCAT," +
//"GROUP_ID," +
//"GROUPING," +
//"GROUPING," +
//"GROUPING_ID," +
"JSON_," +
//"JSON_AGG," +
//"JSON_ARRAYAGG," +
//"JSON_OBJECT_AGG," +
//"JSON_OBJECTAGG," +
//"JSONB_AGG," +
//"JSONB_OBJECT_AGG," +
"LAST," +
"LISTAGG," +
"MAX," +
"MEDIAN," +
"MIN," +
"PERCENT_," +
//"PERCENT_RANK," +
//"PERCENTILE_CONT," +
//"PERCENTILE_DISC," +
"RANK," +
"REGR_," +
"SELECTIVITY," +
"STATS_," +
//"STATS_BINOMIAL_TEST," +
//"STATS_CROSSTAB," +
//"STATS_F_TEST," +
//"STATS_KS_TEST," +
//"STATS_MODE," +
//"STATS_MW_TEST," +
//"STATS_ONE_WAY_ANOVA," +
//"STATS_T_TEST_*," +
//"STATS_WSR_TEST," +
"STD," +
//"STDDEV," +
//"STDDEV_POP," +
//"STDDEV_SAMP," +
//"STDDEV_SAMP," +
//"STDEV," +
//"STDEVP," +
"STRING_AGG," +
"SUM," +
"SYS_OP_ZONE_ID," +
"SYS_XMLAGG," +
"VAR," +
//"VAR_POP," +
//"VAR_SAMP," +
//"VARIANCE," +
//"VARIANCE_SAMP," +
//"VARP," +
"XMLAGG"

想要增加新的聚合函数前缀可以配置 aggregateFunctions,多个值用英文逗号隔开。

原文  https://www.oschina.net/news/99569/mybatis_pagehelper-5-1-5-released
正文到此结束
Loading...