Skip to content

Commit

Permalink
升级 PageHelper 到 6.0.0,发布2.0.0版本
Browse files Browse the repository at this point in the history
  • Loading branch information
pagehelper committed Nov 5, 2023
1 parent ebdc5b7 commit 8b816cd
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 8 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PageHelper-Spring-Boot-Starter 帮助你集成分页插件到 Spring Boot。

PageHelper-Spring-Boot-Starter will help you use PageHelper with Spring Boot.

Support PageHelper 5.x
Support PageHelper 6.x

## How to use
在 pom.xml 中添加如下依赖:
Expand All @@ -16,10 +16,23 @@ Add the following dependency to your pom.xml:
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.7</version>
<version>2.0.0</version>
</dependency>
```

## v2.0.0 - 2023-11-05

- 升级 PageHelper 到 6.0.0,支持异步 count 等功能,详细查看 [6.0](https://github.com/pagehelper/Mybatis-PageHelper/releases/tag/v6.0.0)
- 升级 MyBatis 到 3.5.15
- 升级 springboot 到 2.7.17
- 新增参数 `asyncCount`,增加异步count支持,默认`false`,单次设置:`PageHelper.startPage(1, 10).enableAsyncCount()`;
- 新增参数 `countSqlParser``CountSqlParser`改为接口,允许通过`countSqlParser`参数替换为自己的实现

参数示例:
```properties
pagehelper.async-count=true
```

## v1.4.7 - 2023-06-03

- 升级 PageHelper 到 5.3.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,20 @@ public String getAutoDialectClass() {
public void setAutoDialectClass(String autoDialectClass) {
setProperty("autoDialectClass", autoDialectClass);
}

public Boolean getAsyncCount() {
return Boolean.valueOf(getProperty("asyncCount"));
}

public void setAsyncCount(Boolean asyncCount) {
setProperty("asyncCount", asyncCount.toString());
}

public String getCountSqlParser(String countSqlParser) {
return getProperty("countSqlParser");
}

public void setCountSqlParser(String countSqlParser) {
setProperty("countSqlParser", countSqlParser);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class PageHelperStandardProperties {
private Boolean keepOrderBy;
private Boolean keepSubSelectOrderBy;
private String sqlParser;
private Boolean asyncCount;
private String countSqlParser;

@Autowired
public PageHelperStandardProperties(PageHelperProperties properties) {
Expand Down Expand Up @@ -251,4 +253,22 @@ public void setSqlParser(String sqlParser) {
this.sqlParser = sqlParser;
Optional.ofNullable(sqlParser).ifPresent(v -> properties.setProperty("sqlParser", v));
}

public Boolean getAsyncCount() {
return asyncCount;
}

public void setAsyncCount(Boolean asyncCount) {
this.asyncCount = asyncCount;
Optional.ofNullable(asyncCount).ifPresent(v -> properties.setProperty("asyncCount", v.toString()));
}

public String getCountSqlParser() {
return countSqlParser;
}

public void setCountSqlParser(String countSqlParser) {
this.countSqlParser = countSqlParser;
Optional.ofNullable(countSqlParser).ifPresent(v -> properties.setProperty("countSqlParser", v));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void main(String[] args) {

@Override
public void run(String... args) throws Exception {
PageHelper.startPage(1, 20);
PageHelper.startPage(1, 20).disableAsyncCount();
List<User> users = userMapper.findAll();
System.out.println("Total: " + ((Page) users).getTotal());
for (User user : users) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ pagehelper.closeConn=true
pagehelper.hello=\u4F60\u597D
pagehelper.nihao=Hello
pagehelper.offset-as-page-num=true
pagehelper.count-column=*
pagehelper.count-column=*
pagehelper.async-count=true
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@
</modules>

<properties>
<revision>1.4.7</revision>
<revision>2.0.0</revision>

<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<mybatis.version>3.5.13</mybatis.version>
<pagehelper.version>5.3.3</pagehelper.version>
<mybatis.version>3.5.14</mybatis.version>
<pagehelper.version>6.0.0</pagehelper.version>
<mybatis-spring-boot.version>2.3.1</mybatis-spring-boot.version>
<spring-boot.version>2.7.12</spring-boot.version>
<spring-boot.version>2.7.17</spring-boot.version>
</properties>

<dependencyManagement>
Expand Down

0 comments on commit 8b816cd

Please sign in to comment.