From 2a90efd15aa3a4324d5dbce894fc7ad26fae4a2e Mon Sep 17 00:00:00 2001 From: isea533 Date: Mon, 31 Jul 2017 21:05:30 +0800 Subject: [PATCH] update 5.0.4 --- pom.xml | 2 +- wikis/en/Changelog.md | 49 +++++++++++++++++++++++++++++++++++++++++++ wikis/zh/Changelog.md | 10 +++++++-- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c6618cdd..76dc0f8e 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ com.github.pagehelper pagehelper - 5.0.4-SNAPSHOT + 5.0.4 jar pagehelper 5 diff --git a/wikis/en/Changelog.md b/wikis/en/Changelog.md index 7772681a..07aa51c5 100644 --- a/wikis/en/Changelog.md +++ b/wikis/en/Changelog.md @@ -1,5 +1,54 @@ ## Changelog +### 5.0.4 - 2017-08-01 + +- Add a simple configuration support for the Phoenix database, You can configure `helperDialect=phoenix`. Can also automatically identify the Phoenix database jdbc url. +- Simplified cache of `msCountMap` +- Add `countSuffix` count query suffix configuration parameters, this parameter is configured for `PageInterceptor`, the default value is `_COUNT`. +- Add custom count query support, see below for details. + +#### Add custom count query support + +Add `countSuffix` count query suffix configuration parameters, this parameter is configured for `PageInterceptor`, the default value is `_COUNT`. + +The paging plugin will preferentially find the handwritten paging query by the current query `msId + countSuffix`. + +If there is no custom query, the query is still automatically created using the previous way. + +For example, if there are two queries: +```xml + + +``` +The above `countSuffix` uses the default value of` _COUNT`, and the paging plugin will automatically get the query to `selectLeftjoin_COUNT`. This query needs to ensure that the result is correct. + +The value of the return value must be `resultType =" Long "`, and the same parameter used by `selectLeftjoin` 'is used, so it is used in SQL to follow the selection of` selectLeftjoin`'. + +Because the `selectLeftjoin_COUNT` method is invoked automatically, there is no need to provide the appropriate method on the interface, or if it is required to be invoked separately. + +The above method to perform the portion of the output log is as follows: +``` +DEBUG [main] - ==> Preparing: select count(distinct a.id) from country a left join country b on a.id = b.id +DEBUG [main] - ==> Parameters: +TRACE [main] - <== Columns: C1 +TRACE [main] - <== Row: 183 +DEBUG [main] - <== Total: 1 +DEBUG [main] - Cache Hit Ratio [com.github.pagehelper.mapper.CountryMapper]: 0.0 +DEBUG [main] - ==> Preparing: select a.id,b.countryname,a.countrycode from country a left join country b on a.id = b.id order by a.id LIMIT 10 +DEBUG [main] - ==> Parameters: +TRACE [main] - <== Columns: ID, COUNTRYNAME, COUNTRYCODE +TRACE [main] - <== Row: 1, Angola, AO +TRACE [main] - <== Row: 2, Afghanistan, AF +TRACE [main] - <== Row: 3, Albania, AL +``` + ### 5.0.3 -2017-06-20 - Solve the `supportMethodsArguments` parameter problem. It is recommended to upgrade to the latest version. diff --git a/wikis/zh/Changelog.md b/wikis/zh/Changelog.md index 72a3ae32..968dd004 100644 --- a/wikis/zh/Changelog.md +++ b/wikis/zh/Changelog.md @@ -1,14 +1,18 @@ ## 更新日志 -### 5.0.4-beta - 2017-07-01 +### 5.0.4 - 2017-08-01 -- count 查询的缓存 `msCountMap` key 改为 `String` 类型,key 为 count 查询的 `MappedStatement` 的 id(下面简称 msId)。 +- 增加对 `Phoenix` 数据库的简单配置支持,配置 `helperDialect=phoenix` 即可,也可以自动识别 `Phoenix` 数据库的 jdbc url。 +- count 查询的缓存 `msCountMap` key 改为 `String` 类型,key 为 count 查询的 `MappedStatement` 的 id。 - 增加 `countSuffix` count 查询后缀配置参数,该参数是针对 `PageInterceptor` 配置的,默认值为 `_COUNT`。 - 增加手写 count 查询支持,详情看下面介绍。 #### 增加手写 count 查询支持 + 增加 `countSuffix` count 查询后缀配置参数,该参数是针对 `PageInterceptor` 配置的,默认值为 `_COUNT`。 + 分页插件会优先通过当前查询的 msId + `countSuffix` 查找手写的分页查询。 + 如果存在就使用手写的 count 查询,如果不存在,仍然使用之前的方式自动创建 count 查询。 例如,如果存在下面两个查询: @@ -24,7 +28,9 @@ ``` 上面的 `countSuffix` 使用的默认值 `_COUNT`,分页插件会自动获取到 `selectLeftjoin_COUNT` 查询,这个查询需要自己保证结果数正确。 + 返回值的类型必须是`resultType="Long"`,入参使用的和 `selectLeftjoin` 查询相同的参数,所以在 SQL 中要按照 `selectLeftjoin` 的入参来使用。 + 因为 `selectLeftjoin_COUNT` 方法是自动调用的,所以不需要在接口提供相应的方法,如果需要单独调用,也可以提供。 上面方法执行输出的部分日志如下: