Skip to content

Commit 2a90efd

Browse files
committed
update 5.0.4
1 parent 1fd06ec commit 2a90efd

File tree

3 files changed

+58
-3
lines changed

3 files changed

+58
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<groupId>com.github.pagehelper</groupId>
3030
<artifactId>pagehelper</artifactId>
31-
<version>5.0.4-SNAPSHOT</version>
31+
<version>5.0.4</version>
3232
<packaging>jar</packaging>
3333

3434
<name>pagehelper 5</name>

wikis/en/Changelog.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
## Changelog
22

3+
### 5.0.4 - 2017-08-01
4+
5+
- Add a simple configuration support for the Phoenix database, You can configure `helperDialect=phoenix`. Can also automatically identify the Phoenix database jdbc url.
6+
- Simplified cache of `msCountMap`
7+
- Add `countSuffix` count query suffix configuration parameters, this parameter is configured for `PageInterceptor`, the default value is `_COUNT`.
8+
- Add custom count query support, see below for details.
9+
10+
#### Add custom count query support
11+
12+
Add `countSuffix` count query suffix configuration parameters, this parameter is configured for `PageInterceptor`, the default value is `_COUNT`.
13+
14+
The paging plugin will preferentially find the handwritten paging query by the current query `msId + countSuffix`.
15+
16+
If there is no custom query, the query is still automatically created using the previous way.
17+
18+
For example, if there are two queries:
19+
```xml
20+
<select id="selectLeftjoin" resultType="com.github.pagehelper.model.Country">
21+
select a.id,b.countryname,a.countrycode from country a
22+
left join country b on a.id = b.id
23+
order by a.id
24+
</select>
25+
<select id="selectLeftjoin_COUNT" resultType="Long">
26+
select count(distinct a.id) from country a
27+
left join country b on a.id = b.id
28+
</select>
29+
```
30+
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.
31+
32+
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`'.
33+
34+
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.
35+
36+
The above method to perform the portion of the output log is as follows:
37+
```
38+
DEBUG [main] - ==> Preparing: select count(distinct a.id) from country a left join country b on a.id = b.id
39+
DEBUG [main] - ==> Parameters:
40+
TRACE [main] - <== Columns: C1
41+
TRACE [main] - <== Row: 183
42+
DEBUG [main] - <== Total: 1
43+
DEBUG [main] - Cache Hit Ratio [com.github.pagehelper.mapper.CountryMapper]: 0.0
44+
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
45+
DEBUG [main] - ==> Parameters:
46+
TRACE [main] - <== Columns: ID, COUNTRYNAME, COUNTRYCODE
47+
TRACE [main] - <== Row: 1, Angola, AO
48+
TRACE [main] - <== Row: 2, Afghanistan, AF
49+
TRACE [main] - <== Row: 3, Albania, AL
50+
```
51+
352
### 5.0.3 -2017-06-20
453

554
- Solve the `supportMethodsArguments` parameter problem. It is recommended to upgrade to the latest version.

wikis/zh/Changelog.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
## 更新日志
22

3-
### 5.0.4-beta - 2017-07-01
3+
### 5.0.4 - 2017-08-01
44

5-
- count 查询的缓存 `msCountMap` key 改为 `String` 类型,key 为 count 查询的 `MappedStatement` 的 id(下面简称 msId)。
5+
- 增加对 `Phoenix` 数据库的简单配置支持,配置 `helperDialect=phoenix` 即可,也可以自动识别 `Phoenix` 数据库的 jdbc url。
6+
- count 查询的缓存 `msCountMap` key 改为 `String` 类型,key 为 count 查询的 `MappedStatement` 的 id。
67
- 增加 `countSuffix` count 查询后缀配置参数,该参数是针对 `PageInterceptor` 配置的,默认值为 `_COUNT`
78
- 增加手写 count 查询支持,详情看下面介绍。
89

910
#### 增加手写 count 查询支持
11+
1012
增加 `countSuffix` count 查询后缀配置参数,该参数是针对 `PageInterceptor` 配置的,默认值为 `_COUNT`
13+
1114
分页插件会优先通过当前查询的 msId + `countSuffix` 查找手写的分页查询。
15+
1216
如果存在就使用手写的 count 查询,如果不存在,仍然使用之前的方式自动创建 count 查询。
1317

1418
例如,如果存在下面两个查询:
@@ -24,7 +28,9 @@
2428
</select>
2529
```
2630
上面的 `countSuffix` 使用的默认值 `_COUNT`,分页插件会自动获取到 `selectLeftjoin_COUNT` 查询,这个查询需要自己保证结果数正确。
31+
2732
返回值的类型必须是`resultType="Long"`,入参使用的和 `selectLeftjoin` 查询相同的参数,所以在 SQL 中要按照 `selectLeftjoin` 的入参来使用。
33+
2834
因为 `selectLeftjoin_COUNT` 方法是自动调用的,所以不需要在接口提供相应的方法,如果需要单独调用,也可以提供。
2935

3036
上面方法执行输出的部分日志如下:

0 commit comments

Comments
 (0)