Showing preview only (1,160K chars total). Download the full file or copy to clipboard to get everything.
Repository: pagehelper-org/Mybatis-PageHelper
Branch: master
Commit: b4212c4dbd0f
Files: 249
Total size: 1.1 MB
Directory structure:
gitextract_2of7jm93/
├── .editorconfig
├── .github/
│ ├── FUNDING.yml
│ ├── issue_template.md
│ └── workflows/
│ ├── pull-request.yml
│ └── release.yml
├── .gitignore
├── LICENSE
├── README.md
├── README_en.md
├── jsqlparser4_7兼容性改动.patch
├── pom.xml
├── src/
│ ├── main/
│ │ └── java/
│ │ └── com/
│ │ └── github/
│ │ └── pagehelper/
│ │ ├── AutoDialect.java
│ │ ├── BoundSqlInterceptor.java
│ │ ├── BoundSqlInterceptorChain.java
│ │ ├── Constant.java
│ │ ├── CountMsIdGen.java
│ │ ├── Dialect.java
│ │ ├── IPage.java
│ │ ├── ISelect.java
│ │ ├── Page.java
│ │ ├── PageException.java
│ │ ├── PageHelper.java
│ │ ├── PageInfo.java
│ │ ├── PageInterceptor.java
│ │ ├── PageParam.java
│ │ ├── PageProperties.java
│ │ ├── PageRowBounds.java
│ │ ├── PageSerializable.java
│ │ ├── QueryInterceptor.java
│ │ ├── cache/
│ │ │ ├── Cache.java
│ │ │ ├── CacheFactory.java
│ │ │ ├── GuavaCache.java
│ │ │ └── SimpleCache.java
│ │ ├── dialect/
│ │ │ ├── AbstractDialect.java
│ │ │ ├── AbstractHelperDialect.java
│ │ │ ├── AbstractRowBoundsDialect.java
│ │ │ ├── ReplaceSql.java
│ │ │ ├── auto/
│ │ │ │ ├── C3P0AutoDialect.java
│ │ │ │ ├── DataSourceAutoDialect.java
│ │ │ │ ├── DataSourceNegotiationAutoDialect.java
│ │ │ │ ├── DbcpAutoDialect.java
│ │ │ │ ├── DefaultAutoDialect.java
│ │ │ │ ├── DruidAutoDialect.java
│ │ │ │ ├── HikariAutoDialect.java
│ │ │ │ └── TomcatAutoDialect.java
│ │ │ ├── helper/
│ │ │ │ ├── AS400Dialect.java
│ │ │ │ ├── CirroDataDialect.java
│ │ │ │ ├── Db2Dialect.java
│ │ │ │ ├── FirebirdDialect.java
│ │ │ │ ├── GaussDBDialect.java
│ │ │ │ ├── HerdDBDialect.java
│ │ │ │ ├── HsqldbDialect.java
│ │ │ │ ├── InformixDialect.java
│ │ │ │ ├── MySqlDialect.java
│ │ │ │ ├── Oracle9iDialect.java
│ │ │ │ ├── OracleDialect.java
│ │ │ │ ├── OscarDialect.java
│ │ │ │ ├── PostgreSqlDialect.java
│ │ │ │ ├── SqlServer2012Dialect.java
│ │ │ │ ├── SqlServerDialect.java
│ │ │ │ └── XuguDialect.java
│ │ │ ├── replace/
│ │ │ │ ├── RegexWithNolockReplaceSql.java
│ │ │ │ └── SimpleWithNolockReplaceSql.java
│ │ │ └── rowbounds/
│ │ │ ├── Db2RowBoundsDialect.java
│ │ │ ├── GaussDBRowBoundsDialect.java
│ │ │ ├── HerdDBRowBoundsDialect.java
│ │ │ ├── HsqldbRowBoundsDialect.java
│ │ │ ├── InformixRowBoundsDialect.java
│ │ │ ├── MySqlRowBoundsDialect.java
│ │ │ ├── OracleRowBoundsDialect.java
│ │ │ ├── PostgreSqlRowBoundsDialect.java
│ │ │ ├── SqlServer2012RowBoundsDialect.java
│ │ │ ├── SqlServerRowBoundsDialect.java
│ │ │ ├── XuguRowBoundsDialect.java
│ │ │ └── package-info.java
│ │ ├── page/
│ │ │ ├── PageAutoDialect.java
│ │ │ ├── PageBoundSqlInterceptors.java
│ │ │ ├── PageMethod.java
│ │ │ └── PageParams.java
│ │ ├── parser/
│ │ │ ├── CountSqlParser.java
│ │ │ ├── OrderBySqlParser.java
│ │ │ ├── SqlParser.java
│ │ │ ├── SqlParserUtil.java
│ │ │ ├── SqlServerSqlParser.java
│ │ │ └── defaults/
│ │ │ ├── DefaultCountSqlParser.java
│ │ │ ├── DefaultOrderBySqlParser.java
│ │ │ └── DefaultSqlServerSqlParser.java
│ │ └── util/
│ │ ├── ClassUtil.java
│ │ ├── ExecutorUtil.java
│ │ ├── MSUtils.java
│ │ ├── MetaObjectUtil.java
│ │ ├── MetaObjectWithReflectCache.java
│ │ ├── PageObjectUtil.java
│ │ ├── SqlSafeUtil.java
│ │ ├── StackTraceUtil.java
│ │ └── StringUtil.java
│ └── test/
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── pagehelper/
│ │ ├── mapper/
│ │ │ ├── ProviderMethod.java
│ │ │ └── UserMapper.java
│ │ ├── model/
│ │ │ ├── Code.java
│ │ │ ├── User.java
│ │ │ ├── UserCode.java
│ │ │ ├── UserExample.java
│ │ │ └── UserQueryModel.java
│ │ ├── rowbounds/
│ │ │ ├── RowBoundsHelper.java
│ │ │ └── test/
│ │ │ ├── PageRowBoundsTest.java
│ │ │ └── RowBoundsTest.java
│ │ ├── sql/
│ │ │ ├── DefaultOrderBySqlParserTest.java
│ │ │ ├── SqlServerTest.java
│ │ │ └── SqlTest.java
│ │ ├── test/
│ │ │ ├── basic/
│ │ │ │ ├── ArgumentsMapTest.java
│ │ │ │ ├── ArgumentsObjTest.java
│ │ │ │ ├── AsyncCountTest.java
│ │ │ │ ├── CloseableTest.java
│ │ │ │ ├── CollectionMapTest.java
│ │ │ │ ├── CountColumnTest.java
│ │ │ │ ├── EnumTest.java
│ │ │ │ ├── IPageTest.java
│ │ │ │ ├── OffsetTest.java
│ │ │ │ ├── PageHelperTest.java
│ │ │ │ ├── PageInfoTest.java
│ │ │ │ ├── RemoveOrderTest.java
│ │ │ │ ├── TestDistinct.java
│ │ │ │ ├── TestExecute.java
│ │ │ │ ├── TestISelect.java
│ │ │ │ ├── TestIntMax.java
│ │ │ │ ├── TestLike.java
│ │ │ │ ├── TestNamespaceMap.java
│ │ │ │ ├── annotations/
│ │ │ │ │ └── TestAnnotations.java
│ │ │ │ ├── cache/
│ │ │ │ │ ├── CacheTest.java
│ │ │ │ │ └── SecondCacheTest.java
│ │ │ │ ├── count/
│ │ │ │ │ ├── TestGroupBy.java
│ │ │ │ │ ├── TestOrderBy.java
│ │ │ │ │ └── TestSelectItems.java
│ │ │ │ ├── dynamic/
│ │ │ │ │ ├── CacheTest.java
│ │ │ │ │ ├── TestDynamicChoose.java
│ │ │ │ │ ├── TestDynamicForeach.java
│ │ │ │ │ ├── TestDynamicIf.java
│ │ │ │ │ ├── TestDynamicIf2.java
│ │ │ │ │ ├── TestDynamicIfOrder.java
│ │ │ │ │ ├── TestDynamicIfTwoList.java
│ │ │ │ │ ├── TestDynamicWhere.java
│ │ │ │ │ └── Where.java
│ │ │ │ ├── example/
│ │ │ │ │ └── TestExample.java
│ │ │ │ ├── parameter/
│ │ │ │ │ ├── TestParameterArray.java
│ │ │ │ │ ├── TestParameterList.java
│ │ │ │ │ ├── TestParameterMap.java
│ │ │ │ │ ├── TestParameterNone.java
│ │ │ │ │ └── TestParameterOne.java
│ │ │ │ ├── provider/
│ │ │ │ │ ├── SqlCache.java
│ │ │ │ │ ├── SqlCacheInterceptor.java
│ │ │ │ │ ├── TestBoundSqlInterceptor.java
│ │ │ │ │ ├── TestProvider.java
│ │ │ │ │ └── TestProviderInteceptor.java
│ │ │ │ └── sql/
│ │ │ │ ├── TestExists.java
│ │ │ │ ├── TestLeftjoin.java
│ │ │ │ ├── TestUnion.java
│ │ │ │ └── TestWith.java
│ │ │ ├── features/
│ │ │ │ ├── autodialect/
│ │ │ │ │ ├── AutoDialectTest.java
│ │ │ │ │ ├── DataSourceNegotiationAutoDialectTest.java
│ │ │ │ │ └── SimpleAutoDialect.java
│ │ │ │ └── dialectclass/
│ │ │ │ └── UsingDialectClassTest.java
│ │ │ ├── namespace/
│ │ │ │ └── BasicTest.java
│ │ │ ├── pagesize/
│ │ │ │ ├── PageSizeLessThenOrEqualZeroTest.java
│ │ │ │ └── PageSizeZeroTest.java
│ │ │ ├── reasonable/
│ │ │ │ └── PageTest.java
│ │ │ └── rowbounds/
│ │ │ └── RowBoundsTest.java
│ │ └── util/
│ │ ├── MybatisAutoDialectHelper.java
│ │ ├── MybatisHelper.java
│ │ ├── MybatisInterceptorHelper.java
│ │ ├── MybatisPageSizeZeroHelper.java
│ │ ├── MybatisReasonableHelper.java
│ │ ├── MybatisRowBoundsHelper.java
│ │ ├── Ognl.java
│ │ ├── SqlSafeUtilTest.java
│ │ └── TestUtil.java
│ └── resources/
│ ├── cirrodata/
│ │ ├── cirrodata.sql
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── com/
│ │ └── github/
│ │ └── pagehelper/
│ │ └── mapper/
│ │ └── UserMapper.xml
│ ├── db2/
│ │ ├── db2jcc4.jar
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── derby/
│ │ ├── derby.sql
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── h2/
│ │ ├── h2.sql
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── hsqldb/
│ │ ├── hsqldb.sql
│ │ ├── mybatis-config-autodialect.xml
│ │ ├── mybatis-config-interceptor.xml
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── logback.xml
│ ├── mariadb/
│ │ ├── mariadb.sql
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── mybatis-config-async-count.xml
│ ├── mysql/
│ │ ├── mybatis-config-autodialect.xml
│ │ ├── mybatis-config-interceptor.xml
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ ├── mybatis-config.xml
│ │ └── mysql.sql
│ ├── oracle/
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ ├── mybatis-config.xml
│ │ └── oracle.sql
│ ├── postgresql/
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ ├── mybatis-config.xml
│ │ └── postgresql.sql
│ ├── rowbounds/
│ │ ├── hsqldb.sql
│ │ └── mybatis-config.xml
│ ├── sqlserver/
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── test.properties
│ └── xugu/
│ ├── mybatis-config-interceptor.xml
│ ├── mybatis-config-pagesizezero.xml
│ ├── mybatis-config-reasonable.xml
│ ├── mybatis-config-rowbounds.xml
│ ├── mybatis-config.xml
│ └── mysql.sql
└── wikis/
├── en/
│ ├── Changelog.md
│ ├── HowToUse.md
│ ├── Important.md
│ └── Test.md
└── zh/
├── Changelog.md
├── HowToUse.md
├── Important.md
├── Interceptor.md
└── Test.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
[*.java]
ij_java_align_group_field_declarations = true
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: abel533
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://mybatis.io/donates.html'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
================================================
FILE: .github/issue_template.md
================================================
---
name: PageHelper issue report template
about: If you would like to report a issue to PageHelper, please use this template.
---
- [ ] 我已在 [issues](https://github.com/pagehelper/Mybatis-PageHelper/issues) 搜索类似问题,并且不存在相同的问题.
## 异常模板
### 使用环境
* PageHelper 版本: xxx
* 数据库类型和版本: xxx
* JDBC_URL: xxx
### SQL 解析错误
#### 分页参数
```java
PageHelper.startPage(1, 10);
xxMapper.select(model);
```
#### 原 SQL
```sql
select * from xxx where xxx = xxx
```
#### 期望的结果:
```sql
select * from xxx where xxx = xxx limit 10
```
### 完整异常信息
```
异常信息放在这里
```
### 其他类型的错误
## 功能建议
详细说明,尽可能提供(伪)代码示例。
================================================
FILE: .github/workflows/pull-request.yml
================================================
name: Maven verify
on:
pull_request:
types: [ opened, reopened, edited ]
jobs:
mvn_verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Maven Central Repository
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Run the Maven verify phase
run: mvn --batch-mode --update-snapshots -P dev verify -Dsurefire.useFile=false -DdisableXmlReport=true
================================================
FILE: .github/workflows/release.yml
================================================
name: Publish package to the Maven Central Repository
on:
push:
tags: [ "*" ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Maven Central Repository
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- id: install-secret-key
name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Publish package
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: |
mvn --batch-mode -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -P release clean deploy
================================================
FILE: .gitignore
================================================
# Maven #
target/
dependency-reduced-pom.xml
# IDEA #
.idea/
*.iml
# Eclipse #
.settings/
.classpath
.project
.vscode/
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2014-2022 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.
================================================
FILE: README.md
================================================

# MyBatis 分页插件 - PageHelper
[](https://travis-ci.org/pagehelper/Mybatis-PageHelper)
[](https://maven-badges.herokuapp.com/maven-central/com.github.pagehelper/pagehelper)
[English](README_en.md)
如果你也在用 MyBatis,建议尝试该分页插件,这一定是<b>最方便</b>使用的分页插件。
分页插件支持任何复杂的单表、多表分页,部分特殊情况请看[重要提示](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/Important.md)。
想要使用分页插件?请看[如何使用分页插件](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/HowToUse.md)。
## 《MyBatis 从入门到精通》

[京东](https://item.jd.com/12103309.html) ,[当当](http://product.dangdang.com/25098208.html)
,[亚马逊](https://www.amazon.cn/MyBatis从入门到精通-刘增辉/dp/B072RC11DM/ref=sr_1_18?ie=UTF8&qid=1498007125&sr=8-18&keywords=mybatis)
CSDN博客:http://blog.csdn.net/isea533/article/details/73555400
GitHub项目:https://github.com/mybatis-book/book
## 支持 [MyBatis 3.1.0+](https://github.com/mybatis/mybatis-3)
## PageHelper 6 支持 jdk8+
## PageHelper 5 支持 jdk6+
## 物理分页
该插件目前支持以下数据库的<b>物理分页</b> [PageAutoDialect](src/main/java/com/github/pagehelper/page/PageAutoDialect.java):
```java
static {
//注册别名
registerDialectAlias("hsqldb",HsqldbDialect.class);
registerDialectAlias("h2",HsqldbDialect.class);
registerDialectAlias("phoenix",HsqldbDialect.class);
registerDialectAlias("postgresql",PostgreSqlDialect.class);
registerDialectAlias("mysql",MySqlDialect.class);
registerDialectAlias("mariadb",MySqlDialect.class);
registerDialectAlias("sqlite",MySqlDialect.class);
registerDialectAlias("herddb",HerdDBDialect.class);
registerDialectAlias("oracle",OracleDialect.class);
registerDialectAlias("oracle9i",Oracle9iDialect.class);
registerDialectAlias("db2",Db2Dialect.class);
registerDialectAlias("as400",AS400Dialect.class);
registerDialectAlias("informix",InformixDialect.class);
//解决 informix-sqli #129,仍然保留上面的
registerDialectAlias("informix-sqli",InformixDialect.class);
registerDialectAlias("sqlserver",SqlServerDialect.class);
registerDialectAlias("sqlserver2012",SqlServer2012Dialect.class);
registerDialectAlias("derby",SqlServer2012Dialect.class);
//达梦数据库,https://github.com/mybatis-book/book/issues/43
registerDialectAlias("dm",OracleDialect.class);
//阿里云PPAS数据库,https://github.com/pagehelper/Mybatis-PageHelper/issues/281
registerDialectAlias("edb",OracleDialect.class);
//神通数据库
registerDialectAlias("oscar",OscarDialect.class);
registerDialectAlias("clickhouse",MySqlDialect.class);
//瀚高数据库
registerDialectAlias("highgo",HsqldbDialect.class);
//虚谷数据库
registerDialectAlias("xugu",HsqldbDialect.class);
registerDialectAlias("impala",HsqldbDialect.class);
registerDialectAlias("firebirdsql",FirebirdDialect.class);
//人大金仓数据库
registerDialectAlias("kingbase",PostgreSqlDialect.class);
// 人大金仓新版本kingbase8
registerDialectAlias("kingbase8",PostgreSqlDialect.class);
//行云数据库
registerDialectAlias("xcloud",CirroDataDialect.class);
//openGauss数据库
registerDialectAlias("opengauss",PostgreSqlDialect.class);
//注册 AutoDialect
//想要实现和以前版本相同的效果时,可以配置 autoDialectClass=old
registerAutoDialectAlias("old",DefaultAutoDialect.class);
registerAutoDialectAlias("hikari",HikariAutoDialect.class);
registerAutoDialectAlias("druid",DruidAutoDialect.class);
registerAutoDialectAlias("tomcat-jdbc",TomcatAutoDialect.class);
registerAutoDialectAlias("dbcp",DbcpAutoDialect.class);
registerAutoDialectAlias("c3p0",C3P0AutoDialect.class);
//不配置时,默认使用 DataSourceNegotiationAutoDialect
registerAutoDialectAlias("default",DataSourceNegotiationAutoDialect.class);
}
```
> 如果你使用的数据库不在这个列表时,你可以配置 `dialectAlias` 参数。
>
>这个参数允许配置自定义实现的别名,可以用于根据 JDBCURL 自动获取对应实现,允许通过此种方式覆盖已有的实现,配置示例如(多个配置时使用分号隔开):
>
>```xml
><property name="dialectAlias" value="oracle=com.github.pagehelper.dialect.helper.OracleDialect"/>
><!-- 6.0支持下面的引用方式,引用 Oracle9iDialect.class 的实现 -->
><property name="dialectAlias" value="oracle=oracle9i"/>
><!-- 6.0支持下面的引用方式,达梦使用oracle语法分页,简化类全名写法 -->
><property name="dialectAlias" value="dm=oracle"/>
>```
## 使用 [QueryInterceptor 规范](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/src/main/java/com/github/pagehelper/QueryInterceptor.java)
[Executor 拦截器高级教程 - QueryInterceptor 规范](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/Interceptor.md)
## 集成
使用 PageHelper 你只需要在 classpath
中包含 [pagehelper-x.y.z.jar](http://repo1.maven.org/maven2/com/github/pagehelper/pagehelper/)
和 [jsqlparser-x.y.z.jar](http://repo1.maven.org/maven2/com/github/jsqlparser/jsqlparser/)。
> pagehelper 和 jsqlparser 对应关系参考 pom.xml 中的依赖版本。
如果你使用 Maven,你只需要在 pom.xml 中添加下面的依赖:
```xml
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>最新版本</version>
</dependency>
```
如果你使用 Spring Boot 可以参考: [pagehelper-spring-boot-starter](https://github.com/pagehelper/pagehelper-spring-boot)
[继续查看配置和用法](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/HowToUse.md)
## 文档:
- [如何使用分页插件](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/HowToUse.md)
- [更新日志](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/Changelog.md)
- [重要提示](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/Important.md)
## Spring 集成示例
- [集成 Spring 3.x](https://github.com/abel533/Mybatis-Spring/tree/spring3.x)
- [集成 Spring 4.x](https://github.com/abel533/Mybatis-Spring)
- [集成 Spring Boot](https://github.com/abel533/MyBatis-Spring-Boot)
## 提交 BUG
https://github.com/pagehelper/Mybatis-PageHelper/issues/new
## 微信公众号
<img src="wx_mybatis.jpg" height="300"/>
## 项目的发展离不开你的支持
### 请作者喝杯咖啡吧!
<img src="ali_pay.png" height="300"/>
<img src="wx_pay.png" height="300"/>
## 作者信息
网站:https://mybatis.io
作者博客:http://blog.csdn.net/isea533
作者邮箱: abel533@gmail.com
如需加群,请通过 http://mybatis.io 首页按钮加群。
本项目在 github 的项目地址:https://github.com/pagehelper/Mybatis-PageHelper
本项目在 gitosc 的项目地址:http://git.oschina.net/free/Mybatis_PageHelper
## MyBatis-3
- 项目:https://github.com/mybatis/mybatis-3
- 文档:http://mybatis.github.io/mybatis-3/zh/index.html
MyBatis 专栏:
- [MyBatis示例](http://blog.csdn.net/column/details/mybatis-sample.html)
- [MyBatis问题集](http://blog.csdn.net/column/details/mybatisqa.html)
## 感谢所有项目贡献者!
<a href="https://github.com/pagehelper/Mybatis-PageHelper/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=pagehelper/Mybatis-PageHelper" />
</a>
================================================
FILE: README_en.md
================================================

# MyBatis Pagination - PageHelper
[](https://travis-ci.org/pagehelper/Mybatis-PageHelper)
[](https://maven-badges.herokuapp.com/maven-central/com.github.pagehelper/pagehelper)
[中文版文档](README.md)
If you are using MyBatis, it is recommended to try this pagination plugin. This must be the **MOST CONVENIENT**
pagination plugin.
PageHelper supports any complex single-table, multi-table queries.
As to some special cases, please refer to the [**Important
note**](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/Important.md).
Want to use PageHelper?
Please check out [**How to use
PageHelper**](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/HowToUse.md).
## New JavaDoc
https://apidoc.gitee.com/free/Mybatis_PageHelper
APIs: https://apidoc.gitee.com/free/Mybatis_PageHelper/com/github/pagehelper/page/PageMethod.html
## 《MyBatis 从入门到精通》

[京东](https://item.jd.com/12103309.html) ,[当当](http://product.dangdang.com/25098208.html)
,[Amazon](https://www.amazon.cn/MyBatis从入门到精通-刘增辉/dp/B072RC11DM/ref=sr_1_18?ie=UTF8&qid=1498007125&sr=8-18&keywords=mybatis)
CSDN Blog:http://blog.csdn.net/isea533/article/details/73555400
GitHub:https://github.com/mybatis-book/book
## Support [MyBatis 3.1.0+](https://github.com/mybatis/mybatis-3)
## PageHelper 6 Support jdk8+
## PageHelper 5 Support jdk6+
## Physical Paging
PageHelper supports the following
databases [PageAutoDialect](src/main/java/com/github/pagehelper/page/PageAutoDialect.java):
```java
static {
//register alias
registerDialectAlias("hsqldb",HsqldbDialect.class);
registerDialectAlias("h2",HsqldbDialect.class);
registerDialectAlias("phoenix",HsqldbDialect.class);
registerDialectAlias("postgresql",PostgreSqlDialect.class);
registerDialectAlias("mysql",MySqlDialect.class);
registerDialectAlias("mariadb",MySqlDialect.class);
registerDialectAlias("sqlite",MySqlDialect.class);
registerDialectAlias("herddb",HerdDBDialect.class);
registerDialectAlias("oracle",OracleDialect.class);
registerDialectAlias("oracle9i",Oracle9iDialect.class);
registerDialectAlias("db2",Db2Dialect.class);
registerDialectAlias("as400",AS400Dialect.class);
registerDialectAlias("informix",InformixDialect.class);
//Solve informix-sqli #129, still keep the above
registerDialectAlias("informix-sqli",InformixDialect.class);
registerDialectAlias("sqlserver",SqlServerDialect.class);
registerDialectAlias("sqlserver2012",SqlServer2012Dialect.class);
registerDialectAlias("derby",SqlServer2012Dialect.class);
//达梦数据库,https://github.com/mybatis-book/book/issues/43
registerDialectAlias("dm",OracleDialect.class);
//阿里云PPAS数据库,https://github.com/pagehelper/Mybatis-PageHelper/issues/281
registerDialectAlias("edb",OracleDialect.class);
//神通数据库
registerDialectAlias("oscar",OscarDialect.class);
registerDialectAlias("clickhouse",MySqlDialect.class);
//瀚高数据库
registerDialectAlias("highgo",HsqldbDialect.class);
//虚谷数据库
registerDialectAlias("xugu",HsqldbDialect.class);
registerDialectAlias("impala",HsqldbDialect.class);
registerDialectAlias("firebirdsql",FirebirdDialect.class);
//人大金仓数据库
registerDialectAlias("kingbase",PostgreSqlDialect.class);
// 人大金仓新版本kingbase8
registerDialectAlias("kingbase8",PostgreSqlDialect.class);
//行云数据库
registerDialectAlias("xcloud",CirroDataDialect.class);
//openGauss数据库
registerDialectAlias("opengauss",PostgreSqlDialect.class);
//注册 AutoDialect
//If you want to achieve the same effect as the previous version, you can configure it autoDialectClass=old
registerAutoDialectAlias("old",DefaultAutoDialect.class);
registerAutoDialectAlias("hikari",HikariAutoDialect.class);
registerAutoDialectAlias("druid",DruidAutoDialect.class);
registerAutoDialectAlias("tomcat-jdbc",TomcatAutoDialect.class);
registerAutoDialectAlias("dbcp",DbcpAutoDialect.class);
registerAutoDialectAlias("c3p0",C3P0AutoDialect.class);
//If not configured, it is used by default DataSourceNegotiationAutoDialect
registerAutoDialectAlias("default",DataSourceNegotiationAutoDialect.class);
}
```
> If the database you are using is not in this list, you can configure the `dialectAlias` parameter.
>
> This parameter allows to configure the alias of a custom implementation,
> which can be used to automatically obtain the corresponding implementation according to the JDBCURL,
> and allows to overwrite the existing implementation in this way.
> The configuration example is as follows (use semicolons to separate multiple alias):
>
>```xml
><property name="dialectAlias" value="oracle=com.github.pagehelper.dialect.helper.OracleDialect"/>
><!-- 6.0 The following reference is supported, referencing the implementation of Oracle9iDialect.class -->
><property name="dialectAlias" value="oracle=oracle9i"/>
><!-- 6.0 To support the following citation methods, DM uses oracle syntax for pagination to simplify the writing of the full name of the class -->
><property name="dialectAlias" value="dm=oracle"/>
>```
## Use [QueryInterceptor spec](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/src/main/java/com/github/pagehelper/QueryInterceptor.java)
## Installation
To use PageHelper, you just need to include the
[pagehelper-x.y.z.jar](http://repo1.maven.org/maven2/com/github/pagehelper/pagehelper/)
and [jsqlparser-x.y.z.jar](http://repo1.maven.org/maven2/com/github/jsqlparser/jsqlparser/) file in the classpath.
> For version matching relation, please refer to the dependent version in pom.
If you are using Maven, you could just add the following dependency to your `pom.xml`:
```xml
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>latest version</version>
</dependency>
```
If you are using Spring Boot, You can refer to
the [pagehelper-spring-boot-starter](https://github.com/pagehelper/pagehelper-spring-boot)
[More...](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/HowToUse.md)
## Documentation
- [How to use the PageHelper](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/HowToUse.md)
- [Changelog](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/Changelog.md)
- [Important note](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/Important.md)
## Spring integration sample
- [Integration Spring 3.x](https://github.com/abel533/Mybatis-Spring/tree/spring3.x)
- [Integration Spring 4.x](https://github.com/abel533/Mybatis-Spring)
- [Integration Spring Boot](https://github.com/abel533/MyBatis-Spring-Boot)
## Submit BUG
https://github.com/pagehelper/Mybatis-PageHelper/issues/new
## 微信公众号
<img src="wx_mybatis.jpg" height="300"/>
## Thank you for your support
### Buy the author a cup of coffee!
<img src="ali_pay.png" height="300"/>
<img src="wx_pay.png" height="300"/>
## Author Info
Web: https://mybatis.io
Blog: http://blog.csdn.net/isea533
Email: abel533@gmail.com
PageHelper on github:https://github.com/pagehelper/Mybatis-PageHelper
PageHelper on gitosc:http://git.oschina.net/free/Mybatis_PageHelper
## MyBatis-3
- Project:https://github.com/mybatis/mybatis-3
- Document:https://mybatis.org/mybatis-3/index.html
MyBatis 专栏:
- [MyBatis Sample](http://blog.csdn.net/column/details/mybatis-sample.html)
- [MyBatis QA](http://blog.csdn.net/column/details/mybatisqa.html)
## Thanks to all the people who already contributed!
<a href="https://github.com/pagehelper/Mybatis-PageHelper/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=pagehelper/Mybatis-PageHelper" />
</a>
================================================
FILE: jsqlparser4_7兼容性改动.patch
================================================
Subject: [PATCH] jsqlparser4.7兼容性改动
---
Index: src/main/java/com/github/pagehelper/parser/OrderByParser.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/com/github/pagehelper/parser/OrderByParser.java b/src/main/java/com/github/pagehelper/parser/OrderByParser.java
--- a/src/main/java/com/github/pagehelper/parser/OrderByParser.java (revision 1ae113e493b480452c69af931124ebd5c1ce09f6)
+++ b/src/main/java/com/github/pagehelper/parser/OrderByParser.java (date 1700463025360)
@@ -56,9 +56,8 @@
try {
stmt = jSqlParser.parse(sql);
Select select = (Select) stmt;
- SelectBody selectBody = select.getSelectBody();
//处理body-去最外层order by
- List<OrderByElement> orderByElements = extraOrderBy(selectBody);
+ List<OrderByElement> orderByElements = extraOrderBy(select);
String defaultOrderBy = PlainSelect.orderByToString(orderByElements);
if (defaultOrderBy.indexOf('?') != -1) {
throw new PageException("The order by in the original SQL[" + sql + "] contains parameters, so it cannot be modified using the OrderBy plugin!");
@@ -85,25 +84,16 @@
/**
* extra order by and set default orderby to null
*
- * @param selectBody
+ * @param select
*/
- public static List<OrderByElement> extraOrderBy(SelectBody selectBody) {
- if (selectBody != null) {
- if (selectBody instanceof PlainSelect) {
- List<OrderByElement> orderByElements = ((PlainSelect) selectBody).getOrderByElements();
- ((PlainSelect) selectBody).setOrderByElements(null);
+ public static List<OrderByElement> extraOrderBy(Select select) {
+ if (select != null) {
+ if (select instanceof PlainSelect || select instanceof SetOperationList) {
+ List<OrderByElement> orderByElements = select.getOrderByElements();
+ select.setOrderByElements(null);
return orderByElements;
- } else if (selectBody instanceof WithItem) {
- WithItem withItem = (WithItem) selectBody;
- if (withItem.getSubSelect() != null) {
- return extraOrderBy(withItem.getSubSelect().getSelectBody());
- }
- } else {
- SetOperationList operationList = (SetOperationList) selectBody;
- if (operationList.getSelects() != null && operationList.getSelects().size() > 0) {
- List<SelectBody> plainSelects = operationList.getSelects();
- return extraOrderBy(plainSelects.get(plainSelects.size() - 1));
- }
+ } else if (select instanceof ParenthesedSelect) {
+ extraOrderBy(((ParenthesedSelect) select).getSelect());
}
}
return null;
Index: src/main/java/com/github/pagehelper/parser/SqlServerParser.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/com/github/pagehelper/parser/SqlServerParser.java b/src/main/java/com/github/pagehelper/parser/SqlServerParser.java
--- a/src/main/java/com/github/pagehelper/parser/SqlServerParser.java (revision 1ae113e493b480452c69af931124ebd5c1ce09f6)
+++ b/src/main/java/com/github/pagehelper/parser/SqlServerParser.java (date 1700466304213)
@@ -138,64 +138,62 @@
* @return
*/
protected Select getPageSelect(Select select) {
- SelectBody selectBody = select.getSelectBody();
- if (selectBody instanceof SetOperationList) {
- selectBody = wrapSetOperationList((SetOperationList) selectBody);
+ if (select instanceof SetOperationList) {
+ select = wrapSetOperationList((SetOperationList) select);
}
//这里的selectBody一定是PlainSelect
- if (((PlainSelect) selectBody).getTop() != null) {
+ if (((PlainSelect) select).getTop() != null) {
throw new PageException("The pagination statement already contains the top, and can no longer be used to query the pagination plugin!");
}
//获取查询列
- List<SelectItem> selectItems = getSelectItems((PlainSelect) selectBody);
+ List<SelectItem<?>> selectItems = getSelectItems((PlainSelect) select);
//对一层的SQL增加ROW_NUMBER()
- List<SelectItem> autoItems = new ArrayList<SelectItem>();
- SelectItem orderByColumn = addRowNumber((PlainSelect) selectBody, autoItems);
+ List<SelectItem<?>> autoItems = new ArrayList<>();
+ SelectItem<?> orderByColumn = addRowNumber((PlainSelect) select, autoItems);
//加入自动生成列
- ((PlainSelect) selectBody).addSelectItems(autoItems.toArray(new SelectItem[autoItems.size()]));
+ ((PlainSelect) select).addSelectItems(autoItems.toArray(new SelectItem[0]));
//处理子语句中的order by
- processSelectBody(selectBody, 0);
+ processSelectBody(select, 0);
//中层子查询
PlainSelect innerSelectBody = new PlainSelect();
//PAGE_ROW_NUMBER
innerSelectBody.addSelectItems(orderByColumn);
- innerSelectBody.addSelectItems(selectItems.toArray(new SelectItem[selectItems.size()]));
+ innerSelectBody.addSelectItems(selectItems.toArray(new SelectItem[0]));
//将原始查询作为内层子查询
- SubSelect fromInnerItem = new SubSelect();
- fromInnerItem.setSelectBody(selectBody);
+ ParenthesedSelect fromInnerItem = new ParenthesedSelect();
+ fromInnerItem.setSelect(select);
fromInnerItem.setAlias(PAGE_TABLE_ALIAS);
innerSelectBody.setFromItem(fromInnerItem);
//新建一个select
- Select newSelect = new Select();
- PlainSelect newSelectBody = new PlainSelect();
+ PlainSelect newSelect = new PlainSelect();
//设置top
Top top = new Top();
top.setExpression(new LongValue(Long.MAX_VALUE));
- newSelectBody.setTop(top);
+ newSelect.setTop(top);
//设置order by
List<OrderByElement> orderByElements = new ArrayList<OrderByElement>();
OrderByElement orderByElement = new OrderByElement();
orderByElement.setExpression(PAGE_ROW_NUMBER_COLUMN);
orderByElements.add(orderByElement);
- newSelectBody.setOrderByElements(orderByElements);
+ newSelect.setOrderByElements(orderByElements);
//设置where
GreaterThan greaterThan = new GreaterThan();
greaterThan.setLeftExpression(PAGE_ROW_NUMBER_COLUMN);
greaterThan.setRightExpression(new LongValue(Long.MIN_VALUE));
- newSelectBody.setWhere(greaterThan);
+ newSelect.setWhere(greaterThan);
//设置selectItems
- newSelectBody.setSelectItems(selectItems);
+ newSelect.setSelectItems(selectItems);
//设置fromIterm
- SubSelect fromItem = new SubSelect();
- fromItem.setSelectBody(innerSelectBody); //中层子查询
+ ParenthesedSelect fromItem = new ParenthesedSelect();
+ fromItem.setSelect(innerSelectBody); //中层子查询
fromItem.setAlias(PAGE_TABLE_ALIAS);
- newSelectBody.setFromItem(fromItem);
+ newSelect.setFromItem(fromItem);
- newSelect.setSelectBody(newSelectBody);
if (isNotEmptyList(select.getWithItemsList())) {
newSelect.setWithItemsList(select.getWithItemsList());
+ select.setWithItemsList(null);
}
return newSelect;
}
@@ -206,20 +204,20 @@
* @param setOperationList
* @return
*/
- protected SelectBody wrapSetOperationList(SetOperationList setOperationList) {
+ protected Select wrapSetOperationList(SetOperationList setOperationList) {
//获取最后一个plainSelect
- SelectBody setSelectBody = setOperationList.getSelects().get(setOperationList.getSelects().size() - 1);
+ Select setSelectBody = setOperationList.getSelects().get(setOperationList.getSelects().size() - 1);
if (!(setSelectBody instanceof PlainSelect)) {
throw new PageException("Unable to process the SQL, you can submit issues in GitHub for help.!");
}
PlainSelect plainSelect = (PlainSelect) setSelectBody;
PlainSelect selectBody = new PlainSelect();
- List<SelectItem> selectItems = getSelectItems(plainSelect);
+ List<SelectItem<?>> selectItems = getSelectItems(plainSelect);
selectBody.setSelectItems(selectItems);
//设置fromIterm
- SubSelect fromItem = new SubSelect();
- fromItem.setSelectBody(setOperationList);
+ ParenthesedSelect fromItem = new ParenthesedSelect();
+ fromItem.setSelect(setOperationList);
fromItem.setAlias(new Alias(WRAP_TABLE));
selectBody.setFromItem(fromItem);
//order by
@@ -236,33 +234,27 @@
* @param plainSelect
* @return
*/
- protected List<SelectItem> getSelectItems(PlainSelect plainSelect) {
+ protected List<SelectItem<?>> getSelectItems(PlainSelect plainSelect) {
//设置selectItems
- List<SelectItem> selectItems = new ArrayList<SelectItem>();
- for (SelectItem selectItem : plainSelect.getSelectItems()) {
- //别名需要特殊处理
- if (selectItem instanceof SelectExpressionItem) {
- SelectExpressionItem selectExpressionItem = (SelectExpressionItem) selectItem;
- if (selectExpressionItem.getAlias() != null) {
- //直接使用别名
- Column column = new Column(selectExpressionItem.getAlias().getName());
- SelectExpressionItem expressionItem = new SelectExpressionItem(column);
- selectItems.add(expressionItem);
- } else if (selectExpressionItem.getExpression() instanceof Column) {
- Column column = (Column) selectExpressionItem.getExpression();
- SelectExpressionItem item = null;
- if (column.getTable() != null) {
- Column newColumn = new Column(column.getColumnName());
- item = new SelectExpressionItem(newColumn);
- selectItems.add(item);
- } else {
- selectItems.add(selectItem);
- }
+ List<SelectItem<?>> selectItems = new ArrayList<>();
+ for (SelectItem<?> selectItem : plainSelect.getSelectItems()) {
+ if (selectItem.getExpression() instanceof AllTableColumns) {
+ selectItems.add(new SelectItem<>(new AllColumns()));
+ } else if (selectItem.getAlias() != null) {
+ //直接使用别名
+ Column column = new Column(selectItem.getAlias().getName());
+ SelectItem<?> expressionItem = new SelectItem<>(column);
+ selectItems.add(expressionItem);
+ } else if (selectItem.getExpression() instanceof Column) {
+ Column column = (Column) selectItem.getExpression();
+ SelectItem<?> item = null;
+ if (column.getTable() != null) {
+ Column newColumn = new Column(column.getColumnName());
+ item = new SelectItem<>(newColumn);
+ selectItems.add(item);
} else {
selectItems.add(selectItem);
}
- } else if (selectItem instanceof AllTableColumns) {
- selectItems.add(new AllColumns());
} else {
selectItems.add(selectItem);
}
@@ -272,8 +264,8 @@
// SELECT * FROM (SELECT *, 1 AS alias FROM TEST)
// 不应该为
// SELECT *, alias FROM (SELECT *, 1 AS alias FROM TEST)
- for (SelectItem selectItem : selectItems) {
- if (selectItem instanceof AllColumns) {
+ for (SelectItem<?> selectItem : selectItems) {
+ if (selectItem.getExpression() instanceof AllColumns) {
return Collections.singletonList(selectItem);
}
}
@@ -287,7 +279,7 @@
* @param autoItems 自动生成的查询列
* @return ROW_NUMBER() 列
*/
- protected SelectItem addRowNumber(PlainSelect plainSelect, List<SelectItem> autoItems) {
+ protected SelectItem<?> addRowNumber(PlainSelect plainSelect, List<SelectItem<?>> autoItems) {
//增加ROW_NUMBER()
StringBuilder orderByBuilder = new StringBuilder();
orderByBuilder.append("ROW_NUMBER() OVER (");
@@ -301,28 +293,28 @@
}
orderByBuilder.append(") ");
orderByBuilder.append(PAGE_ROW_NUMBER);
- return new SelectExpressionItem(new Column(orderByBuilder.toString()));
+ return new SelectItem<>(new Column(orderByBuilder.toString()));
}
/**
* 处理selectBody去除Order by
*
- * @param selectBody
+ * @param select
*/
- protected void processSelectBody(SelectBody selectBody, int level) {
- if (selectBody != null) {
- if (selectBody instanceof PlainSelect) {
- processPlainSelect((PlainSelect) selectBody, level + 1);
- } else if (selectBody instanceof WithItem) {
- WithItem withItem = (WithItem) selectBody;
- if (withItem.getSubSelect() != null) {
- processSelectBody(withItem.getSubSelect().getSelectBody(), level + 1);
+ protected void processSelectBody(Select select, int level) {
+ if (select != null) {
+ if (select instanceof PlainSelect) {
+ processPlainSelect((PlainSelect) select, level + 1);
+ } else if (select instanceof WithItem) {
+ WithItem withItem = (WithItem) select;
+ if (withItem.getSelect() != null) {
+ processSelectBody(withItem.getSelect(), level + 1);
}
} else {
- SetOperationList operationList = (SetOperationList) selectBody;
- if (operationList.getSelects() != null && operationList.getSelects().size() > 0) {
- List<SelectBody> plainSelects = operationList.getSelects();
- for (SelectBody plainSelect : plainSelects) {
+ SetOperationList operationList = (SetOperationList) select;
+ if (operationList.getSelects() != null && !operationList.getSelects().isEmpty()) {
+ List<Select> plainSelects = operationList.getSelects();
+ for (Select plainSelect : plainSelects) {
processSelectBody(plainSelect, level + 1);
}
}
@@ -346,7 +338,7 @@
if (plainSelect.getFromItem() != null) {
processFromItem(plainSelect.getFromItem(), level + 1);
}
- if (plainSelect.getJoins() != null && plainSelect.getJoins().size() > 0) {
+ if (plainSelect.getJoins() != null && !plainSelect.getJoins().isEmpty()) {
List<Join> joins = plainSelect.getJoins();
for (Join join : joins) {
if (join.getRightItem() != null) {
@@ -362,33 +354,14 @@
* @param fromItem
*/
protected void processFromItem(FromItem fromItem, int level) {
- if (fromItem instanceof SubJoin) {
- SubJoin subJoin = (SubJoin) fromItem;
- if (subJoin.getJoinList() != null && subJoin.getJoinList().size() > 0) {
- for (Join join : subJoin.getJoinList()) {
- if (join.getRightItem() != null) {
- processFromItem(join.getRightItem(), level + 1);
- }
- }
- }
- if (subJoin.getLeft() != null) {
- processFromItem(subJoin.getLeft(), level + 1);
- }
- } else if (fromItem instanceof SubSelect) {
- SubSelect subSelect = (SubSelect) fromItem;
- if (subSelect.getSelectBody() != null) {
- processSelectBody(subSelect.getSelectBody(), level + 1);
- }
- } else if (fromItem instanceof ValuesList) {
-
- } else if (fromItem instanceof LateralSubSelect) {
- LateralSubSelect lateralSubSelect = (LateralSubSelect) fromItem;
- if (lateralSubSelect.getSubSelect() != null) {
- SubSelect subSelect = lateralSubSelect.getSubSelect();
- if (subSelect.getSelectBody() != null) {
- processSelectBody(subSelect.getSelectBody(), level + 1);
- }
- }
+ if (fromItem instanceof LateralSubSelect) {
+ processSelectBody(((LateralSubSelect) fromItem).getSelect(), level + 1);
+ } else if (fromItem instanceof ParenthesedSelect) {
+ processSelectBody(((ParenthesedSelect) fromItem).getSelect(), level + 1);
+ } else if (fromItem instanceof Select) {
+ processSelectBody((Select) fromItem, level + 1);
+ } else if (fromItem instanceof ParenthesedFromItem) {
+ processFromItem(((ParenthesedFromItem) fromItem).getFromItem(), level + 1);
}
//Table时不用处理
}
@@ -400,7 +373,7 @@
* @return
*/
public boolean isNotEmptyList(List<?> list) {
- if (list == null || list.size() == 0) {
+ if (list == null || list.isEmpty()) {
return false;
}
return true;
@@ -441,13 +414,13 @@
* @return 新的排序列表
*/
protected List<OrderByElement> getOrderByElements(PlainSelect plainSelect,
- List<SelectItem> autoItems) {
+ List<SelectItem<?>> autoItems) {
List<OrderByElement> orderByElements = plainSelect.getOrderByElements();
ListIterator<OrderByElement> iterator = orderByElements.listIterator();
OrderByElement orderByElement;
// 非 `*` 且 非 `t.*` 查询列集合
- Map<String, SelectExpressionItem> selectMap = new HashMap<String, SelectExpressionItem>();
+ Map<String, SelectItem<?>> selectMap = new HashMap<>();
// 别名集合
Set<String> aliases = new HashSet<String>();
// 是否包含 `*` 查询列
@@ -455,21 +428,18 @@
// `t.*` 查询列的表名集合
Set<String> allColumnsTables = new HashSet<String>();
- for (SelectItem item : plainSelect.getSelectItems()) {
- if (item instanceof SelectExpressionItem) {
- SelectExpressionItem expItem = (SelectExpressionItem) item;
- selectMap.put(expItem.getExpression().toString(), expItem);
-
- Alias alias = expItem.getAlias();
+ for (SelectItem<?> item : plainSelect.getSelectItems()) {
+ Expression expression = item.getExpression();
+ if (expression instanceof AllTableColumns) {
+ allColumnsTables.add(((AllTableColumns) expression).getTable().getName());
+ } else if (expression instanceof AllColumns) {
+ allColumns = true;
+ } else {
+ selectMap.put(expression.toString(), item);
+ Alias alias = item.getAlias();
if (alias != null) {
aliases.add(alias.getName());
}
-
- } else if (item instanceof AllColumns) {
- allColumns = true;
-
- } else if (item instanceof AllTableColumns) {
- allColumnsTables.add(((AllTableColumns) item).getTable().getName());
}
}
@@ -478,7 +448,7 @@
while (iterator.hasNext()) {
orderByElement = iterator.next();
Expression expression = orderByElement.getExpression();
- SelectExpressionItem selectExpressionItem = selectMap.get(expression.toString());
+ SelectItem<?> selectExpressionItem = selectMap.get(expression.toString());
if (selectExpressionItem != null) { // OrderByElement 在查询列表中
Alias alias = selectExpressionItem.getAlias();
if (alias != null) { // 查询列含有别名时用查询列别名
@@ -527,8 +497,7 @@
// 将排序列加入查询列中
String aliasName = PAGE_COLUMN_ALIAS_PREFIX + aliasNo++;
- SelectExpressionItem item = new SelectExpressionItem();
- item.setExpression(expression);
+ SelectItem<?> item = new SelectItem<>(expression);
item.setAlias(new Alias(aliasName));
autoItems.add(item);
Index: src/test/java/com/github/pagehelper/sql/FunctionCountTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/test/java/com/github/pagehelper/sql/FunctionCountTest.java b/src/test/java/com/github/pagehelper/sql/FunctionCountTest.java
--- a/src/test/java/com/github/pagehelper/sql/FunctionCountTest.java (revision 1ae113e493b480452c69af931124ebd5c1ce09f6)
+++ b/src/test/java/com/github/pagehelper/sql/FunctionCountTest.java (date 1700464930289)
@@ -31,7 +31,6 @@
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.select.PlainSelect;
import net.sf.jsqlparser.statement.select.Select;
-import net.sf.jsqlparser.statement.select.SelectExpressionItem;
import net.sf.jsqlparser.statement.select.SelectItem;
import org.junit.Test;
@@ -57,17 +56,13 @@
@Test
public void test() {
Select select = select("select max(name),code,min(aa),nvl(ab,0),heh from user where a > 100");
- List<SelectItem> selectItems = ((PlainSelect) select.getSelectBody()).getSelectItems();
+ List<SelectItem<?>> selectItems = ((PlainSelect) select.getSelectBody()).getSelectItems();
for (SelectItem item : selectItems) {
- if (item instanceof SelectExpressionItem) {
- Expression exp = ((SelectExpressionItem) item).getExpression();
- if (exp instanceof Function) {
- System.out.println("Function:" + item.toString());
- } else {
- System.out.println("Not a function:" + exp.toString());
- }
- } else {
- System.out.println("Not a function:" + item.toString());
+ Expression exp = item.getExpression();
+ if (exp instanceof Function) {
+ System.out.println("Function:" + item.toString());
+ } else {
+ System.out.println("Not a function:" + exp.toString());
}
}
}
@@ -75,9 +70,9 @@
@Test
public void test2() {
Select select = select("select distinct(name) from user where a > 100");
- List<SelectItem> selectItems = ((PlainSelect) select.getSelectBody()).getSelectItems();
+ List<SelectItem<?>> selectItems = ((PlainSelect) select.getSelectBody()).getSelectItems();
for (SelectItem item : selectItems) {
- if (item instanceof Function) {
+ if (item.getExpression() instanceof Function) {
System.out.println("Function:" + item.toString());
} else {
System.out.println("Not a function:" + item.toString());
Index: src/test/java/com/github/pagehelper/sql/SqlTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/test/java/com/github/pagehelper/sql/SqlTest.java b/src/test/java/com/github/pagehelper/sql/SqlTest.java
--- a/src/test/java/com/github/pagehelper/sql/SqlTest.java (revision 1ae113e493b480452c69af931124ebd5c1ce09f6)
+++ b/src/test/java/com/github/pagehelper/sql/SqlTest.java (date 1700463025400)
@@ -30,7 +30,6 @@
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.select.Select;
-import net.sf.jsqlparser.statement.select.SelectBody;
import org.junit.Assert;
import org.junit.Test;
@@ -158,8 +157,7 @@
return;
}
Select select = (Select) stmt;
- SelectBody selectBody = select.getSelectBody();
- sql = selectBody.toString();
+ sql = select.toString();
sql = sql.replaceAll("\\s*(\\w*?)_PAGEWITHNOLOCK", " $1 WITH(NOLOCK)");
Assert.assertEquals("SELECT * FROM A WITH(NOLOCK) INNER JOIN B WITH(NOLOCK) ON A.TypeId = B.Id", sql);
Index: pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/pom.xml b/pom.xml
--- a/pom.xml (revision 1ae113e493b480452c69af931124ebd5c1ce09f6)
+++ b/pom.xml (date 1700442371317)
@@ -56,7 +56,7 @@
</scm>
<properties>
- <pagehelper-version>6.0.1-SNAPSHOT</pagehelper-version>
+ <pagehelper-version>6.0.1</pagehelper-version>
<version-suffix></version-suffix>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -68,7 +68,7 @@
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
- <version>4.5</version>
+ <version>4.7</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
Index: src/main/java/com/github/pagehelper/parser/DefaultCountSqlParser.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/com/github/pagehelper/parser/DefaultCountSqlParser.java b/src/main/java/com/github/pagehelper/parser/DefaultCountSqlParser.java
--- a/src/main/java/com/github/pagehelper/parser/DefaultCountSqlParser.java (revision 1ae113e493b480452c69af931124ebd5c1ce09f6)
+++ b/src/main/java/com/github/pagehelper/parser/DefaultCountSqlParser.java (date 1700465554724)
@@ -85,10 +85,9 @@
return getSimpleCountSql(sql, countColumn);
}
Select select = (Select) stmt;
- SelectBody selectBody = select.getSelectBody();
try {
//处理body-去order by
- processSelectBody(selectBody);
+ processSelect(select);
} catch (Exception e) {
//当 sql 包含 group by 时,不去除 order by
return getSimpleCountSql(sql, countColumn);
@@ -96,10 +95,10 @@
//处理with-去order by
processWithItemsList(select.getWithItemsList());
//处理为count查询
- sqlToCount(select, countColumn);
- String result = select.toString();
- if (selectBody instanceof PlainSelect) {
- Token token = ((PlainSelect) selectBody).getASTNode().jjtGetFirstToken().specialToken;
+ Select countSelect = sqlToCount(select, countColumn);
+ String result = countSelect.toString();
+ if (select instanceof PlainSelect) {
+ Token token = select.getASTNode().jjtGetFirstToken().specialToken;
if (token != null) {
String hints = token.toString().trim();
// 这里判断是否存在hint, 且result是不包含hint的
@@ -142,21 +141,25 @@
*
* @param select
*/
- public void sqlToCount(Select select, String name) {
- SelectBody selectBody = select.getSelectBody();
+ public Select sqlToCount(Select select, String name) {
// 是否能简化count查询
- List<SelectItem> COUNT_ITEM = new ArrayList<SelectItem>();
- COUNT_ITEM.add(new SelectExpressionItem(new Column("count(" + name + ")")));
- if (selectBody instanceof PlainSelect && isSimpleCount((PlainSelect) selectBody)) {
- ((PlainSelect) selectBody).setSelectItems(COUNT_ITEM);
+ List<SelectItem<?>> COUNT_ITEM = new ArrayList<>();
+ COUNT_ITEM.add(new SelectItem(new Column("count(" + name + ")")));
+ if (select instanceof PlainSelect && isSimpleCount((PlainSelect) select)) {
+ ((PlainSelect) select).setSelectItems(COUNT_ITEM);
+ return select;
} else {
PlainSelect plainSelect = new PlainSelect();
- SubSelect subSelect = new SubSelect();
- subSelect.setSelectBody(selectBody);
+ ParenthesedSelect subSelect = new ParenthesedSelect();
+ subSelect.setSelect(select);
subSelect.setAlias(TABLE_ALIAS);
plainSelect.setFromItem(subSelect);
plainSelect.setSelectItems(COUNT_ITEM);
- select.setSelectBody(plainSelect);
+ if(select.getWithItemsList() != null) {
+ plainSelect.setWithItemsList(select.getWithItemsList());
+ select.setWithItemsList(null);
+ }
+ return plainSelect;
}
}
@@ -179,37 +182,35 @@
if (select.getHaving() != null) {
return false;
}
- for (SelectItem item : select.getSelectItems()) {
+ for (SelectItem<?> item : select.getSelectItems()) {
//select列中包含参数的时候不可以,否则会引起参数个数错误
if (item.toString().contains("?")) {
return false;
}
//如果查询列中包含函数,也不可以,函数可能会聚合列
- if (item instanceof SelectExpressionItem) {
- Expression expression = ((SelectExpressionItem) item).getExpression();
- if (expression instanceof Function) {
- String name = ((Function) expression).getName();
- if (name != null) {
- String NAME = name.toUpperCase();
- if (skipFunctions.contains(NAME)) {
- //go on
- } else if (falseFunctions.contains(NAME)) {
- return false;
- } else {
- for (String aggregateFunction : AGGREGATE_FUNCTIONS) {
- if (NAME.startsWith(aggregateFunction)) {
- falseFunctions.add(NAME);
- return false;
- }
- }
- skipFunctions.add(NAME);
- }
- }
- } else if (expression instanceof Parenthesis && ((SelectExpressionItem) item).getAlias() != null) {
- //#555,当存在 (a+b) as c 时,c 如果出现了 order by 或者 having 中时,会找不到对应的列,
- // 这里想要更智能,需要在整个SQL中查找别名出现的位置,暂时不考虑,直接排除
- return false;
- }
+ Expression expression = item.getExpression();
+ if (expression instanceof Function) {
+ String name = ((Function) expression).getName();
+ if (name != null) {
+ String NAME = name.toUpperCase();
+ if (skipFunctions.contains(NAME)) {
+ //go on
+ } else if (falseFunctions.contains(NAME)) {
+ return false;
+ } else {
+ for (String aggregateFunction : AGGREGATE_FUNCTIONS) {
+ if (NAME.startsWith(aggregateFunction)) {
+ falseFunctions.add(NAME);
+ return false;
+ }
+ }
+ skipFunctions.add(NAME);
+ }
+ }
+ } else if (expression instanceof Parenthesis && item.getAlias() != null) {
+ //#555,当存在 (a+b) as c 时,c 如果出现了 order by 或者 having 中时,会找不到对应的列,
+ // 这里想要更智能,需要在整个SQL中查找别名出现的位置,暂时不考虑,直接排除
+ return false;
}
}
return true;
@@ -218,29 +219,31 @@
/**
* 处理selectBody去除Order by
*
- * @param selectBody
+ * @param select
*/
- public void processSelectBody(SelectBody selectBody) {
- if (selectBody != null) {
- if (selectBody instanceof PlainSelect) {
- processPlainSelect((PlainSelect) selectBody);
- } else if (selectBody instanceof WithItem) {
+ public void processSelect(Select select) {
+ if (select != null) {
+ if (select instanceof PlainSelect) {
+ processPlainSelect((PlainSelect) select);
+ } else if (select instanceof ParenthesedSelect) {
+ processSelect(((ParenthesedSelect) select).getSelect());
+ } else if (select instanceof SetOperationList) {
+ List<Select> selects = ((SetOperationList) select).getSelects();
+ for (Select sel : selects) {
+ processSelect(sel);
+ }
+ if (!orderByHashParameters(select.getOrderByElements())) {
+ select.setOrderByElements(null);
+ }
+ }
+ /*
+ if (select instanceof WithItem) {
WithItem withItem = (WithItem) selectBody;
if (withItem.getSubSelect() != null && !keepSubSelectOrderBy()) {
processSelectBody(withItem.getSubSelect().getSelectBody());
}
- } else {
- SetOperationList operationList = (SetOperationList) selectBody;
- if (operationList.getSelects() != null && operationList.getSelects().size() > 0) {
- List<SelectBody> plainSelects = operationList.getSelects();
- for (SelectBody plainSelect : plainSelects) {
- processSelectBody(plainSelect);
- }
- }
- if (!orderByHashParameters(operationList.getOrderByElements())) {
- operationList.setOrderByElements(null);
- }
}
+ */
}
}
@@ -272,10 +275,10 @@
* @param withItemsList
*/
public void processWithItemsList(List<WithItem> withItemsList) {
- if (withItemsList != null && withItemsList.size() > 0) {
+ if (withItemsList != null && !withItemsList.isEmpty()) {
for (WithItem item : withItemsList) {
- if (item.getSubSelect() != null && !keepSubSelectOrderBy()) {
- processSelectBody(item.getSubSelect().getSelectBody());
+ if (item.getSelect() != null && !keepSubSelectOrderBy()) {
+ processSelect(item.getSelect());
}
}
}
@@ -287,33 +290,16 @@
* @param fromItem
*/
public void processFromItem(FromItem fromItem) {
- if (fromItem instanceof SubJoin) {
- SubJoin subJoin = (SubJoin) fromItem;
- if (subJoin.getJoinList() != null && subJoin.getJoinList().size() > 0) {
- for (Join join : subJoin.getJoinList()) {
- if (join.getRightItem() != null) {
- processFromItem(join.getRightItem());
- }
- }
- }
- if (subJoin.getLeft() != null) {
- processFromItem(subJoin.getLeft());
- }
- } else if (fromItem instanceof SubSelect) {
- SubSelect subSelect = (SubSelect) fromItem;
- if (subSelect.getSelectBody() != null && !keepSubSelectOrderBy()) {
- processSelectBody(subSelect.getSelectBody());
+ if (fromItem instanceof ParenthesedSelect) {
+ ParenthesedSelect parenthesedSelect = (ParenthesedSelect) fromItem;
+ if (parenthesedSelect.getSelect() != null && !keepSubSelectOrderBy()) {
+ processSelect(parenthesedSelect.getSelect());
}
- } else if (fromItem instanceof ValuesList) {
-
- } else if (fromItem instanceof LateralSubSelect) {
- LateralSubSelect lateralSubSelect = (LateralSubSelect) fromItem;
- if (lateralSubSelect.getSubSelect() != null) {
- SubSelect subSelect = lateralSubSelect.getSubSelect();
- if (subSelect.getSelectBody() != null && !keepSubSelectOrderBy()) {
- processSelectBody(subSelect.getSelectBody());
- }
- }
+ } else if (fromItem instanceof Select) {
+ processSelect((Select) fromItem);
+ } else if (fromItem instanceof ParenthesedFromItem) {
+ ParenthesedFromItem parenthesedFromItem = (ParenthesedFromItem) fromItem;
+ processFromItem(parenthesedFromItem.getFromItem());
}
//Table时不用处理
}
================================================
FILE: pom.xml
================================================
<!--
~ The MIT License (MIT)
~
~ Copyright (c) 2014-2023 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.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>6.1.1</version>
<packaging>jar</packaging>
<name>pagehelper 6</name>
<description>Mybatis Pagination Plugin</description>
<url>https://github.com/pagehelper/Mybatis-PageHelper</url>
<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>https://github.com/pagehelper/Mybatis-PageHelper/blob/master/LICENSE</url>
</license>
</licenses>
<developers>
<developer>
<name>abel533</name>
<email>abel533@gmail.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:pagehelper/Mybatis-PageHelper.git</connection>
<developerConnection>scm:git:git@github.com:pagehelper/Mybatis-PageHelper.git</developerConnection>
<url>git@github.com:pagehelper/Mybatis-PageHelper.git</url>
</scm>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>4.7</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.19</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!--
可选依赖:guava
当项目包含guava时,会使用 GuavaCache,详情看4.2.0更新日志
-->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.4.8-jre</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- 针对多数据源连接池的内部支持 -->
<dependency>
<groupId>com.zaxxer</groupId>
<!-- 这里为了能在 java6 编译选择的低版本,不影响自己选择高版本 -->
<artifactId>HikariCP-java6</artifactId>
<version>2.3.13</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.12</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>10.0.20</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.5</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.9.0</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.9</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/test/resources/db2/db2jcc4.jar</systemPath>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1102-jdbc41</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.190</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.xugudb</groupId>
<artifactId>xugu-jdbc</artifactId>
<version>12.2.0</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<!--Compiler-->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<!-- Source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- GPG mvn clean deploy -P release -Dgpg.passphrase=YourPassphase-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<argument>--pinentry-mode</argument>
<argument>loopback</argument>
</gpgArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
</profiles>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
================================================
FILE: src/main/java/com/github/pagehelper/AutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import com.github.pagehelper.dialect.AbstractHelperDialect;
import org.apache.ibatis.mapping.MappedStatement;
import javax.sql.DataSource;
import java.util.Properties;
/**
* 自动获取方言
*
* @param <K> 缓存key类型
*/
public interface AutoDialect<K> {
/**
* 获取用于缓存 {@link #extractDialect } 方法返回值的 key,当返回 null 时不缓存,返回值时先判断是否已存在,不存在时调用 {@link #extractDialect } 再缓存
*
* @param ms
* @param dataSource
* @param properties
* @return
*/
K extractDialectKey(MappedStatement ms, DataSource dataSource, Properties properties);
/**
* 提取 dialect
*
* @param dialectKey
* @param ms
* @param dataSource
* @param properties
* @return
*/
AbstractHelperDialect extractDialect(K dialectKey, MappedStatement ms, DataSource dataSource, Properties properties);
}
================================================
FILE: src/main/java/com/github/pagehelper/BoundSqlInterceptor.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.mapping.BoundSql;
/**
* BoundSql 处理器
*/
public interface BoundSqlInterceptor {
/**
* boundsql 处理
*
* @param type 类型
* @param boundSql 当前类型的 boundSql
* @param cacheKey 缓存 key
* @param chain 处理器链,通过 chain.doBoundSql 方法继续执行后续方法,也可以直接返回 boundSql 终止后续方法的执行
* @return 允许修改 boundSql 并返回修改后的
*/
BoundSql boundSql(Type type, BoundSql boundSql, CacheKey cacheKey, Chain chain);
enum Type {
/**
* 原始SQL,分页插件执行前,先执行这个类型
*/
ORIGINAL,
/**
* count SQL,第二个执行这里
*/
COUNT_SQL,
/**
* 分页 SQL,最后执行这里
*/
PAGE_SQL
}
/**
* 处理器链,可以控制是否继续执行
*/
interface Chain {
Chain DO_NOTHING = (type, boundSql, cacheKey) -> boundSql;
BoundSql doBoundSql(Type type, BoundSql boundSql, CacheKey cacheKey);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/BoundSqlInterceptorChain.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.mapping.BoundSql;
import java.util.List;
public class BoundSqlInterceptorChain implements BoundSqlInterceptor.Chain {
private final BoundSqlInterceptor.Chain original;
private final List<BoundSqlInterceptor> interceptors;
private int index = 0;
private boolean executable;
public BoundSqlInterceptorChain(BoundSqlInterceptor.Chain original, List<BoundSqlInterceptor> interceptors) {
this(original, interceptors, false);
}
private BoundSqlInterceptorChain(BoundSqlInterceptor.Chain original, List<BoundSqlInterceptor> interceptors, boolean executable) {
this.original = original;
this.interceptors = interceptors;
this.executable = executable;
}
@Override
public BoundSql doBoundSql(BoundSqlInterceptor.Type type, BoundSql boundSql, CacheKey cacheKey) {
if(executable) {
return _doBoundSql(type, boundSql, cacheKey);
} else {
return new BoundSqlInterceptorChain(original, interceptors, true).doBoundSql(type, boundSql, cacheKey);
}
}
private BoundSql _doBoundSql(BoundSqlInterceptor.Type type, BoundSql boundSql, CacheKey cacheKey) {
if (this.interceptors == null || this.interceptors.size() == this.index) {
return this.original != null ? this.original.doBoundSql(type, boundSql, cacheKey) : boundSql;
} else {
return this.interceptors.get(this.index++).boundSql(type, boundSql, cacheKey, this);
}
}
}
================================================
FILE: src/main/java/com/github/pagehelper/Constant.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
/**
* @author liuzh
*/
public interface Constant {
//分页的id后缀
String SUFFIX_PAGE = "_PageHelper";
//count查询的id后缀
String SUFFIX_COUNT = SUFFIX_PAGE + "_Count";
//第一个分页参数
String PAGEPARAMETER_FIRST = "First" + SUFFIX_PAGE;
//第二个分页参数
String PAGEPARAMETER_SECOND = "Second" + SUFFIX_PAGE;
}
================================================
FILE: src/main/java/com/github/pagehelper/CountMsIdGen.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
/**
* 构建当前查询对应的 count 方法 id
* <p>
* 返回的 msId 会先判断是否存在自定义的方法,存在就直接使用
* <p>
* 如果不存在,会根据当前的 msId 创建 MappedStatement
*
* @author liuzh
*/
public interface CountMsIdGen {
/**
* 默认实现
*/
CountMsIdGen DEFAULT = (ms, parameter, boundSql, countSuffix) -> ms.getId() + countSuffix;
/**
* 构建当前查询对应的 count 方法 id
*
* @param ms 查询对应的 MappedStatement
* @param parameter 方法参数
* @param boundSql 查询SQL
* @param countSuffix 配置的 count 后缀
* @return count 查询丢的 msId
*/
String genCountMsId(MappedStatement ms, Object parameter,
BoundSql boundSql, String countSuffix);
}
================================================
FILE: src/main/java/com/github/pagehelper/Dialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.RowBounds;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.Callable;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;
/**
* 数据库方言,针对不同数据库进行实现
*
* @author liuzh
*/
public interface Dialect {
/**
* 跳过 count 和 分页查询
*
* @param ms MappedStatement
* @param parameterObject 方法参数
* @param rowBounds 分页参数
* @return true 跳过,返回默认查询结果,false 执行分页查询
*/
boolean skip(MappedStatement ms, Object parameterObject, RowBounds rowBounds);
/**
* 是否使用异步 count 查询,使用异步后不会根据返回的 count 数来判断是否有必要进行分页查询
*
* @return true 异步,false 同步
*/
default boolean isAsyncCount() {
return false;
}
/**
* 执行异步 count 查询
*
* @param task 异步查询任务
* @param <T>
* @return
*/
default <T> Future<T> asyncCountTask(Callable<T> task) {
return ForkJoinPool.commonPool().submit(task);
}
/**
* 执行分页前,返回 true 会进行 count 查询,false 会继续下面的 beforePage 判断
*
* @param ms MappedStatement
* @param parameterObject 方法参数
* @param rowBounds 分页参数
* @return
*/
boolean beforeCount(MappedStatement ms, Object parameterObject, RowBounds rowBounds);
/**
* 生成 count 查询 sql
*
* @param ms MappedStatement
* @param boundSql 绑定 SQL 对象
* @param parameterObject 方法参数
* @param rowBounds 分页参数
* @param countKey count 缓存 key
* @return
*/
String getCountSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey countKey);
/**
* 执行完 count 查询后
*
* @param count 查询结果总数
* @param parameterObject 接口参数
* @param rowBounds 分页参数
* @return true 继续分页查询,false 直接返回
*/
boolean afterCount(long count, Object parameterObject, RowBounds rowBounds);
/**
* 处理查询参数对象
*
* @param ms MappedStatement
* @param parameterObject
* @param boundSql
* @param pageKey
* @return
*/
Object processParameterObject(MappedStatement ms, Object parameterObject, BoundSql boundSql, CacheKey pageKey);
/**
* 执行分页前,返回 true 会进行分页查询,false 会返回默认查询结果
*
* @param ms MappedStatement
* @param parameterObject 方法参数
* @param rowBounds 分页参数
* @return
*/
boolean beforePage(MappedStatement ms, Object parameterObject, RowBounds rowBounds);
/**
* 生成分页查询 sql
*
* @param ms MappedStatement
* @param boundSql 绑定 SQL 对象
* @param parameterObject 方法参数
* @param rowBounds 分页参数
* @param pageKey 分页缓存 key
* @return
*/
String getPageSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey pageKey);
/**
* 分页查询后,处理分页结果,拦截器中直接 return 该方法的返回值
*
* @param pageList 分页查询结果
* @param parameterObject 方法参数
* @param rowBounds 分页参数
* @return
*/
Object afterPage(List pageList, Object parameterObject, RowBounds rowBounds);
/**
* 完成所有任务后
*/
void afterAll();
/**
* 设置参数
*
* @param properties 插件属性
*/
void setProperties(Properties properties);
}
================================================
FILE: src/main/java/com/github/pagehelper/IPage.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
/**
* @author liuzh
*/
public interface IPage {
Integer getPageNum();
Integer getPageSize();
String getOrderBy();
}
================================================
FILE: src/main/java/com/github/pagehelper/ISelect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
/**
* 分页查询接口
*
* @author liuzh_3nofxnp
* @since 2015-12-18 18:51
*/
public interface ISelect {
/**
* 在接口中调用自己的查询方法,不要在该方法内写过多代码,只要一行查询方法最好
*/
void doSelect();
}
================================================
FILE: src/main/java/com/github/pagehelper/Page.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import com.github.pagehelper.util.SqlSafeUtil;
import com.github.pagehelper.util.StackTraceUtil;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.List;
/**
* Mybatis - 分页对象
*
* @author liuzh/abel533/isea533
* @version 3.6.0
* 项目地址 : http://git.oschina.net/free/Mybatis_PageHelper
*/
public class Page<E> extends ArrayList<E> implements Closeable {
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(Page.class);
/**
* 记录当前堆栈,可查找到page在何处创建
* 需开启pagehelper.debug
*/
private final String stackTrace = PageInterceptor.isDebug() ? StackTraceUtil.current() : null;
/**
* 页码,从1开始
*/
private int pageNum;
/**
* 页面大小
*/
private int pageSize;
/**
* 起始行
*/
private long startRow;
/**
* 末行
*/
private long endRow;
/**
* 总数
*/
private long total;
/**
* 总页数
*/
private int pages;
/**
* 包含count查询
*/
private boolean count = true;
/**
* 分页合理化
*/
private Boolean reasonable;
/**
* 当设置为true的时候,如果pagesize设置为0(或RowBounds的limit=0),就不执行分页,返回全部结果
*/
private Boolean pageSizeZero;
/**
* 进行count查询的列名
*/
private String countColumn;
/**
* 排序
*/
private String orderBy;
/**
* 只增加排序
*/
private boolean orderByOnly;
/**
* sql拦截处理
*/
private BoundSqlInterceptor boundSqlInterceptor;
private transient BoundSqlInterceptor.Chain chain;
/**
* 分页实现类,可以使用 {@link com.github.pagehelper.page.PageAutoDialect} 类中注册的别名,例如 "mysql", "oracle"
*/
private String dialectClass;
/**
* 转换count查询时保留查询的 order by 排序
*/
private Boolean keepOrderBy;
/**
* 转换count查询时保留子查询的 order by 排序
*/
private Boolean keepSubSelectOrderBy;
/**
* 异步count查询
*/
private Boolean asyncCount;
public Page() {
super();
}
public Page(int pageNum, int pageSize) {
this(pageNum, pageSize, true, null);
}
public Page(int pageNum, int pageSize, boolean count) {
this(pageNum, pageSize, count, null);
}
private Page(int pageNum, int pageSize, boolean count, Boolean reasonable) {
super(0);
if (pageNum == 1 && pageSize == Integer.MAX_VALUE) {
pageSizeZero = true;
pageSize = 0;
}
this.pageNum = pageNum;
this.pageSize = pageSize;
this.count = count;
calculateStartAndEndRow();
setReasonable(reasonable);
}
/**
* int[] rowBounds
* 0 : offset
* 1 : limit
*/
public Page(int[] rowBounds, boolean count) {
super(0);
if (rowBounds[0] == 0 && rowBounds[1] == Integer.MAX_VALUE) {
pageSizeZero = true;
this.pageSize = 0;
this.pageNum = 1;
} else {
this.pageSize = rowBounds[1];
this.pageNum = rowBounds[1] != 0 ? (int) (Math.ceil(((double) rowBounds[0] + rowBounds[1]) / rowBounds[1])) : 0;
}
this.startRow = rowBounds[0];
this.count = count;
this.endRow = this.startRow + rowBounds[1];
}
public String getStackTrace() {
return stackTrace;
}
public List<E> getResult() {
return this;
}
public int getPages() {
return pages;
}
public Page<E> setPages(int pages) {
this.pages = pages;
return this;
}
public long getEndRow() {
return endRow;
}
public Page<E> setEndRow(long endRow) {
this.endRow = endRow;
return this;
}
public int getPageNum() {
return pageNum;
}
public Page<E> setPageNum(int pageNum) {
//分页合理化,针对不合理的页码自动处理
this.pageNum = ((reasonable != null && reasonable) && pageNum <= 0) ? 1 : pageNum;
return this;
}
public int getPageSize() {
return pageSize;
}
public Page<E> setPageSize(int pageSize) {
this.pageSize = pageSize;
return this;
}
public long getStartRow() {
return startRow;
}
public Page<E> setStartRow(long startRow) {
this.startRow = startRow;
return this;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
if (total == -1) {
pages = 1;
return;
}
if (pageSize > 0) {
pages = (int) (total / pageSize + ((total % pageSize == 0) ? 0 : 1));
} else {
pages = 0;
}
//分页合理化,针对不合理的页码自动处理
if ((reasonable != null && reasonable) && pageNum > pages) {
if (pages != 0) {
pageNum = pages;
}
calculateStartAndEndRow();
}
}
public Boolean getReasonable() {
return reasonable;
}
public Page<E> setReasonable(Boolean reasonable) {
if (reasonable == null) {
return this;
}
this.reasonable = reasonable;
//分页合理化,针对不合理的页码自动处理
if (this.reasonable && this.pageNum <= 0) {
this.pageNum = 1;
calculateStartAndEndRow();
}
return this;
}
public Boolean getPageSizeZero() {
return pageSizeZero;
}
public Page<E> setPageSizeZero(Boolean pageSizeZero) {
if (this.pageSizeZero == null && pageSizeZero != null) {
this.pageSizeZero = pageSizeZero;
}
return this;
}
public String getOrderBy() {
return orderBy;
}
/**
* 设置排序字段,增加 SQL 注入校验,如果需要在 order by 使用函数,可以使用 {@link #setUnsafeOrderBy(String)} 方法
*
* @param orderBy 排序字段
*/
public <E> Page<E> setOrderBy(String orderBy) {
if (SqlSafeUtil.check(orderBy)) {
throw new PageException("order by [" + orderBy + "] has a risk of SQL injection, " +
"if you want to avoid SQL injection verification, you can call Page.setUnsafeOrderBy");
}
this.orderBy = orderBy;
return (Page<E>) this;
}
/**
* 不安全的设置排序方法,如果从前端接收参数,请自行做好注入校验。
* <p>
* 请不要故意使用该方法注入然后提交漏洞!!!
*
* @param orderBy 排序字段
*/
public <E> Page<E> setUnsafeOrderBy(String orderBy) {
this.orderBy = orderBy;
return (Page<E>) this;
}
public boolean isOrderByOnly() {
return orderByOnly;
}
public void setOrderByOnly(boolean orderByOnly) {
this.orderByOnly = orderByOnly;
}
public String getDialectClass() {
return dialectClass;
}
public void setDialectClass(String dialectClass) {
this.dialectClass = dialectClass;
}
public Boolean getKeepOrderBy() {
return keepOrderBy;
}
public Page<E> setKeepOrderBy(Boolean keepOrderBy) {
this.keepOrderBy = keepOrderBy;
return this;
}
public Boolean getKeepSubSelectOrderBy() {
return keepSubSelectOrderBy;
}
public void setKeepSubSelectOrderBy(Boolean keepSubSelectOrderBy) {
this.keepSubSelectOrderBy = keepSubSelectOrderBy;
}
public Boolean getAsyncCount() {
return asyncCount;
}
public void setAsyncCount(Boolean asyncCount) {
this.asyncCount = asyncCount;
}
/**
* 指定使用的分页实现,如果自己使用的很频繁,建议自己增加一层封装再使用
*
* @param dialect 分页实现类,可以使用 {@link com.github.pagehelper.page.PageAutoDialect} 类中注册的别名,例如 "mysql", "oracle"
* @return
*/
public Page<E> using(String dialect) {
this.dialectClass = dialect;
return this;
}
/**
* 计算起止行号
*/
private void calculateStartAndEndRow() {
this.startRow = this.pageNum > 0 ? (this.pageNum - 1) * this.pageSize : 0;
this.endRow = this.startRow + this.pageSize * (this.pageNum > 0 ? 1 : 0);
}
public boolean isCount() {
return this.count;
}
public Page<E> setCount(boolean count) {
this.count = count;
return this;
}
/**
* 设置页码
*
* @param pageNum
* @return
*/
public Page<E> pageNum(int pageNum) {
//分页合理化,针对不合理的页码自动处理
this.pageNum = ((reasonable != null && reasonable) && pageNum <= 0) ? 1 : pageNum;
return this;
}
/**
* 设置页面大小
*
* @param pageSize
* @return
*/
public Page<E> pageSize(int pageSize) {
this.pageSize = pageSize;
calculateStartAndEndRow();
return this;
}
/**
* 是否执行count查询
*
* @param count
* @return
*/
public Page<E> count(Boolean count) {
this.count = count;
return this;
}
/**
* 设置合理化
*
* @param reasonable
* @return
*/
public Page<E> reasonable(Boolean reasonable) {
setReasonable(reasonable);
return this;
}
/**
* 当设置为true的时候,如果pagesize设置为0(或RowBounds的limit=0),就不执行分页,返回全部结果
*
* @param pageSizeZero
* @return
*/
public Page<E> pageSizeZero(Boolean pageSizeZero) {
setPageSizeZero(pageSizeZero);
return this;
}
/**
* 设置 BoundSql 拦截器
*
* @param boundSqlInterceptor
* @return
*/
public Page<E> boundSqlInterceptor(BoundSqlInterceptor boundSqlInterceptor) {
setBoundSqlInterceptor(boundSqlInterceptor);
return this;
}
/**
* 指定 count 查询列
*
* @param columnName
* @return
*/
public Page<E> countColumn(String columnName) {
setCountColumn(columnName);
return this;
}
/**
* 转换count查询时保留查询的 order by 排序
*
* @param keepOrderBy
* @return
*/
public Page<E> keepOrderBy(boolean keepOrderBy) {
this.keepOrderBy = keepOrderBy;
return this;
}
public boolean keepOrderBy() {
return this.keepOrderBy != null && this.keepOrderBy;
}
/**
* 转换count查询时保留子查询的 order by 排序
*
* @param keepSubSelectOrderBy
* @return
*/
public Page<E> keepSubSelectOrderBy(boolean keepSubSelectOrderBy) {
this.keepSubSelectOrderBy = keepSubSelectOrderBy;
return this;
}
public boolean keepSubSelectOrderBy() {
return this.keepSubSelectOrderBy != null && this.keepSubSelectOrderBy;
}
/**
* 异步count查询
*
* @param asyncCount
* @return
*/
public Page<E> asyncCount(boolean asyncCount) {
this.asyncCount = asyncCount;
return this;
}
/**
* 使用异步count查询
*
* @return
*/
public Page<E> enableAsyncCount() {
return asyncCount(true);
}
/**
* 不使用异步count查询
*
* @return
*/
public Page<E> disableAsyncCount() {
return asyncCount(false);
}
public boolean asyncCount() {
return this.asyncCount != null && this.asyncCount;
}
public PageInfo<E> toPageInfo() {
return new PageInfo<E>(this);
}
/**
* 数据对象转换
*
* @param function
* @param <T>
* @return
*/
public <T> PageInfo<T> toPageInfo(Function<E, T> function) {
List<T> list = new ArrayList<T>(this.size());
for (E e : this) {
list.add(function.apply(e));
}
PageInfo<T> pageInfo = new PageInfo<T>(list);
pageInfo.setTotal(this.getTotal());
pageInfo.setPageNum(this.getPageNum());
pageInfo.setPageSize(this.getPageSize());
pageInfo.setPages(this.getPages());
pageInfo.setStartRow(this.getStartRow());
pageInfo.setEndRow(this.getEndRow());
pageInfo.calcByNavigatePages(PageInfo.DEFAULT_NAVIGATE_PAGES);
return pageInfo;
}
public PageSerializable<E> toPageSerializable() {
return new PageSerializable<E>(this);
}
/**
* 数据对象转换
*
* @param function
* @param <T>
* @return
*/
public <T> PageSerializable<T> toPageSerializable(Function<E, T> function) {
List<T> list = new ArrayList<T>(this.size());
for (E e : this) {
list.add(function.apply(e));
}
PageSerializable<T> pageSerializable = new PageSerializable<T>(list);
pageSerializable.setTotal(this.getTotal());
return pageSerializable;
}
public <E> Page<E> doSelectPage(ISelect select) {
select.doSelect();
return (Page<E>) this;
}
public <E> PageInfo<E> doSelectPageInfo(ISelect select) {
select.doSelect();
return (PageInfo<E>) this.toPageInfo();
}
public <E> PageSerializable<E> doSelectPageSerializable(ISelect select) {
select.doSelect();
return (PageSerializable<E>) this.toPageSerializable();
}
public long doCount(ISelect select) {
this.pageSizeZero = true;
this.pageSize = 0;
select.doSelect();
return this.total;
}
public String getCountColumn() {
return countColumn;
}
public void setCountColumn(String countColumn) {
if (!"0".equals(countColumn) && !"*".equals(countColumn) && SqlSafeUtil.check(countColumn)) {
throw new PageException("count(" + countColumn + ") has a risk of SQL injection");
}
this.countColumn = countColumn;
}
public BoundSqlInterceptor getBoundSqlInterceptor() {
return boundSqlInterceptor;
}
public void setBoundSqlInterceptor(BoundSqlInterceptor boundSqlInterceptor) {
this.boundSqlInterceptor = boundSqlInterceptor;
}
BoundSqlInterceptor.Chain getChain() {
return chain;
}
void setChain(BoundSqlInterceptor.Chain chain) {
this.chain = chain;
}
@Override
public String toString() {
return "Page{" +
"count=" + count +
", pageNum=" + pageNum +
", pageSize=" + pageSize +
", startRow=" + startRow +
", endRow=" + endRow +
", total=" + total +
", pages=" + pages +
", reasonable=" + reasonable +
", pageSizeZero=" + pageSizeZero +
'}' + super.toString();
}
@Override
public void close() {
PageHelper.clearPage();
}
/**
* 兼容低版本 Java 7-
*/
public interface Function<E, T> {
/**
* Applies this function to the given argument.
*
* @param t the function argument
* @return the function result
*/
T apply(E t);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/PageException.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
/**
* 分页插件异常
*/
public class PageException extends RuntimeException {
public PageException() {
super();
}
public PageException(String message) {
super(message);
}
public PageException(String message, Throwable cause) {
super(message, cause);
}
public PageException(Throwable cause) {
super(cause);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/PageHelper.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import com.github.pagehelper.dialect.AbstractHelperDialect;
import com.github.pagehelper.page.PageAutoDialect;
import com.github.pagehelper.page.PageBoundSqlInterceptors;
import com.github.pagehelper.page.PageMethod;
import com.github.pagehelper.page.PageParams;
import com.github.pagehelper.parser.CountSqlParser;
import com.github.pagehelper.util.StringUtil;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.RowBounds;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinWorkerThread;
import java.util.concurrent.Future;
/**
* Mybatis - 通用分页拦截器<br/>
* 项目地址 : http://git.oschina.net/free/Mybatis_PageHelper
*
* @author liuzh/abel533/isea533
* @version 5.0.0
*/
public class PageHelper extends PageMethod implements Dialect, BoundSqlInterceptor.Chain {
private PageParams pageParams;
private PageAutoDialect autoDialect;
private PageBoundSqlInterceptors pageBoundSqlInterceptors;
private ForkJoinPool asyncCountService;
@Override
public boolean skip(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
Page page = pageParams.getPage(parameterObject, rowBounds);
if (page == null) {
return true;
} else {
//设置默认的 count 列
if (StringUtil.isEmpty(page.getCountColumn())) {
page.setCountColumn(pageParams.getCountColumn());
}
//设置默认的异步 count 设置
if (page.getAsyncCount() == null) {
page.setAsyncCount(pageParams.isAsyncCount());
}
autoDialect.initDelegateDialect(ms, page.getDialectClass());
return false;
}
}
@Override
public boolean isAsyncCount() {
return getLocalPage().asyncCount();
}
@Override
public <T> Future<T> asyncCountTask(Callable<T> task) {
//异步执行时需要将ThreadLocal值传递,否则会找不到
AbstractHelperDialect dialectThreadLocal = autoDialect.getDialectThreadLocal();
Page<Object> localPage = getLocalPage();
String countId = UUID.randomUUID().toString();
return asyncCountService.submit(() -> {
try {
//设置 ThreadLocal
autoDialect.setDialectThreadLocal(dialectThreadLocal);
setLocalPage(localPage);
return task.call();
} finally {
autoDialect.clearDelegate();
clearPage();
}
});
}
@Override
public boolean beforeCount(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
return autoDialect.getDelegate().beforeCount(ms, parameterObject, rowBounds);
}
@Override
public String getCountSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey countKey) {
return autoDialect.getDelegate().getCountSql(ms, boundSql, parameterObject, rowBounds, countKey);
}
@Override
public boolean afterCount(long count, Object parameterObject, RowBounds rowBounds) {
return autoDialect.getDelegate().afterCount(count, parameterObject, rowBounds);
}
@Override
public Object processParameterObject(MappedStatement ms, Object parameterObject, BoundSql boundSql, CacheKey pageKey) {
return autoDialect.getDelegate().processParameterObject(ms, parameterObject, boundSql, pageKey);
}
@Override
public boolean beforePage(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
return autoDialect.getDelegate().beforePage(ms, parameterObject, rowBounds);
}
@Override
public String getPageSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey pageKey) {
return autoDialect.getDelegate().getPageSql(ms, boundSql, parameterObject, rowBounds, pageKey);
}
public String getPageSql(String sql, Page page, RowBounds rowBounds, CacheKey pageKey) {
return autoDialect.getDelegate().getPageSql(sql, page, pageKey);
}
@Override
public Object afterPage(List pageList, Object parameterObject, RowBounds rowBounds) {
//这个方法即使不分页也会被执行,所以要判断 null
AbstractHelperDialect delegate = autoDialect.getDelegate();
if (delegate != null) {
return delegate.afterPage(pageList, parameterObject, rowBounds);
}
return pageList;
}
@Override
public void afterAll() {
//这个方法即使不分页也会被执行,所以要判断 null
AbstractHelperDialect delegate = autoDialect.getDelegate();
if (delegate != null) {
delegate.afterAll();
autoDialect.clearDelegate();
}
clearPage();
}
@Override
public BoundSql doBoundSql(BoundSqlInterceptor.Type type, BoundSql boundSql, CacheKey cacheKey) {
Page<Object> localPage = getLocalPage();
BoundSqlInterceptor.Chain chain = localPage != null ? localPage.getChain() : null;
if (chain == null) {
BoundSqlInterceptor boundSqlInterceptor = localPage != null ? localPage.getBoundSqlInterceptor() : null;
BoundSqlInterceptor.Chain defaultChain = pageBoundSqlInterceptors != null ? pageBoundSqlInterceptors.getChain() : null;
if (boundSqlInterceptor != null) {
chain = new BoundSqlInterceptorChain(defaultChain, Arrays.asList(boundSqlInterceptor));
} else if (defaultChain != null) {
chain = defaultChain;
}
if (chain == null) {
chain = DO_NOTHING;
}
if (localPage != null) {
localPage.setChain(chain);
}
}
return chain.doBoundSql(type, boundSql, cacheKey);
}
@Override
public void setProperties(Properties properties) {
setStaticProperties(properties);
pageParams = new PageParams();
autoDialect = new PageAutoDialect();
pageBoundSqlInterceptors = new PageBoundSqlInterceptors();
pageParams.setProperties(properties);
autoDialect.setProperties(properties);
pageBoundSqlInterceptors.setProperties(properties);
//20180902新增 aggregateFunctions, 允许手动添加聚合函数(影响行数)
CountSqlParser.addAggregateFunctions(properties.getProperty("aggregateFunctions"));
// 异步 asyncCountService 并发度设置,这里默认为应用可用的处理器核心数 * 2,更合理的值应该综合考虑数据库服务器的处理能力
int asyncCountParallelism = Integer.parseInt(properties.getProperty("asyncCountParallelism",
"" + (Runtime.getRuntime().availableProcessors() * 2)));
asyncCountService = new ForkJoinPool(asyncCountParallelism,
pool -> {
final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
worker.setName("pagehelper-async-count-" + worker.getPoolIndex());
return worker;
}, null, true);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/PageInfo.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* 对Page<E>结果进行包装
* <p/>
* 新增分页的多项属性,主要参考:http://bbs.csdn.net/topics/360010907
*
* @author liuzh/abel533/isea533
* @version 3.3.0
* @since 3.2.2
* 项目地址 : http://git.oschina.net/free/Mybatis_PageHelper
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class PageInfo<T> extends PageSerializable<T> {
public static final int DEFAULT_NAVIGATE_PAGES = 8;
//private PageInfo EMPTY = new PageInfo(Collections.emptyList(), 0);
/**
* 当前页
*/
private int pageNum;
/**
* 每页的数量
*/
private int pageSize;
/**
* 当前页的数量
*/
private int size;
/**
* 由于startRow和endRow不常用,这里说个具体的用法
* 可以在页面中"显示startRow到endRow 共size条数据"
* 当前页面第一个元素在数据库中的行号
*/
private long startRow;
/**
* 当前页面最后一个元素在数据库中的行号
*/
private long endRow;
/**
* 总页数
*/
private int pages;
/**
* 前一页
*/
private int prePage;
/**
* 下一页
*/
private int nextPage;
/**
* 是否为第一页
*/
private boolean isFirstPage = false;
/**
* 是否为最后一页
*/
private boolean isLastPage = false;
/**
* 是否有前一页
*/
private boolean hasPreviousPage = false;
/**
* 是否有下一页
*/
private boolean hasNextPage = false;
/**
* 导航页码数
*/
private int navigatePages;
/**
* 所有导航页号
*/
private int[] navigatepageNums;
/**
* 导航条上的第一页
*/
private int navigateFirstPage;
/**
* 导航条上的最后一页
*/
private int navigateLastPage;
public PageInfo() {
}
/**
* 包装Page对象
*
* @param list
*/
public PageInfo(List<? extends T> list) {
this(list, DEFAULT_NAVIGATE_PAGES);
}
/**
* 包装Page对象
*
* @param list page结果
* @param navigatePages 页码数量
*/
public PageInfo(List<? extends T> list, int navigatePages) {
super(list);
if (list instanceof Page) {
Page page = (Page) list;
this.pageNum = page.getPageNum();
this.pageSize = page.getPageSize();
this.pages = page.getPages();
this.size = page.size();
//由于结果是>startRow的,所以实际的需要+1
if (this.size == 0) {
this.startRow = 0;
this.endRow = 0;
} else {
this.startRow = page.getStartRow() + 1;
//计算实际的endRow(最后一页的时候特殊)
this.endRow = this.startRow - 1 + this.size;
}
} else if (list instanceof Collection) {
this.pageNum = 1;
this.pageSize = list.size();
this.pages = this.pageSize > 0 ? 1 : 0;
this.size = list.size();
this.startRow = 0;
this.endRow = list.size() > 0 ? list.size() - 1 : 0;
}
if (list instanceof Collection) {
calcByNavigatePages(navigatePages);
}
}
public static <T> PageInfo<T> of(List<? extends T> list) {
return new PageInfo<T>(list);
}
/**
* 手动指定总记录数获取分页信息
*
* @param total 总记录数
* @param list page结果
*/
public static <T> PageInfo<T> of(long total, List<? extends T> list) {
if (list instanceof Page) {
Page page = (Page) list;
page.setTotal(total);
}
return new PageInfo<T>(list);
}
public static <T> PageInfo<T> of(List<? extends T> list, int navigatePages) {
return new PageInfo<T>(list, navigatePages);
}
/**
* 返回一个空的 Pageinfo 对象
*
* @return
*/
public static <T> PageInfo<T> emptyPageInfo() {
return new PageInfo(Collections.emptyList(), 0);
}
public void calcByNavigatePages(int navigatePages) {
setNavigatePages(navigatePages);
//计算导航页
calcNavigatepageNums();
//计算前后页,第一页,最后一页
calcPage();
//判断页面边界
judgePageBoudary();
}
/**
* 计算导航页
*/
private void calcNavigatepageNums() {
//当总页数小于或等于导航页码数时
if (pages <= navigatePages) {
navigatepageNums = new int[pages];
for (int i = 0; i < pages; i++) {
navigatepageNums[i] = i + 1;
}
} else { //当总页数大于导航页码数时
navigatepageNums = new int[navigatePages];
int startNum = pageNum - navigatePages / 2;
int endNum = pageNum + navigatePages / 2;
if (startNum < 1) {
startNum = 1;
//(最前navigatePages页
for (int i = 0; i < navigatePages; i++) {
navigatepageNums[i] = startNum++;
}
} else if (endNum > pages) {
endNum = pages;
//最后navigatePages页
for (int i = navigatePages - 1; i >= 0; i--) {
navigatepageNums[i] = endNum--;
}
} else {
//所有中间页
for (int i = 0; i < navigatePages; i++) {
navigatepageNums[i] = startNum++;
}
}
}
}
/**
* 计算前后页,第一页,最后一页
*/
private void calcPage() {
if (navigatepageNums != null && navigatepageNums.length > 0) {
navigateFirstPage = navigatepageNums[0];
navigateLastPage = navigatepageNums[navigatepageNums.length - 1];
if (pageNum > 1) {
prePage = pageNum - 1;
}
if (pageNum < pages) {
nextPage = pageNum + 1;
}
}
}
/**
* 判定页面边界
*/
private void judgePageBoudary() {
isFirstPage = pageNum == 1;
isLastPage = pageNum == pages || pages == 0;
hasPreviousPage = pageNum > 1;
hasNextPage = pageNum < pages;
}
/**
* 数据对象转换
*
* @param function 用以转换数据对象的函数
* @param <E> 目标类型
* @return 转换了对象类型的包装结果
*/
public <E> PageInfo<E> convert(Page.Function<T, E> function) {
List<E> list = new ArrayList<E>(this.list.size());
for (T t : this.list) {
list.add(function.apply(t));
}
PageInfo<E> newPageInfo = new PageInfo<>(list);
newPageInfo.setPageNum(this.pageNum);
newPageInfo.setPageSize(this.pageSize);
newPageInfo.setSize(this.size);
newPageInfo.setStartRow(this.startRow);
newPageInfo.setEndRow(this.endRow);
newPageInfo.setTotal(this.total);
newPageInfo.setPages(this.pages);
newPageInfo.setPrePage(this.prePage);
newPageInfo.setNextPage(this.nextPage);
newPageInfo.setIsFirstPage(this.isFirstPage);
newPageInfo.setIsLastPage(this.isLastPage);
newPageInfo.setHasPreviousPage(this.hasPreviousPage);
newPageInfo.setHasNextPage(this.hasNextPage);
newPageInfo.setNavigatePages(this.navigatePages);
newPageInfo.setNavigateFirstPage(this.navigateFirstPage);
newPageInfo.setNavigateLastPage(this.navigateLastPage);
newPageInfo.setNavigatepageNums(this.navigatepageNums);
return newPageInfo;
}
/**
* 是否包含内容
*/
public boolean hasContent() {
return this.size > 0;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public long getStartRow() {
return startRow;
}
public void setStartRow(long startRow) {
this.startRow = startRow;
}
public long getEndRow() {
return endRow;
}
public void setEndRow(long endRow) {
this.endRow = endRow;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public int getPrePage() {
return prePage;
}
public void setPrePage(int prePage) {
this.prePage = prePage;
}
public int getNextPage() {
return nextPage;
}
public void setNextPage(int nextPage) {
this.nextPage = nextPage;
}
public boolean isIsFirstPage() {
return isFirstPage;
}
public void setIsFirstPage(boolean isFirstPage) {
this.isFirstPage = isFirstPage;
}
public boolean isIsLastPage() {
return isLastPage;
}
public void setIsLastPage(boolean isLastPage) {
this.isLastPage = isLastPage;
}
public boolean isHasPreviousPage() {
return hasPreviousPage;
}
public void setHasPreviousPage(boolean hasPreviousPage) {
this.hasPreviousPage = hasPreviousPage;
}
public boolean isHasNextPage() {
return hasNextPage;
}
public void setHasNextPage(boolean hasNextPage) {
this.hasNextPage = hasNextPage;
}
public int getNavigatePages() {
return navigatePages;
}
public void setNavigatePages(int navigatePages) {
this.navigatePages = navigatePages;
}
public int[] getNavigatepageNums() {
return navigatepageNums;
}
public void setNavigatepageNums(int[] navigatepageNums) {
this.navigatepageNums = navigatepageNums;
}
public int getNavigateFirstPage() {
return navigateFirstPage;
}
public int getNavigateLastPage() {
return navigateLastPage;
}
public void setNavigateFirstPage(int navigateFirstPage) {
this.navigateFirstPage = navigateFirstPage;
}
public void setNavigateLastPage(int navigateLastPage) {
this.navigateLastPage = navigateLastPage;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("PageInfo{");
sb.append("pageNum=").append(pageNum);
sb.append(", pageSize=").append(pageSize);
sb.append(", size=").append(size);
sb.append(", startRow=").append(startRow);
sb.append(", endRow=").append(endRow);
sb.append(", total=").append(total);
sb.append(", pages=").append(pages);
sb.append(", list=").append(list);
sb.append(", prePage=").append(prePage);
sb.append(", nextPage=").append(nextPage);
sb.append(", isFirstPage=").append(isFirstPage);
sb.append(", isLastPage=").append(isLastPage);
sb.append(", hasPreviousPage=").append(hasPreviousPage);
sb.append(", hasNextPage=").append(hasNextPage);
sb.append(", navigatePages=").append(navigatePages);
sb.append(", navigateFirstPage=").append(navigateFirstPage);
sb.append(", navigateLastPage=").append(navigateLastPage);
sb.append(", navigatepageNums=");
if (navigatepageNums == null) {
sb.append("null");
} else {
sb.append('[');
for (int i = 0; i < navigatepageNums.length; ++i) {
sb.append(i == 0 ? "" : ", ").append(navigatepageNums[i]);
}
sb.append(']');
}
sb.append('}');
return sb.toString();
}
}
================================================
FILE: src/main/java/com/github/pagehelper/PageInterceptor.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import com.github.pagehelper.cache.Cache;
import com.github.pagehelper.cache.CacheFactory;
import com.github.pagehelper.page.PageMethod;
import com.github.pagehelper.util.ClassUtil;
import com.github.pagehelper.util.ExecutorUtil;
import com.github.pagehelper.util.MSUtils;
import com.github.pagehelper.util.StringUtil;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.CachingExecutor;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.executor.SimpleExecutor;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.transaction.Transaction;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.managed.ManagedTransactionFactory;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Future;
/**
* Mybatis - 通用分页拦截器
* <p>
* GitHub: https://github.com/pagehelper/Mybatis-PageHelper
* <p>
* Gitee : https://gitee.com/free/Mybatis_PageHelper
*
* @author liuzh/abel533/isea533
* @version 5.0.0
*/
@SuppressWarnings({"rawtypes", "unchecked"})
@Intercepts(
{
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
}
)
public class PageInterceptor implements Interceptor {
private static final Log log = LogFactory.getLog(PageInterceptor.class);
private static boolean debug = false;
protected Cache<String, MappedStatement> msCountMap = null;
protected CountMsIdGen countMsIdGen = CountMsIdGen.DEFAULT;
private volatile Dialect dialect;
private String countSuffix = "_COUNT";
private String default_dialect_class = "com.github.pagehelper.PageHelper";
public PageInterceptor() {
String bannerEnabled = System.getProperty("pagehelper.banner");
if (StringUtil.isEmpty(bannerEnabled)) {
bannerEnabled = System.getenv("PAGEHELPER_BANNER");
}
//默认 TRUE
if (StringUtil.isEmpty(bannerEnabled) || Boolean.parseBoolean(bannerEnabled)) {
log.debug("\n\n" +
",------. ,--. ,--. ,--. \n" +
"| .--. ' ,--,--. ,---. ,---. | '--' | ,---. | | ,---. ,---. ,--.--. \n" +
"| '--' | ' ,-. | | .-. | | .-. : | .--. | | .-. : | | | .-. | | .-. : | .--' \n" +
"| | --' \\ '-' | ' '-' ' \\ --. | | | | \\ --. | | | '-' ' \\ --. | | \n" +
"`--' `--`--' .`- / `----' `--' `--' `----' `--' | |-' `----' `--' \n" +
" `---' `--' is intercepting.\n");
}
}
public static boolean isDebug() {
return debug;
}
/**
* 输出启用分页方法时的调用堆栈信息
*/
protected void debugStackTraceLog() {
if (isDebug()) {
Page<Object> page = PageMethod.getLocalPage();
log.debug(page.getStackTrace());
}
}
@Override
public Object intercept(Invocation invocation) throws Throwable {
try {
Object[] args = invocation.getArgs();
MappedStatement ms = (MappedStatement) args[0];
Object parameter = args[1];
RowBounds rowBounds = (RowBounds) args[2];
ResultHandler resultHandler = (ResultHandler) args[3];
Executor executor = (Executor) invocation.getTarget();
CacheKey cacheKey;
BoundSql boundSql;
//由于逻辑关系,只会进入一次
if (args.length == 4) {
//4 个参数时
boundSql = ms.getBoundSql(parameter);
cacheKey = executor.createCacheKey(ms, parameter, rowBounds, boundSql);
} else {
//6 个参数时
cacheKey = (CacheKey) args[4];
boundSql = (BoundSql) args[5];
}
checkDialectExists();
//对 boundSql 的拦截处理
if (dialect instanceof BoundSqlInterceptor.Chain) {
boundSql = ((BoundSqlInterceptor.Chain) dialect).doBoundSql(BoundSqlInterceptor.Type.ORIGINAL, boundSql, cacheKey);
}
List resultList;
//调用方法判断是否需要进行分页,如果不需要,直接返回结果
if (!dialect.skip(ms, parameter, rowBounds)) {
//开启debug时,输出触发当前分页执行时的PageHelper调用堆栈
// 如果和当前调用堆栈不一致,说明在启用分页后没有消费,当前线程再次执行时消费,调用堆栈显示的方法使用不安全
debugStackTraceLog();
Future<Long> countFuture = null;
//判断是否需要进行 count 查询
if (dialect.beforeCount(ms, parameter, rowBounds)) {
if (dialect.isAsyncCount()) {
countFuture = asyncCount(ms, boundSql, parameter, rowBounds);
} else {
//查询总数
Long count = count(executor, ms, parameter, rowBounds, null, boundSql);
//处理查询总数,返回 true 时继续分页查询,false 时直接返回
if (!dialect.afterCount(count, parameter, rowBounds)) {
//当查询总数为 0 时,直接返回空的结果
return dialect.afterPage(new ArrayList(), parameter, rowBounds);
}
}
}
resultList = ExecutorUtil.pageQuery(dialect, executor,
ms, parameter, rowBounds, resultHandler, boundSql, cacheKey);
if (countFuture != null) {
Long count = countFuture.get();
dialect.afterCount(count, parameter, rowBounds);
}
} else {
//rowBounds用参数值,不使用分页插件处理时,仍然支持默认的内存分页
resultList = executor.query(ms, parameter, rowBounds, resultHandler, cacheKey, boundSql);
}
return dialect.afterPage(resultList, parameter, rowBounds);
} finally {
if (dialect != null) {
dialect.afterAll();
}
}
}
/**
* 异步查询总数
*/
private Future<Long> asyncCount(MappedStatement ms, BoundSql boundSql, Object parameter, RowBounds rowBounds) {
Configuration configuration = ms.getConfiguration();
//异步不能复用 BoundSql,因为分页使用时会添加分页参数,这里需要复制一个新的
BoundSql countBoundSql = new BoundSql(configuration, boundSql.getSql(), new ArrayList<>(boundSql.getParameterMappings()), parameter);
Map<String, Object> additionalParameter = ExecutorUtil.getAdditionalParameter(boundSql);
if (additionalParameter != null){
for (String key : additionalParameter.keySet()) {
countBoundSql.setAdditionalParameter(key, additionalParameter.get(key));
}
}
//异步想要起作用需要新的数据库连接,需要独立的事务,创建新的Executor,因此异步查询只适合在独立查询中使用,如果混合增删改操作,不能开启异步
Environment environment = configuration.getEnvironment();
TransactionFactory transactionFactory = null;
if (environment == null || environment.getTransactionFactory() == null) {
transactionFactory = new ManagedTransactionFactory();
} else {
transactionFactory = environment.getTransactionFactory();
}
//创建新的事务
Transaction tx = transactionFactory.newTransaction(environment.getDataSource(), null, false);
//使用新的 Executor 执行 count 查询,这里没有加载拦截器,避免递归死循环
Executor countExecutor = new CachingExecutor(new SimpleExecutor(configuration, tx));
return dialect.asyncCountTask(() -> {
try {
return count(countExecutor, ms, parameter, rowBounds, null, countBoundSql);
} finally {
tx.close();
}
});
}
/**
* Spring bean 方式配置时,如果没有配置属性就不会执行下面的 setProperties 方法,就不会初始化
* <p>
* 因此这里会出现 null 的情况 fixed #26
*/
private void checkDialectExists() {
if (dialect == null) {
synchronized (default_dialect_class) {
if (dialect == null) {
setProperties(new Properties());
}
}
}
}
private Long count(Executor executor, MappedStatement ms, Object parameter,
RowBounds rowBounds, ResultHandler resultHandler,
BoundSql boundSql) throws SQLException {
String countMsId = countMsIdGen.genCountMsId(ms, parameter, boundSql, countSuffix);
Long count;
//先判断是否存在手写的 count 查询
MappedStatement countMs = ExecutorUtil.getExistedMappedStatement(ms.getConfiguration(), countMsId);
if (countMs != null) {
count = ExecutorUtil.executeManualCount(executor, countMs, parameter, boundSql, resultHandler);
} else {
if (msCountMap != null) {
countMs = msCountMap.get(countMsId);
}
//自动创建
if (countMs == null) {
//根据当前的 ms 创建一个返回值为 Long 类型的 ms
countMs = MSUtils.newCountMappedStatement(ms, countMsId);
if (msCountMap != null) {
msCountMap.put(countMsId, countMs);
}
}
count = ExecutorUtil.executeAutoCount(this.dialect, executor, countMs, parameter, boundSql, rowBounds, resultHandler);
}
return count;
}
@Override
public Object plugin(Object target) {
return Plugin.wrap(target, this);
}
@Override
public void setProperties(Properties properties) {
//缓存 count ms
msCountMap = CacheFactory.createCache(properties.getProperty("msCountCache"), "ms", properties);
String dialectClass = properties.getProperty("dialect");
if (StringUtil.isEmpty(dialectClass)) {
dialectClass = default_dialect_class;
}
Dialect tempDialect = ClassUtil.newInstance(dialectClass, properties);
tempDialect.setProperties(properties);
String countSuffix = properties.getProperty("countSuffix");
if (StringUtil.isNotEmpty(countSuffix)) {
this.countSuffix = countSuffix;
}
// debug模式,用于排查不安全分页调用
debug = Boolean.parseBoolean(properties.getProperty("debug"));
// 通过 countMsId 配置自定义类
String countMsIdGenClass = properties.getProperty("countMsIdGen");
if (StringUtil.isNotEmpty(countMsIdGenClass)) {
countMsIdGen = ClassUtil.newInstance(countMsIdGenClass, properties);
}
// 初始化完成后再设置值,保证 dialect 完成初始化
dialect = tempDialect;
}
}
================================================
FILE: src/main/java/com/github/pagehelper/PageParam.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
/**
* 抽象类,自己的查询类可以继承该类,可以更直接的控制分页参数
*/
public class PageParam implements IPage {
private Integer pageNum;
private Integer pageSize;
private String orderBy;
public PageParam() {
}
public PageParam(Integer pageNum, Integer pageSize) {
this.pageNum = pageNum;
this.pageSize = pageSize;
}
public PageParam(Integer pageNum, Integer pageSize, String orderBy) {
this.pageNum = pageNum;
this.pageSize = pageSize;
this.orderBy = orderBy;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
@Override
public Integer getPageNum() {
return pageNum;
}
@Override
public Integer getPageSize() {
return pageSize;
}
@Override
public String getOrderBy() {
return orderBy;
}
}
================================================
FILE: src/main/java/com/github/pagehelper/PageProperties.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import java.util.Properties;
/**
* 分页配置,实现该接口的类在初始化后会调用 {@link #setProperties(Properties)} 方法
*
* @author liuzh
*/
public interface PageProperties {
/**
* 设置参数
*
* @param properties 插件属性
*/
void setProperties(Properties properties);
}
================================================
FILE: src/main/java/com/github/pagehelper/PageRowBounds.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import org.apache.ibatis.session.RowBounds;
/**
* @author liuzenghui
*/
public class PageRowBounds extends RowBounds {
private Long total;
private Boolean count;
public PageRowBounds(int offset, int limit) {
super(offset, limit);
}
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
public Boolean getCount() {
return count;
}
public void setCount(Boolean count) {
this.count = count;
}
}
================================================
FILE: src/main/java/com/github/pagehelper/PageSerializable.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import java.io.Serializable;
import java.util.List;
/**
* @author liuzh
*/
public class PageSerializable<T> implements Serializable {
private static final long serialVersionUID = 1L;
//总记录数
protected long total;
//结果集
protected List<T> list;
public PageSerializable() {
}
@SuppressWarnings("unchecked")
public PageSerializable(List<? extends T> list) {
this.list = (List<T>) list;
if(list instanceof Page){
this.total = ((Page<?>)list).getTotal();
} else {
this.total = list.size();
}
}
public static <T> PageSerializable<T> of(List<? extends T> list){
return new PageSerializable<T>(list);
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
@Override
public String toString() {
return "PageSerializable{" +
"total=" + total +
", list=" + list +
'}';
}
}
================================================
FILE: src/main/java/com/github/pagehelper/QueryInterceptor.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import java.util.Properties;
/**
* QueryInterceptor 规范
*
* 详细说明见文档:https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/Interceptor.md
*
* @author liuzh/abel533/isea533
* @version 1.0.0
*/
@Intercepts(
{
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
}
)
public class QueryInterceptor implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
Object[] args = invocation.getArgs();
MappedStatement ms = (MappedStatement) args[0];
Object parameter = args[1];
RowBounds rowBounds = (RowBounds) args[2];
ResultHandler resultHandler = (ResultHandler) args[3];
Executor executor = (Executor) invocation.getTarget();
CacheKey cacheKey;
BoundSql boundSql;
//由于逻辑关系,只会进入一次
if(args.length == 4){
//4 个参数时
boundSql = ms.getBoundSql(parameter);
cacheKey = executor.createCacheKey(ms, parameter, rowBounds, boundSql);
} else {
//6 个参数时
cacheKey = (CacheKey) args[4];
boundSql = (BoundSql) args[5];
}
//TODO 自己要进行的各种处理
//注:下面的方法可以根据自己的逻辑调用多次,在分页插件中,count 和 page 各调用了一次
return executor.query(ms, parameter, rowBounds, resultHandler, cacheKey, boundSql);
}
@Override
public Object plugin(Object target) {
return Plugin.wrap(target, this);
}
@Override
public void setProperties(Properties properties) {
}
}
================================================
FILE: src/main/java/com/github/pagehelper/cache/Cache.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.cache;
/**
* Simple cache interface
*
* @author liuzh
*/
public interface Cache<K, V> {
V get(K key);
void put(K key, V value);
}
================================================
FILE: src/main/java/com/github/pagehelper/cache/CacheFactory.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.cache;
import com.github.pagehelper.PageException;
import com.github.pagehelper.PageProperties;
import com.github.pagehelper.util.StringUtil;
import java.lang.reflect.Constructor;
import java.util.Properties;
/**
* CacheFactory
*
* @author liuzh
*/
public abstract class CacheFactory {
/**
* 创建 SQL 缓存
*
* @param sqlCacheClass
* @return
*/
public static <K, V> Cache<K, V> createCache(String sqlCacheClass, String prefix, Properties properties) {
if (StringUtil.isEmpty(sqlCacheClass)) {
try {
Class.forName("com.google.common.cache.Cache");
return new GuavaCache<K, V>(properties, prefix);
} catch (Throwable t) {
return new SimpleCache<K, V>(properties, prefix);
}
} else {
try {
Class<? extends Cache> clazz = (Class<? extends Cache>) Class.forName(sqlCacheClass);
try {
Constructor<? extends Cache> constructor = clazz.getConstructor(Properties.class, String.class);
return constructor.newInstance(properties, prefix);
} catch (Exception e) {
Cache cache = clazz.newInstance();
if (cache instanceof PageProperties) {
((PageProperties) cache).setProperties(properties);
}
return cache;
}
} catch (Throwable t) {
throw new PageException("Created Sql Cache [" + sqlCacheClass + "] Error", t);
}
}
}
}
================================================
FILE: src/main/java/com/github/pagehelper/cache/GuavaCache.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.cache;
import com.github.pagehelper.util.StringUtil;
import com.google.common.cache.CacheBuilder;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
/**
* Simple Guava Cache
*
* @author liuzh
*/
public class GuavaCache<K, V> implements Cache<K, V> {
private final com.google.common.cache.Cache<K, V> CACHE;
public GuavaCache(Properties properties, String prefix) {
CacheBuilder cacheBuilder = CacheBuilder.newBuilder();
String maximumSize = properties.getProperty(prefix + ".maximumSize");
if (StringUtil.isNotEmpty(maximumSize)) {
cacheBuilder.maximumSize(Long.parseLong(maximumSize));
} else {
cacheBuilder.maximumSize(1000);
}
String expireAfterAccess = properties.getProperty(prefix + ".expireAfterAccess");
if (StringUtil.isNotEmpty(expireAfterAccess)) {
cacheBuilder.expireAfterAccess(Long.parseLong(expireAfterAccess), TimeUnit.MILLISECONDS);
}
String expireAfterWrite = properties.getProperty(prefix + ".expireAfterWrite");
if (StringUtil.isNotEmpty(expireAfterWrite)) {
cacheBuilder.expireAfterWrite(Long.parseLong(expireAfterWrite), TimeUnit.MILLISECONDS);
}
String initialCapacity = properties.getProperty(prefix + ".initialCapacity");
if (StringUtil.isNotEmpty(initialCapacity)) {
cacheBuilder.initialCapacity(Integer.parseInt(initialCapacity));
}
CACHE = cacheBuilder.build();
}
@Override
public V get(K key) {
return CACHE.getIfPresent(key);
}
@Override
public void put(K key, V value) {
CACHE.put(key, value);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/cache/SimpleCache.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.cache;
import com.github.pagehelper.util.StringUtil;
import org.apache.ibatis.cache.decorators.FifoCache;
import org.apache.ibatis.cache.impl.PerpetualCache;
import org.apache.ibatis.mapping.CacheBuilder;
import java.util.Properties;
/**
* Simple MyBatis Cache
*
* @author liuzh
*/
public class SimpleCache<K, V> implements Cache<K, V> {
private final org.apache.ibatis.cache.Cache CACHE;
public SimpleCache(Properties properties, String prefix) {
CacheBuilder cacheBuilder = new CacheBuilder("SQL_CACHE");
String typeClass = properties.getProperty(prefix + ".typeClass");
if (StringUtil.isNotEmpty(typeClass)) {
try {
cacheBuilder.implementation((Class<? extends org.apache.ibatis.cache.Cache>) Class.forName(typeClass));
} catch (ClassNotFoundException e) {
cacheBuilder.implementation(PerpetualCache.class);
}
} else {
cacheBuilder.implementation(PerpetualCache.class);
}
String evictionClass = properties.getProperty(prefix + ".evictionClass");
if (StringUtil.isNotEmpty(evictionClass)) {
try {
cacheBuilder.addDecorator((Class<? extends org.apache.ibatis.cache.Cache>) Class.forName(evictionClass));
} catch (ClassNotFoundException e) {
cacheBuilder.addDecorator(FifoCache.class);
}
} else {
cacheBuilder.addDecorator(FifoCache.class);
}
String flushInterval = properties.getProperty(prefix + ".flushInterval");
if (StringUtil.isNotEmpty(flushInterval)) {
cacheBuilder.clearInterval(Long.parseLong(flushInterval));
}
String size = properties.getProperty(prefix + ".size");
if (StringUtil.isNotEmpty(size)) {
cacheBuilder.size(Integer.parseInt(size));
}
cacheBuilder.properties(properties);
CACHE = cacheBuilder.build();
}
@Override
public V get(K key) {
Object value = CACHE.getObject(key);
if (value != null) {
return (V) value;
}
return null;
}
@Override
public void put(K key, V value) {
CACHE.putObject(key, value);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/AbstractDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect;
import com.github.pagehelper.Dialect;
import com.github.pagehelper.parser.CountSqlParser;
import com.github.pagehelper.parser.OrderBySqlParser;
import com.github.pagehelper.parser.defaults.DefaultCountSqlParser;
import com.github.pagehelper.parser.defaults.DefaultOrderBySqlParser;
import com.github.pagehelper.util.ClassUtil;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.RowBounds;
import java.util.Properties;
/**
* 基于 CountSqlParser 的智能 Count 查询
*
* @author liuzh
*/
public abstract class AbstractDialect implements Dialect {
//处理SQL
protected CountSqlParser countSqlParser;
protected OrderBySqlParser orderBySqlParser;
@Override
public String getCountSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey countKey) {
return countSqlParser.getSmartCountSql(boundSql.getSql());
}
@Override
public void setProperties(Properties properties) {
this.countSqlParser = ClassUtil.newInstance(properties.getProperty("countSqlParser"), CountSqlParser.class, properties, DefaultCountSqlParser::new);
this.orderBySqlParser = ClassUtil.newInstance(properties.getProperty("orderBySqlParser"), OrderBySqlParser.class, properties, DefaultOrderBySqlParser::new);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/AbstractHelperDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect;
import com.github.pagehelper.Constant;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageRowBounds;
import com.github.pagehelper.util.ExecutorUtil;
import com.github.pagehelper.util.MetaObjectUtil;
import com.github.pagehelper.util.StringUtil;
import org.apache.ibatis.builder.annotation.ProviderSqlSource;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.session.RowBounds;
import java.util.*;
/**
* 针对 PageHelper 的实现
*
* @author liuzh
* @since 2016-12-04 14:32
*/
public abstract class AbstractHelperDialect extends AbstractDialect implements Constant {
/**
* 获取分页参数
*
* @param <T>
* @return
*/
public <T> Page<T> getLocalPage() {
return PageHelper.getLocalPage();
}
@Override
public final boolean skip(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
//该方法不会被调用
return true;
}
@Override
public boolean beforeCount(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
return !page.isOrderByOnly() && page.isCount();
}
@Override
public String getCountSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey countKey) {
Page<Object> page = getLocalPage();
String countColumn = page.getCountColumn();
if (StringUtil.isNotEmpty(countColumn)) {
return countSqlParser.getSmartCountSql(boundSql.getSql(), countColumn);
}
return countSqlParser.getSmartCountSql(boundSql.getSql());
}
@Override
public boolean afterCount(long count, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
page.setTotal(count);
if (rowBounds instanceof PageRowBounds) {
((PageRowBounds) rowBounds).setTotal(count);
}
//pageSize < 0 的时候,不执行分页查询
//pageSize = 0 的时候,还需要执行后续查询,但是不会分页
if (page.getPageSizeZero() != null) {
//PageSizeZero=false&&pageSize<=0
if (!page.getPageSizeZero() && page.getPageSize() <= 0) {
return false;
}
//PageSizeZero=true&&pageSize<0 返回 false,只有>=0才需要执行后续的
else if (page.getPageSizeZero() && page.getPageSize() < 0) {
return false;
}
}
//页码>0 && 开始行数<总行数即可,不需要考虑 pageSize(上面的 if 已经处理不符合要求的值了)
return page.getPageNum() > 0 && count > page.getStartRow();
}
@Override
public Object processParameterObject(MappedStatement ms, Object parameterObject, BoundSql boundSql, CacheKey pageKey) {
//处理参数
Page page = getLocalPage();
//如果只是 order by 就不必处理参数
if (page.isOrderByOnly()) {
return parameterObject;
}
Map<String, Object> paramMap = null;
if (parameterObject == null) {
paramMap = new HashMap<String, Object>();
} else if (parameterObject instanceof Map) {
//解决不可变Map的情况
paramMap = new HashMap<String, Object>();
paramMap.putAll((Map) parameterObject);
} else {
paramMap = new HashMap<String, Object>();
// sqlSource为ProviderSqlSource时,处理只有1个参数的情况
if (ms.getSqlSource() instanceof ProviderSqlSource) {
String[] providerMethodArgumentNames = ExecutorUtil.getProviderMethodArgumentNames((ProviderSqlSource) ms.getSqlSource());
if (providerMethodArgumentNames != null && providerMethodArgumentNames.length == 1) {
paramMap.put(providerMethodArgumentNames[0], parameterObject);
paramMap.put("param1", parameterObject);
}
}
//动态sql时的判断条件不会出现在ParameterMapping中,但是必须有,所以这里需要收集所有的getter属性
//TypeHandlerRegistry可以直接处理的会作为一个直接使用的对象进行处理
boolean hasTypeHandler = ms.getConfiguration().getTypeHandlerRegistry().hasTypeHandler(parameterObject.getClass());
MetaObject metaObject = MetaObjectUtil.forObject(parameterObject);
//需要针对注解形式的MyProviderSqlSource保存原值
if (!hasTypeHandler) {
for (String name : metaObject.getGetterNames()) {
paramMap.put(name, metaObject.getValue(name));
}
}
//下面这段方法,主要解决一个常见类型的参数时的问题
if (boundSql.getParameterMappings() != null && boundSql.getParameterMappings().size() > 0) {
for (ParameterMapping parameterMapping : boundSql.getParameterMappings()) {
String name = parameterMapping.getProperty();
if (!name.equals(PAGEPARAMETER_FIRST)
&& !name.equals(PAGEPARAMETER_SECOND)
&& paramMap.get(name) == null) {
if (hasTypeHandler
|| parameterMapping.getJavaType().equals(parameterObject.getClass())) {
paramMap.put(name, parameterObject);
break;
}
}
}
}
}
return processPageParameter(ms, paramMap, page, boundSql, pageKey);
}
/**
* 处理分页参数
*
* @param ms
* @param paramMap
* @param page
* @param boundSql
* @param pageKey
* @return
*/
public abstract Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey);
@Override
public boolean beforePage(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
if (page.isOrderByOnly() || page.getPageSize() > 0) {
return true;
}
return false;
}
@Override
public String getPageSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey pageKey) {
String sql = boundSql.getSql();
Page page = getLocalPage();
//支持 order by
String orderBy = page.getOrderBy();
if (StringUtil.isNotEmpty(orderBy)) {
pageKey.update(orderBy);
sql = orderBySqlParser.converToOrderBySql(sql, orderBy);
}
if (page.isOrderByOnly()) {
return sql;
}
return getPageSql(sql, page, pageKey);
}
/**
* 单独处理分页部分
*
* @param sql
* @param page
* @param pageKey
* @return
*/
public abstract String getPageSql(String sql, Page page, CacheKey pageKey);
@Override
public Object afterPage(List pageList, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
if (page == null) {
return pageList;
}
page.addAll(pageList);
//调整判断顺序,如果查全部,total就是size,如果只排序,也是全部,其他情况下如果不查询count就是-1
if ((page.getPageSizeZero() != null && page.getPageSizeZero()) && page.getPageSize() == 0) {
page.setTotal(pageList.size());
} else if (page.isOrderByOnly()) {
page.setTotal(pageList.size());
} else if (!page.isCount()) {
page.setTotal(-1);
}
return page;
}
@Override
public void afterAll() {
}
@Override
public void setProperties(Properties properties) {
super.setProperties(properties);
}
/**
* @param boundSql
* @param ms
* @deprecated use {@code handleParameter(BoundSql boundSql, MappedStatement ms, Class<?> firstClass, Class<?> secondClass)}
*/
@Deprecated
protected void handleParameter(BoundSql boundSql, MappedStatement ms) {
if (boundSql.getParameterMappings() != null) {
handleParameter(boundSql, ms, long.class, long.class);
}
}
protected void handleParameter(BoundSql boundSql, MappedStatement ms, Class<?> firstClass, Class<?> secondClass) {
if (boundSql.getParameterMappings() != null) {
List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>(boundSql.getParameterMappings());
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, firstClass).build());
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, secondClass).build());
MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
metaObject.setValue("parameterMappings", newParameterMappings);
}
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/AbstractRowBoundsDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect;
import com.github.pagehelper.PageRowBounds;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.RowBounds;
import java.util.List;
import java.util.Properties;
/**
* 基于 RowBounds 的分页
*
* @author liuzh
*/
public abstract class AbstractRowBoundsDialect extends AbstractDialect {
@Override
public boolean skip(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
return rowBounds == RowBounds.DEFAULT;
}
@Override
public boolean beforeCount(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
if(rowBounds instanceof PageRowBounds){
PageRowBounds pageRowBounds = (PageRowBounds)rowBounds;
return pageRowBounds.getCount() == null || pageRowBounds.getCount();
}
return false;
}
@Override
public boolean afterCount(long count, Object parameterObject, RowBounds rowBounds) {
//由于 beforeCount 校验,这里一定是 PageRowBounds
((PageRowBounds) rowBounds).setTotal(count);
return count > 0;
}
@Override
public Object processParameterObject(MappedStatement ms, Object parameterObject, BoundSql boundSql, CacheKey pageKey) {
return parameterObject;
}
@Override
public boolean beforePage(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
return true;
}
@Override
public String getPageSql(MappedStatement ms, BoundSql boundSql, Object parameterObject, RowBounds rowBounds, CacheKey pageKey) {
String sql = boundSql.getSql();
return getPageSql(sql, rowBounds, pageKey);
}
public abstract String getPageSql(String sql, RowBounds rowBounds, CacheKey pageKey);
@Override
public Object afterPage(List pageList, Object parameterObject, RowBounds rowBounds) {
return pageList;
}
@Override
public void afterAll() {
}
@Override
public void setProperties(Properties properties) {
super.setProperties(properties);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/ReplaceSql.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect;
/**
* 替换和还原 SQL
*
* @author liuzh
* @since 2017/8/23.
*/
public interface ReplaceSql {
/**
* 临时替换后用于 jsqlparser 解析
*
* @param sql
* @return
*/
String replace(String sql);
/**
* 还原经过解析后的 sql
*
* @param sql
* @return
*/
String restore(String sql);
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/auto/C3P0AutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect.auto;
import com.mchange.v2.c3p0.ComboPooledDataSource;
/**
* c3p0
*
* @author liuzh
*/
public class C3P0AutoDialect extends DataSourceAutoDialect<ComboPooledDataSource> {
@Override
public String getJdbcUrl(ComboPooledDataSource comboPooledDataSource) {
return comboPooledDataSource.getJdbcUrl();
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/auto/DataSourceAutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect.auto;
import com.github.pagehelper.AutoDialect;
import com.github.pagehelper.dialect.AbstractHelperDialect;
import com.github.pagehelper.page.PageAutoDialect;
import org.apache.ibatis.mapping.MappedStatement;
import javax.sql.DataSource;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Properties;
/**
* 使用 Hikari 连接池时,简单获取 jdbcUrl
*
* @author liuzh
*/
public abstract class DataSourceAutoDialect<Ds extends DataSource> implements AutoDialect<String> {
protected Class dataSourceClass;
public DataSourceAutoDialect() {
Type genericSuperclass = getClass().getGenericSuperclass();
dataSourceClass = (Class) ((ParameterizedType) genericSuperclass).getActualTypeArguments()[0];
}
public abstract String getJdbcUrl(Ds ds);
@Override
public String extractDialectKey(MappedStatement ms, DataSource dataSource, Properties properties) {
if (dataSourceClass.isInstance(dataSource)) {
return getJdbcUrl((Ds) dataSource);
}
return null;
}
@Override
public AbstractHelperDialect extractDialect(String dialectKey, MappedStatement ms, DataSource dataSource, Properties properties) {
String dialect = PageAutoDialect.fromJdbcUrl(dialectKey);
return PageAutoDialect.instanceDialect(dialect, properties);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/auto/DataSourceNegotiationAutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect.auto;
import com.github.pagehelper.AutoDialect;
import com.github.pagehelper.dialect.AbstractHelperDialect;
import org.apache.ibatis.mapping.MappedStatement;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
/**
* 遍历所有实现,找到匹配的实现
*
* @author liuzh
*/
public class DataSourceNegotiationAutoDialect implements AutoDialect<String> {
private static final List<DataSourceAutoDialect> AUTO_DIALECTS = new ArrayList<DataSourceAutoDialect>();
private Map<String, DataSourceAutoDialect> urlMap = new ConcurrentHashMap<String, DataSourceAutoDialect>();
static {
//创建时,初始化所有实现,当依赖的连接池不存在时,这里不会添加成功,所以理论上这里包含的内容不会多,执行时不会迭代多次
try {
AUTO_DIALECTS.add(new HikariAutoDialect());
} catch (Exception ignore) {
}
try {
AUTO_DIALECTS.add(new DruidAutoDialect());
} catch (Exception ignore) {
}
try {
AUTO_DIALECTS.add(new TomcatAutoDialect());
} catch (Exception ignore) {
}
try {
AUTO_DIALECTS.add(new C3P0AutoDialect());
} catch (Exception ignore) {
}
try {
AUTO_DIALECTS.add(new DbcpAutoDialect());
} catch (Exception ignore) {
}
}
/**
* 允许手工添加额外的实现,实际上没有必要
*
* @param autoDialect
*/
public static void registerAutoDialect(DataSourceAutoDialect autoDialect) {
AUTO_DIALECTS.add(autoDialect);
}
@Override
public String extractDialectKey(MappedStatement ms, DataSource dataSource, Properties properties) {
for (DataSourceAutoDialect autoDialect : AUTO_DIALECTS) {
String dialectKey = autoDialect.extractDialectKey(ms, dataSource, properties);
if (dialectKey != null) {
if (!urlMap.containsKey(dialectKey)) {
urlMap.put(dialectKey, autoDialect);
}
return dialectKey;
}
}
//都不匹配的时候使用默认方式
return DefaultAutoDialect.DEFAULT.extractDialectKey(ms, dataSource, properties);
}
@Override
public AbstractHelperDialect extractDialect(String dialectKey, MappedStatement ms, DataSource dataSource, Properties properties) {
if (dialectKey != null && urlMap.containsKey(dialectKey)) {
return urlMap.get(dialectKey).extractDialect(dialectKey, ms, dataSource, properties);
}
//都不匹配的时候使用默认方式
return DefaultAutoDialect.DEFAULT.extractDialect(dialectKey, ms, dataSource, properties);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/auto/DbcpAutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect.auto;
import org.apache.commons.dbcp2.BasicDataSource;
/**
* commons-dbcp
*
* @author liuzh
*/
public class DbcpAutoDialect extends DataSourceAutoDialect<BasicDataSource> {
@Override
public String getJdbcUrl(BasicDataSource basicDataSource) {
return basicDataSource.getUrl();
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/auto/DefaultAutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect.auto;
import com.github.pagehelper.AutoDialect;
import com.github.pagehelper.PageException;
import com.github.pagehelper.dialect.AbstractHelperDialect;
import com.github.pagehelper.page.PageAutoDialect;
import com.github.pagehelper.util.StringUtil;
import org.apache.ibatis.mapping.MappedStatement;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
/**
* 最初的默认实现,获取连接再获取 url,这种方式通用性强,但是性能低,处理不好关闭连接时容易出问题
*
* @author liuzh
*/
public class DefaultAutoDialect implements AutoDialect<String> {
public static final AutoDialect<String> DEFAULT = new DefaultAutoDialect();
@Override
public String extractDialectKey(MappedStatement ms, DataSource dataSource, Properties properties) {
Connection conn = null;
try {
conn = dataSource.getConnection();
return conn.getMetaData().getURL();
} catch (SQLException e) {
throw new PageException(e);
} finally {
if (conn != null) {
try {
String closeConn = properties.getProperty("closeConn");
if (StringUtil.isEmpty(closeConn) || Boolean.parseBoolean(closeConn)) {
conn.close();
}
} catch (SQLException e) {
//ignore
}
}
}
}
@Override
public AbstractHelperDialect extractDialect(String dialectKey, MappedStatement ms, DataSource dataSource, Properties properties) {
String dialectStr = PageAutoDialect.fromJdbcUrl(dialectKey);
if (dialectStr == null) {
throw new PageException("The database type cannot be obtained automatically, please specify it via the helperDialect parameter!");
}
return PageAutoDialect.instanceDialect(dialectStr, properties);
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/auto/DruidAutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect.auto;
import com.alibaba.druid.pool.DruidDataSource;
/**
* Druid
*
* @author liuzh
*/
public class DruidAutoDialect extends DataSourceAutoDialect<DruidDataSource> {
@Override
public String getJdbcUrl(DruidDataSource druidDataSource) {
return druidDataSource.getUrl();
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/auto/HikariAutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect.auto;
import com.zaxxer.hikari.HikariDataSource;
/**
* Hikari
*
* @author liuzh
*/
public class HikariAutoDialect extends DataSourceAutoDialect<HikariDataSource> {
@Override
public String getJdbcUrl(HikariDataSource hikariDataSource) {
return hikariDataSource.getJdbcUrl();
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/auto/TomcatAutoDialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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.
*/
package com.github.pagehelper.dialect.auto;
import org.apache.tomcat.jdbc.pool.DataSource;
/**
* tomcat-jdbc
*
* @author liuzh
*/
public class TomcatAutoDialect extends DataSourceAutoDialect<DataSource> {
@Override
public String getJdbcUrl(DataSource dataSource) {
return dataSource.getUrl();
}
}
================================================
FILE: src/main/java/com/github/pagehelper/dialect/helper/AS400Dialect.java
================================================
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2023 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 substa
gitextract_2of7jm93/
├── .editorconfig
├── .github/
│ ├── FUNDING.yml
│ ├── issue_template.md
│ └── workflows/
│ ├── pull-request.yml
│ └── release.yml
├── .gitignore
├── LICENSE
├── README.md
├── README_en.md
├── jsqlparser4_7兼容性改动.patch
├── pom.xml
├── src/
│ ├── main/
│ │ └── java/
│ │ └── com/
│ │ └── github/
│ │ └── pagehelper/
│ │ ├── AutoDialect.java
│ │ ├── BoundSqlInterceptor.java
│ │ ├── BoundSqlInterceptorChain.java
│ │ ├── Constant.java
│ │ ├── CountMsIdGen.java
│ │ ├── Dialect.java
│ │ ├── IPage.java
│ │ ├── ISelect.java
│ │ ├── Page.java
│ │ ├── PageException.java
│ │ ├── PageHelper.java
│ │ ├── PageInfo.java
│ │ ├── PageInterceptor.java
│ │ ├── PageParam.java
│ │ ├── PageProperties.java
│ │ ├── PageRowBounds.java
│ │ ├── PageSerializable.java
│ │ ├── QueryInterceptor.java
│ │ ├── cache/
│ │ │ ├── Cache.java
│ │ │ ├── CacheFactory.java
│ │ │ ├── GuavaCache.java
│ │ │ └── SimpleCache.java
│ │ ├── dialect/
│ │ │ ├── AbstractDialect.java
│ │ │ ├── AbstractHelperDialect.java
│ │ │ ├── AbstractRowBoundsDialect.java
│ │ │ ├── ReplaceSql.java
│ │ │ ├── auto/
│ │ │ │ ├── C3P0AutoDialect.java
│ │ │ │ ├── DataSourceAutoDialect.java
│ │ │ │ ├── DataSourceNegotiationAutoDialect.java
│ │ │ │ ├── DbcpAutoDialect.java
│ │ │ │ ├── DefaultAutoDialect.java
│ │ │ │ ├── DruidAutoDialect.java
│ │ │ │ ├── HikariAutoDialect.java
│ │ │ │ └── TomcatAutoDialect.java
│ │ │ ├── helper/
│ │ │ │ ├── AS400Dialect.java
│ │ │ │ ├── CirroDataDialect.java
│ │ │ │ ├── Db2Dialect.java
│ │ │ │ ├── FirebirdDialect.java
│ │ │ │ ├── GaussDBDialect.java
│ │ │ │ ├── HerdDBDialect.java
│ │ │ │ ├── HsqldbDialect.java
│ │ │ │ ├── InformixDialect.java
│ │ │ │ ├── MySqlDialect.java
│ │ │ │ ├── Oracle9iDialect.java
│ │ │ │ ├── OracleDialect.java
│ │ │ │ ├── OscarDialect.java
│ │ │ │ ├── PostgreSqlDialect.java
│ │ │ │ ├── SqlServer2012Dialect.java
│ │ │ │ ├── SqlServerDialect.java
│ │ │ │ └── XuguDialect.java
│ │ │ ├── replace/
│ │ │ │ ├── RegexWithNolockReplaceSql.java
│ │ │ │ └── SimpleWithNolockReplaceSql.java
│ │ │ └── rowbounds/
│ │ │ ├── Db2RowBoundsDialect.java
│ │ │ ├── GaussDBRowBoundsDialect.java
│ │ │ ├── HerdDBRowBoundsDialect.java
│ │ │ ├── HsqldbRowBoundsDialect.java
│ │ │ ├── InformixRowBoundsDialect.java
│ │ │ ├── MySqlRowBoundsDialect.java
│ │ │ ├── OracleRowBoundsDialect.java
│ │ │ ├── PostgreSqlRowBoundsDialect.java
│ │ │ ├── SqlServer2012RowBoundsDialect.java
│ │ │ ├── SqlServerRowBoundsDialect.java
│ │ │ ├── XuguRowBoundsDialect.java
│ │ │ └── package-info.java
│ │ ├── page/
│ │ │ ├── PageAutoDialect.java
│ │ │ ├── PageBoundSqlInterceptors.java
│ │ │ ├── PageMethod.java
│ │ │ └── PageParams.java
│ │ ├── parser/
│ │ │ ├── CountSqlParser.java
│ │ │ ├── OrderBySqlParser.java
│ │ │ ├── SqlParser.java
│ │ │ ├── SqlParserUtil.java
│ │ │ ├── SqlServerSqlParser.java
│ │ │ └── defaults/
│ │ │ ├── DefaultCountSqlParser.java
│ │ │ ├── DefaultOrderBySqlParser.java
│ │ │ └── DefaultSqlServerSqlParser.java
│ │ └── util/
│ │ ├── ClassUtil.java
│ │ ├── ExecutorUtil.java
│ │ ├── MSUtils.java
│ │ ├── MetaObjectUtil.java
│ │ ├── MetaObjectWithReflectCache.java
│ │ ├── PageObjectUtil.java
│ │ ├── SqlSafeUtil.java
│ │ ├── StackTraceUtil.java
│ │ └── StringUtil.java
│ └── test/
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── pagehelper/
│ │ ├── mapper/
│ │ │ ├── ProviderMethod.java
│ │ │ └── UserMapper.java
│ │ ├── model/
│ │ │ ├── Code.java
│ │ │ ├── User.java
│ │ │ ├── UserCode.java
│ │ │ ├── UserExample.java
│ │ │ └── UserQueryModel.java
│ │ ├── rowbounds/
│ │ │ ├── RowBoundsHelper.java
│ │ │ └── test/
│ │ │ ├── PageRowBoundsTest.java
│ │ │ └── RowBoundsTest.java
│ │ ├── sql/
│ │ │ ├── DefaultOrderBySqlParserTest.java
│ │ │ ├── SqlServerTest.java
│ │ │ └── SqlTest.java
│ │ ├── test/
│ │ │ ├── basic/
│ │ │ │ ├── ArgumentsMapTest.java
│ │ │ │ ├── ArgumentsObjTest.java
│ │ │ │ ├── AsyncCountTest.java
│ │ │ │ ├── CloseableTest.java
│ │ │ │ ├── CollectionMapTest.java
│ │ │ │ ├── CountColumnTest.java
│ │ │ │ ├── EnumTest.java
│ │ │ │ ├── IPageTest.java
│ │ │ │ ├── OffsetTest.java
│ │ │ │ ├── PageHelperTest.java
│ │ │ │ ├── PageInfoTest.java
│ │ │ │ ├── RemoveOrderTest.java
│ │ │ │ ├── TestDistinct.java
│ │ │ │ ├── TestExecute.java
│ │ │ │ ├── TestISelect.java
│ │ │ │ ├── TestIntMax.java
│ │ │ │ ├── TestLike.java
│ │ │ │ ├── TestNamespaceMap.java
│ │ │ │ ├── annotations/
│ │ │ │ │ └── TestAnnotations.java
│ │ │ │ ├── cache/
│ │ │ │ │ ├── CacheTest.java
│ │ │ │ │ └── SecondCacheTest.java
│ │ │ │ ├── count/
│ │ │ │ │ ├── TestGroupBy.java
│ │ │ │ │ ├── TestOrderBy.java
│ │ │ │ │ └── TestSelectItems.java
│ │ │ │ ├── dynamic/
│ │ │ │ │ ├── CacheTest.java
│ │ │ │ │ ├── TestDynamicChoose.java
│ │ │ │ │ ├── TestDynamicForeach.java
│ │ │ │ │ ├── TestDynamicIf.java
│ │ │ │ │ ├── TestDynamicIf2.java
│ │ │ │ │ ├── TestDynamicIfOrder.java
│ │ │ │ │ ├── TestDynamicIfTwoList.java
│ │ │ │ │ ├── TestDynamicWhere.java
│ │ │ │ │ └── Where.java
│ │ │ │ ├── example/
│ │ │ │ │ └── TestExample.java
│ │ │ │ ├── parameter/
│ │ │ │ │ ├── TestParameterArray.java
│ │ │ │ │ ├── TestParameterList.java
│ │ │ │ │ ├── TestParameterMap.java
│ │ │ │ │ ├── TestParameterNone.java
│ │ │ │ │ └── TestParameterOne.java
│ │ │ │ ├── provider/
│ │ │ │ │ ├── SqlCache.java
│ │ │ │ │ ├── SqlCacheInterceptor.java
│ │ │ │ │ ├── TestBoundSqlInterceptor.java
│ │ │ │ │ ├── TestProvider.java
│ │ │ │ │ └── TestProviderInteceptor.java
│ │ │ │ └── sql/
│ │ │ │ ├── TestExists.java
│ │ │ │ ├── TestLeftjoin.java
│ │ │ │ ├── TestUnion.java
│ │ │ │ └── TestWith.java
│ │ │ ├── features/
│ │ │ │ ├── autodialect/
│ │ │ │ │ ├── AutoDialectTest.java
│ │ │ │ │ ├── DataSourceNegotiationAutoDialectTest.java
│ │ │ │ │ └── SimpleAutoDialect.java
│ │ │ │ └── dialectclass/
│ │ │ │ └── UsingDialectClassTest.java
│ │ │ ├── namespace/
│ │ │ │ └── BasicTest.java
│ │ │ ├── pagesize/
│ │ │ │ ├── PageSizeLessThenOrEqualZeroTest.java
│ │ │ │ └── PageSizeZeroTest.java
│ │ │ ├── reasonable/
│ │ │ │ └── PageTest.java
│ │ │ └── rowbounds/
│ │ │ └── RowBoundsTest.java
│ │ └── util/
│ │ ├── MybatisAutoDialectHelper.java
│ │ ├── MybatisHelper.java
│ │ ├── MybatisInterceptorHelper.java
│ │ ├── MybatisPageSizeZeroHelper.java
│ │ ├── MybatisReasonableHelper.java
│ │ ├── MybatisRowBoundsHelper.java
│ │ ├── Ognl.java
│ │ ├── SqlSafeUtilTest.java
│ │ └── TestUtil.java
│ └── resources/
│ ├── cirrodata/
│ │ ├── cirrodata.sql
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── com/
│ │ └── github/
│ │ └── pagehelper/
│ │ └── mapper/
│ │ └── UserMapper.xml
│ ├── db2/
│ │ ├── db2jcc4.jar
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── derby/
│ │ ├── derby.sql
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── h2/
│ │ ├── h2.sql
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── hsqldb/
│ │ ├── hsqldb.sql
│ │ ├── mybatis-config-autodialect.xml
│ │ ├── mybatis-config-interceptor.xml
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── logback.xml
│ ├── mariadb/
│ │ ├── mariadb.sql
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── mybatis-config-async-count.xml
│ ├── mysql/
│ │ ├── mybatis-config-autodialect.xml
│ │ ├── mybatis-config-interceptor.xml
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ ├── mybatis-config.xml
│ │ └── mysql.sql
│ ├── oracle/
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ ├── mybatis-config.xml
│ │ └── oracle.sql
│ ├── postgresql/
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ ├── mybatis-config.xml
│ │ └── postgresql.sql
│ ├── rowbounds/
│ │ ├── hsqldb.sql
│ │ └── mybatis-config.xml
│ ├── sqlserver/
│ │ ├── mybatis-config-pagesizezero.xml
│ │ ├── mybatis-config-reasonable.xml
│ │ ├── mybatis-config-rowbounds.xml
│ │ └── mybatis-config.xml
│ ├── test.properties
│ └── xugu/
│ ├── mybatis-config-interceptor.xml
│ ├── mybatis-config-pagesizezero.xml
│ ├── mybatis-config-reasonable.xml
│ ├── mybatis-config-rowbounds.xml
│ ├── mybatis-config.xml
│ └── mysql.sql
└── wikis/
├── en/
│ ├── Changelog.md
│ ├── HowToUse.md
│ ├── Important.md
│ └── Test.md
└── zh/
├── Changelog.md
├── HowToUse.md
├── Important.md
├── Interceptor.md
└── Test.md
SYMBOL INDEX (905 symbols across 173 files)
FILE: src/main/java/com/github/pagehelper/AutoDialect.java
type AutoDialect (line 38) | public interface AutoDialect<K> {
method extractDialectKey (line 48) | K extractDialectKey(MappedStatement ms, DataSource dataSource, Propert...
method extractDialect (line 59) | AbstractHelperDialect extractDialect(K dialectKey, MappedStatement ms,...
FILE: src/main/java/com/github/pagehelper/BoundSqlInterceptor.java
type BoundSqlInterceptor (line 33) | public interface BoundSqlInterceptor {
method boundSql (line 44) | BoundSql boundSql(Type type, BoundSql boundSql, CacheKey cacheKey, Cha...
type Type (line 46) | enum Type {
type Chain (line 64) | interface Chain {
method doBoundSql (line 68) | BoundSql doBoundSql(Type type, BoundSql boundSql, CacheKey cacheKey);
FILE: src/main/java/com/github/pagehelper/BoundSqlInterceptorChain.java
class BoundSqlInterceptorChain (line 32) | public class BoundSqlInterceptorChain implements BoundSqlInterceptor.Cha...
method BoundSqlInterceptorChain (line 39) | public BoundSqlInterceptorChain(BoundSqlInterceptor.Chain original, Li...
method BoundSqlInterceptorChain (line 43) | private BoundSqlInterceptorChain(BoundSqlInterceptor.Chain original, L...
method doBoundSql (line 49) | @Override
method _doBoundSql (line 58) | private BoundSql _doBoundSql(BoundSqlInterceptor.Type type, BoundSql b...
FILE: src/main/java/com/github/pagehelper/Constant.java
type Constant (line 30) | public interface Constant {
FILE: src/main/java/com/github/pagehelper/CountMsIdGen.java
type CountMsIdGen (line 39) | public interface CountMsIdGen {
method genCountMsId (line 55) | String genCountMsId(MappedStatement ms, Object parameter,
FILE: src/main/java/com/github/pagehelper/Dialect.java
type Dialect (line 43) | public interface Dialect {
method skip (line 52) | boolean skip(MappedStatement ms, Object parameterObject, RowBounds row...
method isAsyncCount (line 59) | default boolean isAsyncCount() {
method asyncCountTask (line 70) | default <T> Future<T> asyncCountTask(Callable<T> task) {
method beforeCount (line 82) | boolean beforeCount(MappedStatement ms, Object parameterObject, RowBou...
method getCountSql (line 94) | String getCountSql(MappedStatement ms, BoundSql boundSql, Object param...
method afterCount (line 104) | boolean afterCount(long count, Object parameterObject, RowBounds rowBo...
method processParameterObject (line 115) | Object processParameterObject(MappedStatement ms, Object parameterObje...
method beforePage (line 125) | boolean beforePage(MappedStatement ms, Object parameterObject, RowBoun...
method getPageSql (line 137) | String getPageSql(MappedStatement ms, BoundSql boundSql, Object parame...
method afterPage (line 147) | Object afterPage(List pageList, Object parameterObject, RowBounds rowB...
method afterAll (line 152) | void afterAll();
method setProperties (line 159) | void setProperties(Properties properties);
FILE: src/main/java/com/github/pagehelper/IPage.java
type IPage (line 30) | public interface IPage {
method getPageNum (line 32) | Integer getPageNum();
method getPageSize (line 34) | Integer getPageSize();
method getOrderBy (line 36) | String getOrderBy();
FILE: src/main/java/com/github/pagehelper/ISelect.java
type ISelect (line 33) | public interface ISelect {
method doSelect (line 38) | void doSelect();
FILE: src/main/java/com/github/pagehelper/Page.java
class Page (line 43) | public class Page<E> extends ArrayList<E> implements Closeable {
method Page (line 122) | public Page() {
method Page (line 126) | public Page(int pageNum, int pageSize) {
method Page (line 130) | public Page(int pageNum, int pageSize, boolean count) {
method Page (line 134) | private Page(int pageNum, int pageSize, boolean count, Boolean reasona...
method Page (line 152) | public Page(int[] rowBounds, boolean count) {
method getStackTrace (line 167) | public String getStackTrace() {
method getResult (line 171) | public List<E> getResult() {
method getPages (line 175) | public int getPages() {
method setPages (line 179) | public Page<E> setPages(int pages) {
method getEndRow (line 184) | public long getEndRow() {
method setEndRow (line 188) | public Page<E> setEndRow(long endRow) {
method getPageNum (line 193) | public int getPageNum() {
method setPageNum (line 197) | public Page<E> setPageNum(int pageNum) {
method getPageSize (line 203) | public int getPageSize() {
method setPageSize (line 207) | public Page<E> setPageSize(int pageSize) {
method getStartRow (line 212) | public long getStartRow() {
method setStartRow (line 216) | public Page<E> setStartRow(long startRow) {
method getTotal (line 221) | public long getTotal() {
method setTotal (line 225) | public void setTotal(long total) {
method getReasonable (line 245) | public Boolean getReasonable() {
method setReasonable (line 249) | public Page<E> setReasonable(Boolean reasonable) {
method getPageSizeZero (line 262) | public Boolean getPageSizeZero() {
method setPageSizeZero (line 266) | public Page<E> setPageSizeZero(Boolean pageSizeZero) {
method getOrderBy (line 273) | public String getOrderBy() {
method setOrderBy (line 282) | public <E> Page<E> setOrderBy(String orderBy) {
method setUnsafeOrderBy (line 298) | public <E> Page<E> setUnsafeOrderBy(String orderBy) {
method isOrderByOnly (line 303) | public boolean isOrderByOnly() {
method setOrderByOnly (line 307) | public void setOrderByOnly(boolean orderByOnly) {
method getDialectClass (line 311) | public String getDialectClass() {
method setDialectClass (line 315) | public void setDialectClass(String dialectClass) {
method getKeepOrderBy (line 319) | public Boolean getKeepOrderBy() {
method setKeepOrderBy (line 323) | public Page<E> setKeepOrderBy(Boolean keepOrderBy) {
method getKeepSubSelectOrderBy (line 328) | public Boolean getKeepSubSelectOrderBy() {
method setKeepSubSelectOrderBy (line 332) | public void setKeepSubSelectOrderBy(Boolean keepSubSelectOrderBy) {
method getAsyncCount (line 336) | public Boolean getAsyncCount() {
method setAsyncCount (line 340) | public void setAsyncCount(Boolean asyncCount) {
method using (line 350) | public Page<E> using(String dialect) {
method calculateStartAndEndRow (line 358) | private void calculateStartAndEndRow() {
method isCount (line 363) | public boolean isCount() {
method setCount (line 367) | public Page<E> setCount(boolean count) {
method pageNum (line 378) | public Page<E> pageNum(int pageNum) {
method pageSize (line 390) | public Page<E> pageSize(int pageSize) {
method count (line 402) | public Page<E> count(Boolean count) {
method reasonable (line 413) | public Page<E> reasonable(Boolean reasonable) {
method pageSizeZero (line 424) | public Page<E> pageSizeZero(Boolean pageSizeZero) {
method boundSqlInterceptor (line 435) | public Page<E> boundSqlInterceptor(BoundSqlInterceptor boundSqlInterce...
method countColumn (line 446) | public Page<E> countColumn(String columnName) {
method keepOrderBy (line 457) | public Page<E> keepOrderBy(boolean keepOrderBy) {
method keepOrderBy (line 462) | public boolean keepOrderBy() {
method keepSubSelectOrderBy (line 472) | public Page<E> keepSubSelectOrderBy(boolean keepSubSelectOrderBy) {
method keepSubSelectOrderBy (line 477) | public boolean keepSubSelectOrderBy() {
method asyncCount (line 487) | public Page<E> asyncCount(boolean asyncCount) {
method enableAsyncCount (line 497) | public Page<E> enableAsyncCount() {
method disableAsyncCount (line 506) | public Page<E> disableAsyncCount() {
method asyncCount (line 511) | public boolean asyncCount() {
method toPageInfo (line 515) | public PageInfo<E> toPageInfo() {
method toPageInfo (line 526) | public <T> PageInfo<T> toPageInfo(Function<E, T> function) {
method toPageSerializable (line 542) | public PageSerializable<E> toPageSerializable() {
method toPageSerializable (line 553) | public <T> PageSerializable<T> toPageSerializable(Function<E, T> funct...
method doSelectPage (line 563) | public <E> Page<E> doSelectPage(ISelect select) {
method doSelectPageInfo (line 568) | public <E> PageInfo<E> doSelectPageInfo(ISelect select) {
method doSelectPageSerializable (line 573) | public <E> PageSerializable<E> doSelectPageSerializable(ISelect select) {
method doCount (line 578) | public long doCount(ISelect select) {
method getCountColumn (line 585) | public String getCountColumn() {
method setCountColumn (line 589) | public void setCountColumn(String countColumn) {
method getBoundSqlInterceptor (line 596) | public BoundSqlInterceptor getBoundSqlInterceptor() {
method setBoundSqlInterceptor (line 600) | public void setBoundSqlInterceptor(BoundSqlInterceptor boundSqlInterce...
method getChain (line 604) | BoundSqlInterceptor.Chain getChain() {
method setChain (line 608) | void setChain(BoundSqlInterceptor.Chain chain) {
method toString (line 612) | @Override
method close (line 627) | @Override
type Function (line 635) | public interface Function<E, T> {
method apply (line 643) | T apply(E t);
FILE: src/main/java/com/github/pagehelper/PageException.java
class PageException (line 30) | public class PageException extends RuntimeException {
method PageException (line 31) | public PageException() {
method PageException (line 35) | public PageException(String message) {
method PageException (line 39) | public PageException(String message, Throwable cause) {
method PageException (line 43) | public PageException(Throwable cause) {
FILE: src/main/java/com/github/pagehelper/PageHelper.java
class PageHelper (line 55) | public class PageHelper extends PageMethod implements Dialect, BoundSqlI...
method skip (line 61) | @Override
method isAsyncCount (line 80) | @Override
method asyncCountTask (line 85) | @Override
method beforeCount (line 104) | @Override
method getCountSql (line 109) | @Override
method afterCount (line 114) | @Override
method processParameterObject (line 119) | @Override
method beforePage (line 124) | @Override
method getPageSql (line 129) | @Override
method getPageSql (line 134) | public String getPageSql(String sql, Page page, RowBounds rowBounds, C...
method afterPage (line 138) | @Override
method afterAll (line 148) | @Override
method doBoundSql (line 159) | @Override
method setProperties (line 181) | @Override
FILE: src/main/java/com/github/pagehelper/PageInfo.java
class PageInfo (line 42) | @SuppressWarnings({"rawtypes", "unchecked"})
method PageInfo (line 116) | public PageInfo() {
method PageInfo (line 124) | public PageInfo(List<? extends T> list) {
method PageInfo (line 134) | public PageInfo(List<? extends T> list, int navigatePages) {
method of (line 166) | public static <T> PageInfo<T> of(List<? extends T> list) {
method of (line 177) | public static <T> PageInfo<T> of(long total, List<? extends T> list) {
method of (line 185) | public static <T> PageInfo<T> of(List<? extends T> list, int navigateP...
method emptyPageInfo (line 194) | public static <T> PageInfo<T> emptyPageInfo() {
method calcByNavigatePages (line 198) | public void calcByNavigatePages(int navigatePages) {
method calcNavigatepageNums (line 211) | private void calcNavigatepageNums() {
method calcPage (line 247) | private void calcPage() {
method judgePageBoudary (line 263) | private void judgePageBoudary() {
method convert (line 277) | public <E> PageInfo<E> convert(Page.Function<T, E> function) {
method hasContent (line 306) | public boolean hasContent() {
method getPageNum (line 310) | public int getPageNum() {
method setPageNum (line 314) | public void setPageNum(int pageNum) {
method getPageSize (line 318) | public int getPageSize() {
method setPageSize (line 322) | public void setPageSize(int pageSize) {
method getSize (line 326) | public int getSize() {
method setSize (line 330) | public void setSize(int size) {
method getStartRow (line 334) | public long getStartRow() {
method setStartRow (line 338) | public void setStartRow(long startRow) {
method getEndRow (line 342) | public long getEndRow() {
method setEndRow (line 346) | public void setEndRow(long endRow) {
method getPages (line 350) | public int getPages() {
method setPages (line 354) | public void setPages(int pages) {
method getPrePage (line 358) | public int getPrePage() {
method setPrePage (line 362) | public void setPrePage(int prePage) {
method getNextPage (line 366) | public int getNextPage() {
method setNextPage (line 370) | public void setNextPage(int nextPage) {
method isIsFirstPage (line 374) | public boolean isIsFirstPage() {
method setIsFirstPage (line 378) | public void setIsFirstPage(boolean isFirstPage) {
method isIsLastPage (line 382) | public boolean isIsLastPage() {
method setIsLastPage (line 386) | public void setIsLastPage(boolean isLastPage) {
method isHasPreviousPage (line 390) | public boolean isHasPreviousPage() {
method setHasPreviousPage (line 394) | public void setHasPreviousPage(boolean hasPreviousPage) {
method isHasNextPage (line 398) | public boolean isHasNextPage() {
method setHasNextPage (line 402) | public void setHasNextPage(boolean hasNextPage) {
method getNavigatePages (line 406) | public int getNavigatePages() {
method setNavigatePages (line 410) | public void setNavigatePages(int navigatePages) {
method getNavigatepageNums (line 414) | public int[] getNavigatepageNums() {
method setNavigatepageNums (line 418) | public void setNavigatepageNums(int[] navigatepageNums) {
method getNavigateFirstPage (line 422) | public int getNavigateFirstPage() {
method getNavigateLastPage (line 426) | public int getNavigateLastPage() {
method setNavigateFirstPage (line 430) | public void setNavigateFirstPage(int navigateFirstPage) {
method setNavigateLastPage (line 434) | public void setNavigateLastPage(int navigateLastPage) {
method toString (line 438) | @Override
FILE: src/main/java/com/github/pagehelper/PageInterceptor.java
class PageInterceptor (line 68) | @SuppressWarnings({"rawtypes", "unchecked"})
method PageInterceptor (line 84) | public PageInterceptor() {
method isDebug (line 101) | public static boolean isDebug() {
method debugStackTraceLog (line 108) | protected void debugStackTraceLog() {
method intercept (line 115) | @Override
method asyncCount (line 183) | private Future<Long> asyncCount(MappedStatement ms, BoundSql boundSql,...
method checkDialectExists (line 220) | private void checkDialectExists() {
method count (line 230) | private Long count(Executor executor, MappedStatement ms, Object param...
method plugin (line 256) | @Override
method setProperties (line 261) | @Override
FILE: src/main/java/com/github/pagehelper/PageParam.java
class PageParam (line 30) | public class PageParam implements IPage {
method PageParam (line 35) | public PageParam() {
method PageParam (line 38) | public PageParam(Integer pageNum, Integer pageSize) {
method PageParam (line 43) | public PageParam(Integer pageNum, Integer pageSize, String orderBy) {
method setPageNum (line 49) | public void setPageNum(Integer pageNum) {
method setPageSize (line 53) | public void setPageSize(Integer pageSize) {
method setOrderBy (line 57) | public void setOrderBy(String orderBy) {
method getPageNum (line 61) | @Override
method getPageSize (line 66) | @Override
method getOrderBy (line 71) | @Override
FILE: src/main/java/com/github/pagehelper/PageProperties.java
type PageProperties (line 34) | public interface PageProperties {
method setProperties (line 41) | void setProperties(Properties properties);
FILE: src/main/java/com/github/pagehelper/PageRowBounds.java
class PageRowBounds (line 32) | public class PageRowBounds extends RowBounds {
method PageRowBounds (line 36) | public PageRowBounds(int offset, int limit) {
method getTotal (line 40) | public Long getTotal() {
method setTotal (line 44) | public void setTotal(Long total) {
method getCount (line 48) | public Boolean getCount() {
method setCount (line 52) | public void setCount(Boolean count) {
FILE: src/main/java/com/github/pagehelper/PageSerializable.java
class PageSerializable (line 33) | public class PageSerializable<T> implements Serializable {
method PageSerializable (line 40) | public PageSerializable() {
method PageSerializable (line 43) | @SuppressWarnings("unchecked")
method of (line 53) | public static <T> PageSerializable<T> of(List<? extends T> list){
method getTotal (line 57) | public long getTotal() {
method setTotal (line 61) | public void setTotal(long total) {
method getList (line 65) | public List<T> getList() {
method setList (line 69) | public void setList(List<T> list) {
method toString (line 73) | @Override
FILE: src/main/java/com/github/pagehelper/QueryInterceptor.java
class QueryInterceptor (line 45) | @Intercepts(
method intercept (line 53) | @Override
method plugin (line 78) | @Override
method setProperties (line 83) | @Override
FILE: src/main/java/com/github/pagehelper/cache/Cache.java
type Cache (line 32) | public interface Cache<K, V> {
method get (line 34) | V get(K key);
method put (line 36) | void put(K key, V value);
FILE: src/main/java/com/github/pagehelper/cache/CacheFactory.java
class CacheFactory (line 39) | public abstract class CacheFactory {
method createCache (line 47) | public static <K, V> Cache<K, V> createCache(String sqlCacheClass, Str...
FILE: src/main/java/com/github/pagehelper/cache/GuavaCache.java
class GuavaCache (line 38) | public class GuavaCache<K, V> implements Cache<K, V> {
method GuavaCache (line 42) | public GuavaCache(Properties properties, String prefix) {
method get (line 65) | @Override
method put (line 70) | @Override
FILE: src/main/java/com/github/pagehelper/cache/SimpleCache.java
class SimpleCache (line 39) | public class SimpleCache<K, V> implements Cache<K, V> {
method SimpleCache (line 43) | public SimpleCache(Properties properties, String prefix) {
method get (line 77) | @Override
method put (line 86) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/AbstractDialect.java
class AbstractDialect (line 45) | public abstract class AbstractDialect implements Dialect {
method getCountSql (line 50) | @Override
method setProperties (line 55) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/AbstractHelperDialect.java
class AbstractHelperDialect (line 50) | public abstract class AbstractHelperDialect extends AbstractDialect impl...
method getLocalPage (line 58) | public <T> Page<T> getLocalPage() {
method skip (line 62) | @Override
method beforeCount (line 68) | @Override
method getCountSql (line 74) | @Override
method afterCount (line 84) | @Override
method processParameterObject (line 107) | @Override
method processPageParameter (line 171) | public abstract Object processPageParameter(MappedStatement ms, Map<St...
method beforePage (line 173) | @Override
method getPageSql (line 182) | @Override
method getPageSql (line 206) | public abstract String getPageSql(String sql, Page page, CacheKey page...
method afterPage (line 208) | @Override
method afterAll (line 226) | @Override
method setProperties (line 231) | @Override
method handleParameter (line 241) | @Deprecated
method handleParameter (line 248) | protected void handleParameter(BoundSql boundSql, MappedStatement ms, ...
FILE: src/main/java/com/github/pagehelper/dialect/AbstractRowBoundsDialect.java
class AbstractRowBoundsDialect (line 41) | public abstract class AbstractRowBoundsDialect extends AbstractDialect {
method skip (line 43) | @Override
method beforeCount (line 48) | @Override
method afterCount (line 57) | @Override
method processParameterObject (line 64) | @Override
method beforePage (line 69) | @Override
method getPageSql (line 74) | @Override
method getPageSql (line 80) | public abstract String getPageSql(String sql, RowBounds rowBounds, Cac...
method afterPage (line 82) | @Override
method afterAll (line 87) | @Override
method setProperties (line 92) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/ReplaceSql.java
type ReplaceSql (line 33) | public interface ReplaceSql {
method replace (line 41) | String replace(String sql);
method restore (line 49) | String restore(String sql);
FILE: src/main/java/com/github/pagehelper/dialect/auto/C3P0AutoDialect.java
class C3P0AutoDialect (line 34) | public class C3P0AutoDialect extends DataSourceAutoDialect<ComboPooledDa...
method getJdbcUrl (line 36) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/auto/DataSourceAutoDialect.java
class DataSourceAutoDialect (line 42) | public abstract class DataSourceAutoDialect<Ds extends DataSource> imple...
method DataSourceAutoDialect (line 45) | public DataSourceAutoDialect() {
method getJdbcUrl (line 50) | public abstract String getJdbcUrl(Ds ds);
method extractDialectKey (line 52) | @Override
method extractDialect (line 60) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/auto/DataSourceNegotiationAutoDialect.java
class DataSourceNegotiationAutoDialect (line 43) | public class DataSourceNegotiationAutoDialect implements AutoDialect<Str...
method registerAutoDialect (line 76) | public static void registerAutoDialect(DataSourceAutoDialect autoDiale...
method extractDialectKey (line 80) | @Override
method extractDialect (line 95) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/auto/DbcpAutoDialect.java
class DbcpAutoDialect (line 34) | public class DbcpAutoDialect extends DataSourceAutoDialect<BasicDataSour...
method getJdbcUrl (line 36) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/auto/DefaultAutoDialect.java
class DefaultAutoDialect (line 44) | public class DefaultAutoDialect implements AutoDialect<String> {
method extractDialectKey (line 48) | @Override
method extractDialect (line 70) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/auto/DruidAutoDialect.java
class DruidAutoDialect (line 34) | public class DruidAutoDialect extends DataSourceAutoDialect<DruidDataSou...
method getJdbcUrl (line 36) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/auto/HikariAutoDialect.java
class HikariAutoDialect (line 34) | public class HikariAutoDialect extends DataSourceAutoDialect<HikariDataS...
method getJdbcUrl (line 36) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/auto/TomcatAutoDialect.java
class TomcatAutoDialect (line 34) | public class TomcatAutoDialect extends DataSourceAutoDialect<DataSource> {
method getJdbcUrl (line 36) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/AS400Dialect.java
class AS400Dialect (line 38) | @SuppressWarnings("rawtypes")
method processPageParameter (line 41) | @Override
method getPageSql (line 52) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/CirroDataDialect.java
class CirroDataDialect (line 38) | public class CirroDataDialect extends AbstractHelperDialect {
method processPageParameter (line 39) | @Override
method getPageSql (line 51) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/Db2Dialect.java
class Db2Dialect (line 38) | public class Db2Dialect extends AbstractHelperDialect {
method processPageParameter (line 40) | @Override
method getPageSql (line 52) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/FirebirdDialect.java
class FirebirdDialect (line 44) | public class FirebirdDialect extends AbstractHelperDialect {
method processPageParameter (line 46) | @Override
method getPageSql (line 58) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/GaussDBDialect.java
class GaussDBDialect (line 46) | public class GaussDBDialect extends AbstractHelperDialect {
method processPageParameter (line 48) | @Override
method getPageSql (line 71) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/HerdDBDialect.java
class HerdDBDialect (line 44) | public class HerdDBDialect extends AbstractHelperDialect {
method processPageParameter (line 46) | @Override
method getPageSql (line 66) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/HsqldbDialect.java
class HsqldbDialect (line 43) | public class HsqldbDialect extends AbstractHelperDialect {
method processPageParameter (line 45) | @Override
method getPageSql (line 67) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/InformixDialect.java
class InformixDialect (line 43) | public class InformixDialect extends AbstractHelperDialect {
method processPageParameter (line 45) | @Override
method getPageSql (line 68) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/MySqlDialect.java
class MySqlDialect (line 43) | public class MySqlDialect extends AbstractHelperDialect {
method processPageParameter (line 45) | @Override
method getPageSql (line 67) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/Oracle9iDialect.java
class Oracle9iDialect (line 43) | public class Oracle9iDialect extends AbstractHelperDialect {
method processPageParameter (line 45) | @Override
method getPageSql (line 57) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/OracleDialect.java
class OracleDialect (line 38) | public class OracleDialect extends AbstractHelperDialect {
method processPageParameter (line 40) | @Override
method getPageSql (line 52) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/OscarDialect.java
class OscarDialect (line 43) | public class OscarDialect extends AbstractHelperDialect {
method processPageParameter (line 45) | @Override
method getPageSql (line 67) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/PostgreSqlDialect.java
class PostgreSqlDialect (line 46) | public class PostgreSqlDialect extends AbstractHelperDialect {
method processPageParameter (line 48) | @Override
method getPageSql (line 73) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/SqlServer2012Dialect.java
class SqlServer2012Dialect (line 37) | public class SqlServer2012Dialect extends SqlServerDialect {
method processPageParameter (line 39) | @Override
method getPageSql (line 51) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/SqlServerDialect.java
class SqlServerDialect (line 49) | public class SqlServerDialect extends AbstractHelperDialect {
method getCountSql (line 55) | @Override
method processPageParameter (line 71) | @Override
method getPageSql (line 76) | @Override
method getPageSql (line 101) | @Override
method setProperties (line 116) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/helper/XuguDialect.java
class XuguDialect (line 43) | public class XuguDialect extends AbstractHelperDialect {
method processPageParameter (line 45) | @Override
method getPageSql (line 67) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/replace/RegexWithNolockReplaceSql.java
class RegexWithNolockReplaceSql (line 35) | public class RegexWithNolockReplaceSql implements ReplaceSql {
method replace (line 40) | @Override
method restore (line 45) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/replace/SimpleWithNolockReplaceSql.java
class SimpleWithNolockReplaceSql (line 35) | public class SimpleWithNolockReplaceSql implements ReplaceSql {
method replace (line 40) | @Override
method restore (line 45) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/Db2RowBoundsDialect.java
class Db2RowBoundsDialect (line 36) | public class Db2RowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 38) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/GaussDBRowBoundsDialect.java
class GaussDBRowBoundsDialect (line 37) | public class GaussDBRowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 42) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/HerdDBRowBoundsDialect.java
class HerdDBRowBoundsDialect (line 36) | public class HerdDBRowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 38) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/HsqldbRowBoundsDialect.java
class HsqldbRowBoundsDialect (line 36) | public class HsqldbRowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 38) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/InformixRowBoundsDialect.java
class InformixRowBoundsDialect (line 36) | public class InformixRowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 38) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/MySqlRowBoundsDialect.java
class MySqlRowBoundsDialect (line 36) | public class MySqlRowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 38) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/OracleRowBoundsDialect.java
class OracleRowBoundsDialect (line 36) | public class OracleRowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 38) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/PostgreSqlRowBoundsDialect.java
class PostgreSqlRowBoundsDialect (line 37) | public class PostgreSqlRowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 42) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/SqlServer2012RowBoundsDialect.java
class SqlServer2012RowBoundsDialect (line 35) | public class SqlServer2012RowBoundsDialect extends SqlServerRowBoundsDia...
method getPageSql (line 37) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/SqlServerRowBoundsDialect.java
class SqlServerRowBoundsDialect (line 47) | public class SqlServerRowBoundsDialect extends AbstractRowBoundsDialect {
method getCountSql (line 51) | @Override
method getPageSql (line 60) | @Override
method setProperties (line 73) | @Override
FILE: src/main/java/com/github/pagehelper/dialect/rowbounds/XuguRowBoundsDialect.java
class XuguRowBoundsDialect (line 36) | public class XuguRowBoundsDialect extends AbstractRowBoundsDialect {
method getPageSql (line 38) | @Override
FILE: src/main/java/com/github/pagehelper/page/PageAutoDialect.java
class PageAutoDialect (line 49) | public class PageAutoDialect {
method registerDialectAlias (line 54) | public static void registerDialectAlias(String alias, Class<? extends ...
method registerAutoDialectAlias (line 122) | public static void registerAutoDialectAlias(String alias, Class<? exte...
method fromJdbcUrl (line 143) | public static String fromJdbcUrl(String jdbcUrl) {
method getDelegate (line 154) | public AbstractHelperDialect getDelegate() {
method clearDelegate (line 162) | public void clearDelegate() {
method getDialectThreadLocal (line 166) | public AbstractHelperDialect getDialectThreadLocal() {
method setDialectThreadLocal (line 170) | public void setDialectThreadLocal(AbstractHelperDialect delegate) {
method resloveDialectClass (line 181) | public static Class resloveDialectClass(String className) throws Excep...
method instanceDialect (line 195) | public static AbstractHelperDialect instanceDialect(String dialectClas...
method initDelegateDialect (line 220) | public void initDelegateDialect(MappedStatement ms, String dialectClas...
method autoGetDialect (line 250) | public AbstractHelperDialect autoGetDialect(MappedStatement ms) {
method initAutoDialectClass (line 273) | private void initAutoDialectClass(Properties properties) {
method initDialectAlias (line 300) | private void initDialectAlias(Properties properties) {
method setProperties (line 328) | public void setProperties(Properties properties) {
FILE: src/main/java/com/github/pagehelper/page/PageBoundSqlInterceptors.java
class PageBoundSqlInterceptors (line 36) | public class PageBoundSqlInterceptors {
method setProperties (line 40) | public void setProperties(Properties properties) {
method getChain (line 55) | public BoundSqlInterceptor.Chain getChain() {
FILE: src/main/java/com/github/pagehelper/page/PageMethod.java
class PageMethod (line 38) | public abstract class PageMethod {
method setLocalPage (line 47) | public static void setLocalPage(Page page) {
method getLocalPage (line 56) | public static <T> Page<T> getLocalPage() {
method clearPage (line 63) | public static void clearPage() {
method count (line 73) | public static long count(ISelect select) {
method startPage (line 85) | public static <E> Page<E> startPage(Object params) {
method startPage (line 102) | public static <E> Page<E> startPage(int pageNum, int pageSize) {
method startPage (line 113) | public static <E> Page<E> startPage(int pageNum, int pageSize, boolean...
method startPage (line 124) | public static <E> Page<E> startPage(int pageNum, int pageSize, String ...
method startPage (line 139) | public static <E> Page<E> startPage(int pageNum, int pageSize, boolean...
method offsetPage (line 158) | public static <E> Page<E> offsetPage(int offset, int limit) {
method offsetPage (line 169) | public static <E> Page<E> offsetPage(int offset, int limit, boolean co...
method orderBy (line 185) | public static void orderBy(String orderBy) {
method setStaticProperties (line 205) | protected static void setStaticProperties(Properties properties) {
FILE: src/main/java/com/github/pagehelper/page/PageParams.java
class PageParams (line 42) | public class PageParams {
method getPage (line 87) | public Page getPage(Object parameterObject, RowBounds rowBounds) {
method setProperties (line 131) | public void setProperties(Properties properties) {
method isOffsetAsPageNum (line 163) | public boolean isOffsetAsPageNum() {
method isRowBoundsWithCount (line 167) | public boolean isRowBoundsWithCount() {
method isPageSizeZero (line 171) | public boolean isPageSizeZero() {
method isReasonable (line 175) | public boolean isReasonable() {
method isSupportMethodsArguments (line 179) | public boolean isSupportMethodsArguments() {
method getCountColumn (line 183) | public String getCountColumn() {
method isAsyncCount (line 187) | public boolean isAsyncCount() {
FILE: src/main/java/com/github/pagehelper/parser/CountSqlParser.java
type CountSqlParser (line 33) | public interface CountSqlParser {
method addAggregateFunctions (line 123) | static void addAggregateFunctions(String functions) {
method getSmartCountSql (line 137) | default String getSmartCountSql(String sql) {
method getSmartCountSql (line 148) | String getSmartCountSql(String sql, String countColumn);
FILE: src/main/java/com/github/pagehelper/parser/OrderBySqlParser.java
type OrderBySqlParser (line 27) | public interface OrderBySqlParser {
method converToOrderBySql (line 28) | String converToOrderBySql(String sql, String orderBy);
FILE: src/main/java/com/github/pagehelper/parser/SqlParser.java
type SqlParser (line 38) | public interface SqlParser {
method parse (line 55) | Statement parse(String statementReader) throws JSQLParserException, Pa...
FILE: src/main/java/com/github/pagehelper/parser/SqlParserUtil.java
class SqlParserUtil (line 9) | public class SqlParserUtil {
method parse (line 26) | public static Statement parse(String statementReader) {
FILE: src/main/java/com/github/pagehelper/parser/SqlServerSqlParser.java
type SqlServerSqlParser (line 30) | public interface SqlServerSqlParser {
method convertToPageSql (line 32) | String convertToPageSql(String sql, Integer offset, Integer limit);
FILE: src/main/java/com/github/pagehelper/parser/defaults/DefaultCountSqlParser.java
class DefaultCountSqlParser (line 46) | public class DefaultCountSqlParser implements CountSqlParser {
method getSmartCountSql (line 65) | @Override
method getSimpleCountSql (line 111) | public String getSimpleCountSql(final String sql) {
method getSimpleCountSql (line 121) | public String getSimpleCountSql(final String sql, String name) {
method sqlToCount (line 136) | public Select sqlToCount(Select select, String name) {
method isSimpleCount (line 164) | public boolean isSimpleCount(PlainSelect select) {
method processSelect (line 224) | public void processSelect(Select select) {
method processPlainSelect (line 255) | public void processPlainSelect(PlainSelect plainSelect) {
method processWithItemsList (line 277) | public void processWithItemsList(List<WithItem> withItemsList) {
method processFromItem (line 292) | public void processFromItem(FromItem fromItem) {
method keepOrderBy (line 310) | protected boolean keepOrderBy() {
method keepSubSelectOrderBy (line 317) | protected boolean keepSubSelectOrderBy() {
method orderByHashParameters (line 327) | public boolean orderByHashParameters(List<OrderByElement> orderByEleme...
FILE: src/main/java/com/github/pagehelper/parser/defaults/DefaultOrderBySqlParser.java
class DefaultOrderBySqlParser (line 43) | public class DefaultOrderBySqlParser implements OrderBySqlParser {
method converToOrderBySql (line 53) | @Override
method extraOrderBy (line 79) | public static List<OrderByElement> extraOrderBy(Select select) {
FILE: src/main/java/com/github/pagehelper/parser/defaults/DefaultSqlServerSqlParser.java
class DefaultSqlServerSqlParser (line 56) | public class DefaultSqlServerSqlParser implements SqlServerSqlParser {
method convertToPageSql (line 89) | public String convertToPageSql(String sql) {
method convertToPageSql (line 101) | public String convertToPageSql(String sql, Integer offset, Integer lim...
method getPageSelect (line 131) | protected Select getPageSelect(Select select) {
method wrapSetOperationList (line 198) | protected Select wrapSetOperationList(SetOperationList setOperationLis...
method getSelectItems (line 228) | protected List<SelectItem<?>> getSelectItems(PlainSelect plainSelect) {
method addRowNumber (line 273) | protected SelectItem<?> addRowNumber(PlainSelect plainSelect, List<Sel...
method processSelectBody (line 295) | protected void processSelectBody(Select select, int level) {
method processPlainSelect (line 321) | protected void processPlainSelect(PlainSelect plainSelect, int level) {
method processFromItem (line 347) | protected void processFromItem(FromItem fromItem, int level) {
method isNotEmptyList (line 366) | public boolean isNotEmptyList(List<?> list) {
method cloneOrderByElement (line 380) | protected OrderByElement cloneOrderByElement(OrderByElement orig, Stri...
method cloneOrderByElement (line 391) | protected OrderByElement cloneOrderByElement(OrderByElement orig, Expr...
method getOrderByElements (line 407) | protected List<OrderByElement> getOrderByElements(PlainSelect plainSel...
FILE: src/main/java/com/github/pagehelper/util/ClassUtil.java
class ClassUtil (line 34) | public class ClassUtil {
method newInstance (line 44) | @SuppressWarnings("unchecked")
method newInstance (line 70) | @SuppressWarnings("unchecked")
method newInstance (line 80) | public static <T> T newInstance(Class<T> cls, Properties properties) {
method getServletRequestClass (line 92) | public static Class<?> getServletRequestClass() throws ClassNotFoundEx...
FILE: src/main/java/com/github/pagehelper/util/ExecutorUtil.java
class ExecutorUtil (line 47) | public abstract class ExecutorUtil {
method getAdditionalParameter (line 74) | public static Map<String, Object> getAdditionalParameter(BoundSql boun...
method getProviderMethodArgumentNames (line 88) | public static String[] getProviderMethodArgumentNames(ProviderSqlSourc...
method getExistedMappedStatement (line 103) | public static MappedStatement getExistedMappedStatement(Configuration ...
method executeManualCount (line 124) | public static Long executeManualCount(Executor executor, MappedStateme...
method executeAutoCount (line 150) | public static Long executeAutoCount(Dialect dialect, Executor executor...
method pageQuery (line 192) | public static <E> List<E> pageQuery(Dialect dialect, Executor executor...
FILE: src/main/java/com/github/pagehelper/util/MSUtils.java
class MSUtils (line 39) | public class MSUtils {
method newCountMappedStatement (line 49) | public static MappedStatement newCountMappedStatement(MappedStatement ...
FILE: src/main/java/com/github/pagehelper/util/MetaObjectUtil.java
class MetaObjectUtil (line 35) | public class MetaObjectUtil {
method forObject (line 61) | public static MetaObject forObject(Object object) {
FILE: src/main/java/com/github/pagehelper/util/MetaObjectWithReflectCache.java
class MetaObjectWithReflectCache (line 41) | public class MetaObjectWithReflectCache {
method forObject (line 46) | public static MetaObject forObject(Object object) {
FILE: src/main/java/com/github/pagehelper/util/PageObjectUtil.java
class PageObjectUtil (line 41) | public abstract class PageObjectUtil {
method getPageFromObject (line 70) | public static <T> Page<T> getPageFromObject(Object params, boolean req...
method getParamValue (line 159) | protected static Object getParamValue(MetaObject paramsObject, String ...
method setParams (line 178) | public static void setParams(String params) {
FILE: src/main/java/com/github/pagehelper/util/SqlSafeUtil.java
class SqlSafeUtil (line 32) | public class SqlSafeUtil {
method check (line 53) | public static boolean check(String value) {
FILE: src/main/java/com/github/pagehelper/util/StackTraceUtil.java
class StackTraceUtil (line 30) | public class StackTraceUtil {
method current (line 35) | public static String current() {
FILE: src/main/java/com/github/pagehelper/util/StringUtil.java
class StringUtil (line 31) | public class StringUtil {
method isEmpty (line 33) | public static boolean isEmpty(String str) {
method isNotEmpty (line 40) | public static boolean isNotEmpty(String str) {
FILE: src/test/java/com/github/pagehelper/mapper/ProviderMethod.java
class ProviderMethod (line 35) | public class ProviderMethod {
method selectSimple (line 37) | public String selectSimple(String str) {
method select (line 41) | @SuppressWarnings("unchecked")
method selectUser (line 53) | public String selectUser(User user) {
FILE: src/test/java/com/github/pagehelper/mapper/UserMapper.java
type UserMapper (line 38) | @SuppressWarnings("rawtypes")
method selectByOrder (line 41) | @Select("select * from user order by ${order}")
method selectSimple (line 45) | @SelectProvider(type = ProviderMethod.class, method = "selectSimple")
method selectByProvider (line 49) | @SelectProvider(type = ProviderMethod.class, method = "select")
method selectByUserProvider (line 52) | @SelectProvider(type = ProviderMethod.class, method = "selectUser")
method selectBySelect (line 55) | @Select("Select * from user")
method selectByOrder2 (line 58) | List<User> selectByOrder2(@Param("order") String order);
method selectAll (line 60) | List<User> selectAll();
method selectCollectionMap (line 63) | List<User> selectCollectionMap();
method selectGreterThanId (line 65) | List<User> selectGreterThanId(int id);
method selectGreterThanIdAndNotEquelName (line 67) | List<User> selectGreterThanIdAndNotEquelName(@Param("id") int id, @Par...
method selectAll (line 69) | List<User> selectAll(RowBounds rowBounds);
method selectAllOrderby (line 71) | List<User> selectAllOrderby();
method selectAllOrderByParams (line 73) | List<User> selectAllOrderByParams(@Param("order1") String order1, @Par...
method selectAllOrderByMap (line 76) | List<User> selectAllOrderByMap(Map orders);
method selectAllOrderByList (line 78) | List<User> selectAllOrderByList(List<Integer> params);
method selectAllOrderByArray (line 80) | List<User> selectAllOrderByArray(Integer[] params);
method selectIf (line 83) | List<User> selectIf(@Param("id") Integer id);
method selectIf3 (line 85) | List<User> selectIf3(User user);
method selectIf2 (line 87) | List<User> selectIf2(@Param("id1") Integer id1, @Param("id2") Integer ...
method selectIf2List (line 89) | List<User> selectIf2List(@Param("id1") List<Integer> id1, @Param("id2"...
method selectIf2ListAndOrder (line 91) | List<User> selectIf2ListAndOrder(@Param("id1") List<Integer> id1, @Par...
method selectChoose (line 94) | List<User> selectChoose(@Param("id1") Integer id1, @Param("id2") Integ...
method selectLike (line 96) | List<User> selectLike(User user);
method selectUnion (line 99) | List<User> selectUnion();
method selectLeftjoin (line 101) | List<User> selectLeftjoin();
method selectWith (line 103) | List<User> selectWith();
method selectColumns (line 106) | List<User> selectColumns(@Param("columns") String... columns);
method selectMULId (line 108) | List<User> selectMULId(int mul);
method selectGroupBy (line 111) | List<User> selectGroupBy();
method selectByWhereMap (line 114) | List<User> selectByWhereMap(Where where);
method selectByExample (line 117) | List<User> selectByExample(UserExample example);
method selectDistinct (line 119) | List<User> selectDistinct();
method selectExists (line 121) | List<User> selectExists();
method selectByPageNumSize (line 123) | List<User> selectByPageNumSize(@Param("pageNum") int pageNum, @Param("...
method selectByPageNumSizeOrderBy (line 125) | List<User> selectByPageNumSizeOrderBy(@Param("pageNum") int pageNum, @...
method selectByOrderBy (line 128) | List<User> selectByOrderBy(@Param("orderBy") String orderBy);
method selectByQueryModel (line 130) | List<User> selectByQueryModel(UserQueryModel queryModel);
method selectByIdList (line 132) | List<User> selectByIdList(@Param("idList") List<Long> idList);
method selectByIdList2 (line 134) | List<User> selectByIdList2(@Param("idList") List<Long> idList);
method execute (line 136) | List<Map<String, Object>> execute(@Param("sql") String sql);
method selectByCode (line 138) | List<UserCode> selectByCode(Code code);
method selectOrderByWithParam (line 143) | List<User> selectOrderByWithParam(@Param("py") String py);
FILE: src/test/java/com/github/pagehelper/model/Code.java
type Code (line 31) | public enum Code {
FILE: src/test/java/com/github/pagehelper/model/User.java
class User (line 35) | public class User
method getId (line 44) | public int getId() {
method setId (line 48) | public void setId(int id) {
method toString (line 52) | @Override
method getName (line 62) | public String getName() {
method setName (line 66) | public void setName(String name) {
method getPy (line 70) | public String getPy() {
method setPy (line 74) | public void setPy(String py) {
method getUsers (line 78) | public List<User> getUsers() {
method setUsers (line 82) | public void setUsers(List<User> users) {
FILE: src/test/java/com/github/pagehelper/model/UserCode.java
class UserCode (line 30) | public class UserCode implements Serializable {
method getId (line 38) | public int getId() {
method setId (line 42) | public void setId(int id) {
method getName (line 46) | public String getName() {
method setName (line 50) | public UserCode setName(String name) {
method getPy (line 55) | public Code getPy() {
method setPy (line 59) | public void setPy(Code py) {
method getUsers (line 63) | public List<UserCode> getUsers() {
method setUsers (line 67) | public void setUsers(List<UserCode> users) {
FILE: src/test/java/com/github/pagehelper/model/UserExample.java
class UserExample (line 30) | public class UserExample {
method UserExample (line 37) | public UserExample() {
method or (line 41) | public void or(Criteria criteria) {
method or (line 45) | public Criteria or() {
method createCriteria (line 51) | public Criteria createCriteria() {
method createCriteriaInternal (line 59) | protected Criteria createCriteriaInternal() {
method clear (line 64) | public void clear() {
class GeneratedCriteria (line 70) | protected abstract static class GeneratedCriteria {
method GeneratedCriteria (line 73) | protected GeneratedCriteria() {
method addCriterion (line 78) | protected void addCriterion(String condition) {
method addCriterion (line 85) | protected void addCriterion(String condition, Object value, String p...
method addCriterion (line 92) | protected void addCriterion(String condition, Object value1, Object ...
method andIdIsNull (line 99) | public Criteria andIdIsNull() {
method andIdIsNotNull (line 104) | public Criteria andIdIsNotNull() {
method andIdEqualTo (line 109) | public Criteria andIdEqualTo(Integer value) {
method andIdNotEqualTo (line 114) | public Criteria andIdNotEqualTo(Integer value) {
method andIdGreaterThan (line 119) | public Criteria andIdGreaterThan(Integer value) {
method andIdGreaterThanOrEqualTo (line 124) | public Criteria andIdGreaterThanOrEqualTo(Integer value) {
method andIdLessThan (line 129) | public Criteria andIdLessThan(Integer value) {
method andIdLessThanOrEqualTo (line 134) | public Criteria andIdLessThanOrEqualTo(Integer value) {
method andIdIn (line 139) | public Criteria andIdIn(List<Integer> values) {
method andIdNotIn (line 144) | public Criteria andIdNotIn(List<Integer> values) {
method andIdBetween (line 149) | public Criteria andIdBetween(Integer value1, Integer value2) {
method andIdNotBetween (line 154) | public Criteria andIdNotBetween(Integer value1, Integer value2) {
method andUsernameIsNull (line 159) | public Criteria andUsernameIsNull() {
method andUsernameIsNotNull (line 164) | public Criteria andUsernameIsNotNull() {
method andUsernameEqualTo (line 169) | public Criteria andUsernameEqualTo(String value) {
method andUsernameNotEqualTo (line 174) | public Criteria andUsernameNotEqualTo(String value) {
method andUsernameGreaterThan (line 179) | public Criteria andUsernameGreaterThan(String value) {
method andUsernameGreaterThanOrEqualTo (line 184) | public Criteria andUsernameGreaterThanOrEqualTo(String value) {
method andUsernameLessThan (line 189) | public Criteria andUsernameLessThan(String value) {
method andUsernameLessThanOrEqualTo (line 194) | public Criteria andUsernameLessThanOrEqualTo(String value) {
method andUsernameLike (line 199) | public Criteria andUsernameLike(String value) {
method andUsernameNotLike (line 204) | public Criteria andUsernameNotLike(String value) {
method andUsernameIn (line 209) | public Criteria andUsernameIn(List<String> values) {
method andUsernameNotIn (line 214) | public Criteria andUsernameNotIn(List<String> values) {
method andUsernameBetween (line 219) | public Criteria andUsernameBetween(String value1, String value2) {
method andUsernameNotBetween (line 224) | public Criteria andUsernameNotBetween(String value1, String value2) {
method andUsercodeIsNull (line 229) | public Criteria andUsercodeIsNull() {
method andUsercodeIsNotNull (line 234) | public Criteria andUsercodeIsNotNull() {
method andUsercodeEqualTo (line 239) | public Criteria andUsercodeEqualTo(String value) {
method andUsercodeNotEqualTo (line 244) | public Criteria andUsercodeNotEqualTo(String value) {
method andUsercodeGreaterThan (line 249) | public Criteria andUsercodeGreaterThan(String value) {
method andUsercodeGreaterThanOrEqualTo (line 254) | public Criteria andUsercodeGreaterThanOrEqualTo(String value) {
method andUsercodeLessThan (line 259) | public Criteria andUsercodeLessThan(String value) {
method andUsercodeLessThanOrEqualTo (line 264) | public Criteria andUsercodeLessThanOrEqualTo(String value) {
method andUsercodeLike (line 269) | public Criteria andUsercodeLike(String value) {
method andUsercodeNotLike (line 274) | public Criteria andUsercodeNotLike(String value) {
method andUsercodeIn (line 279) | public Criteria andUsercodeIn(List<String> values) {
method andUsercodeNotIn (line 284) | public Criteria andUsercodeNotIn(List<String> values) {
method andUsercodeBetween (line 289) | public Criteria andUsercodeBetween(String value1, String value2) {
method andUsercodeNotBetween (line 294) | public Criteria andUsercodeNotBetween(String value1, String value2) {
method getAllCriteria (line 299) | public List<Criterion> getAllCriteria() {
method getCriteria (line 303) | public List<Criterion> getCriteria() {
method isValid (line 307) | public boolean isValid() {
class Criteria (line 312) | public static class Criteria extends GeneratedCriteria {
method Criteria (line 314) | protected Criteria() {
class Criterion (line 319) | public static class Criterion {
method Criterion (line 336) | protected Criterion(String condition) {
method Criterion (line 343) | protected Criterion(String condition, Object value, String typeHandl...
method Criterion (line 355) | protected Criterion(String condition, Object value) {
method Criterion (line 359) | protected Criterion(String condition, Object value, Object secondVal...
method Criterion (line 368) | protected Criterion(String condition, Object value, Object secondVal...
method getCondition (line 372) | public String getCondition() {
method getSecondValue (line 376) | public Object getSecondValue() {
method getTypeHandler (line 380) | public String getTypeHandler() {
method getValue (line 384) | public Object getValue() {
method isBetweenValue (line 388) | public boolean isBetweenValue() {
method isListValue (line 392) | public boolean isListValue() {
method isNoValue (line 396) | public boolean isNoValue() {
method isSingleValue (line 400) | public boolean isSingleValue() {
method getOrderByClause (line 405) | public String getOrderByClause() {
method setOrderByClause (line 409) | public void setOrderByClause(String orderByClause) {
method getOredCriteria (line 413) | public List<Criteria> getOredCriteria() {
method isDistinct (line 417) | public boolean isDistinct() {
method setDistinct (line 421) | public void setDistinct(boolean distinct) {
FILE: src/test/java/com/github/pagehelper/model/UserQueryModel.java
class UserQueryModel (line 31) | public class UserQueryModel {
method getOrderBy (line 39) | public String getOrderBy() {
method setOrderBy (line 43) | public void setOrderBy(String orderBy) {
method getPageNum (line 47) | public Integer getPageNum() {
method setPageNum (line 51) | public void setPageNum(Integer pageNum) {
method getPageSize (line 55) | public Integer getPageSize() {
method setPageSize (line 59) | public void setPageSize(Integer pageSize) {
FILE: src/test/java/com/github/pagehelper/rowbounds/RowBoundsHelper.java
class RowBoundsHelper (line 37) | public class RowBoundsHelper {
method getSqlSession (line 72) | public static SqlSession getSqlSession() {
FILE: src/test/java/com/github/pagehelper/rowbounds/test/PageRowBoundsTest.java
class PageRowBoundsTest (line 40) | public class PageRowBoundsTest {
method testMapperWithPageRowBounds (line 49) | @Test
method testNamespaceWithPageRowBounds (line 95) | @Test
method testNamespaceWithRowBounds2 (line 132) | @Test
method testWithRowboundsAndCountTrue (line 163) | @Test
class IdBean (line 182) | class IdBean {
method getId (line 185) | public Integer getId() {
method setId (line 189) | public void setId(Integer id) {
FILE: src/test/java/com/github/pagehelper/rowbounds/test/RowBoundsTest.java
class RowBoundsTest (line 40) | public class RowBoundsTest {
method testMapperWithRowBounds (line 49) | @Test
method testNamespaceWithRowBounds (line 89) | @Test
method testNamespaceWithRowBounds2 (line 120) | @Test
method testWithRowboundsAndCountTrue (line 147) | @Test
class IdBean (line 165) | class IdBean {
method getId (line 168) | public Integer getId() {
method setId (line 172) | public void setId(Integer id) {
FILE: src/test/java/com/github/pagehelper/sql/DefaultOrderBySqlParserTest.java
class DefaultOrderBySqlParserTest (line 32) | public class DefaultOrderBySqlParserTest {
method testOrderBy (line 35) | @Test
FILE: src/test/java/com/github/pagehelper/sql/SqlServerTest.java
class SqlServerTest (line 39) | public class SqlServerTest {
method testSqlTestWithlock (line 43) | @Test
method testSqlTest (line 50) | @Test
method testSqlAlias (line 57) | @Test
method testSqlOrderByAlias (line 64) | @Test
method testSqlDistinct (line 71) | @Test
method testSqlTableAll (line 78) | @Test
method testSqlAs (line 85) | @Test
method testSelectParameter (line 92) | @Test
method testSqlWith (line 100) | @Test
method testSqlLeftJoin (line 114) | @Test
method testSqlUnion (line 149) | @Test
method testSqlUnion2 (line 158) | @Test
method testSqlOrderByFunctionAlias (line 170) | @Test
method testSqlOrderByUnknown (line 177) | @Test
method testSqlOrderByTable (line 184) | @Test
method testSqlStar (line 191) | @Test
method testSql377 (line 204) | @Test
method testSql386 (line 211) | @Test
method testSql354 (line 237) | @Test
method testSql374 (line 244) | @Test
method testSql345 (line 251) | @Test
method testSql306 (line 264) | @Test
method testSql66 (line 276) | @Test
method testSql398 (line 298) | @Test
method testSqlServerSquareBrackets (line 328) | @Test
method testSqlServer768 (line 337) | @Test
FILE: src/test/java/com/github/pagehelper/sql/SqlTest.java
class SqlTest (line 39) | public class SqlTest {
method testSqlParser (line 42) | @Test
method testSqlParser11 (line 89) | @Test
method testSqlParser2 (line 110) | @Test
method testSqlParser3 (line 117) | @Test
method testSqlParser4 (line 136) | @Test
method testWithNolock (line 143) | @Test
method testSql375 (line 156) | @Test
method testSql350 (line 161) | @Test
method testSql555 (line 168) | @Test
method testSql606 (line 174) | @Test
method testSql201 (line 184) | @Test
method testSql545 (line 193) | @Test
method testKeepOrderBy (line 199) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/ArgumentsMapTest.java
class ArgumentsMapTest (line 38) | public class ArgumentsMapTest {
method testArgumentsMap (line 43) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/ArgumentsObjTest.java
class ArgumentsObjTest (line 39) | public class ArgumentsObjTest {
method testArgumentsObj (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/AsyncCountTest.java
class AsyncCountTest (line 41) | @Ignore
method getJdbcUrl (line 55) | @Override
method getSqlSession (line 67) | public static SqlSession getSqlSession() {
method testAsyncCount (line 78) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/CloseableTest.java
class CloseableTest (line 38) | public class CloseableTest {
method testCloseable (line 40) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/CollectionMapTest.java
class CollectionMapTest (line 39) | public class CollectionMapTest {
method test (line 41) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/CountColumnTest.java
class CountColumnTest (line 39) | public class CountColumnTest {
method testMapperWithStartPage (line 41) | @Test
method testCountColumnInject (line 66) | @Test(expected = Exception.class)
FILE: src/test/java/com/github/pagehelper/test/basic/EnumTest.java
class EnumTest (line 38) | public class EnumTest {
method testCloseable (line 40) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/IPageTest.java
class IPageTest (line 40) | public class IPageTest {
method testIPage (line 42) | @Test
class UserIPage (line 73) | public static class UserIPage extends UserQueryModel implements IPage {
FILE: src/test/java/com/github/pagehelper/test/basic/OffsetTest.java
class OffsetTest (line 40) | public class OffsetTest {
method testOffset (line 41) | @Test
method testPageNum (line 79) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/PageHelperTest.java
class PageHelperTest (line 41) | public class PageHelperTest {
method shouldGetAllCountries (line 43) | @Test
method testMapperWithRowBounds (line 61) | @Test
method testNamespaceWithStartPage (line 113) | @Test
method testNamespaceWithRowBounds (line 159) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/PageInfoTest.java
class PageInfoTest (line 40) | public class PageInfoTest {
method testPageSize10 (line 45) | @Test
method testPageSize50 (line 110) | @Test
method testNavigatePages (line 186) | @Test
method testPageInfoOfTotal (line 229) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/RemoveOrderTest.java
class RemoveOrderTest (line 41) | public class RemoveOrderTest {
method simpleOrderTest (line 43) | @Test
method paramsOrderTest (line 59) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/TestDistinct.java
class TestDistinct (line 39) | public class TestDistinct {
method test (line 41) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/TestExecute.java
class TestExecute (line 38) | public class TestExecute {
method test (line 40) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/TestISelect.java
class TestISelect (line 43) | public class TestISelect {
method testGroupBy2 (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/TestIntMax.java
class TestIntMax (line 39) | public class TestIntMax {
method testCountCache (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/TestLike.java
class TestLike (line 39) | public class TestLike {
method testMapperWithStartPage (line 44) | @Test
method testMapperWithStartPage_OrderBy (line 72) | @Test
method testMapperWithStartPage_OrderBy_issues_641 (line 93) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/TestNamespaceMap.java
class TestNamespaceMap (line 40) | public class TestNamespaceMap {
method testMapperWithStartPage (line 45) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/annotations/TestAnnotations.java
class TestAnnotations (line 39) | public class TestAnnotations {
method testMapperWithStartPage (line 44) | @Test
method testMapperWithStartPage_OrderBy (line 70) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/cache/CacheTest.java
class CacheTest (line 41) | public class CacheTest {
method testMapperWithStartPage (line 46) | @Test
method testThreads (line 79) | @Test
class CacheThread (line 105) | private class CacheThread implements Runnable {
method CacheThread (line 106) | private CacheThread() {
method run (line 109) | public void run() {
FILE: src/test/java/com/github/pagehelper/test/basic/cache/SecondCacheTest.java
class SecondCacheTest (line 38) | public class SecondCacheTest {
method test1 (line 40) | @Test
method test2 (line 70) | @Test
method test3 (line 84) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/count/TestGroupBy.java
class TestGroupBy (line 38) | public class TestGroupBy {
method testGroupBy (line 40) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/count/TestOrderBy.java
class TestOrderBy (line 23) | public class TestOrderBy {
method testOrderByWithParameters (line 31) | @Test
method testOrderByWithoutParameters (line 52) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/count/TestSelectItems.java
class TestSelectItems (line 40) | public class TestSelectItems {
method testSelectColumns (line 45) | @Test
method testSelectColumn2 (line 77) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/CacheTest.java
class CacheTest (line 43) | public class CacheTest {
method testThreads (line 48) | @Test
class CacheThread (line 74) | private class CacheThread implements Runnable {
method CacheThread (line 75) | private CacheThread() {
method run (line 78) | public void run() {
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicChoose.java
class TestDynamicChoose (line 39) | public class TestDynamicChoose {
method testMapperWithStartPage (line 44) | @Test
method testMapperWithStartPage_OrderBy (line 70) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicForeach.java
class TestDynamicForeach (line 40) | public class TestDynamicForeach {
method testMapperWithStartPage (line 45) | @Test
method testMapperWithStartPage2 (line 67) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicIf.java
class TestDynamicIf (line 41) | public class TestDynamicIf {
method testCountCache (line 46) | @Test
method testCountCache2 (line 72) | @Test
method testMapper (line 98) | @SuppressWarnings({"rawtypes", "unchecked"})
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicIf2.java
class TestDynamicIf2 (line 39) | public class TestDynamicIf2 {
method testMapperWithStartPage (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicIfOrder.java
class TestDynamicIfOrder (line 44) | public class TestDynamicIfOrder {
method testMapperWithStartPage (line 49) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicIfTwoList.java
class TestDynamicIfTwoList (line 41) | public class TestDynamicIfTwoList {
method testMapperWithStartPage (line 46) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicWhere.java
class TestDynamicWhere (line 41) | public class TestDynamicWhere {
method testMapperWithStartPage (line 43) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/dynamic/Where.java
class Where (line 32) | public class Where {
method Where (line 35) | public Where(Map<String, Object> map) {
method getMap (line 39) | public Map<String, Object> getMap() {
method setMap (line 43) | public void setMap(Map<String, Object> map) {
FILE: src/test/java/com/github/pagehelper/test/basic/example/TestExample.java
class TestExample (line 41) | public class TestExample {
method testNull (line 43) | @Test
method testGreaterThan (line 58) | @Test
method testInList (line 75) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterArray.java
class TestParameterArray (line 39) | public class TestParameterArray {
method testMapperWithStartPage (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterList.java
class TestParameterList (line 40) | public class TestParameterList {
method testMapperWithStartPage (line 45) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterMap.java
class TestParameterMap (line 41) | public class TestParameterMap {
method testMapperWithStartPage (line 46) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterNone.java
class TestParameterNone (line 39) | public class TestParameterNone {
method testMapperWithStartPage (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterOne.java
class TestParameterOne (line 39) | public class TestParameterOne {
method testMapperWithStartPage (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/provider/SqlCache.java
class SqlCache (line 27) | public class SqlCache {
method set (line 31) | public static void set(String str) {
method get (line 35) | public static String get() {
method remove (line 39) | public static void remove() {
FILE: src/test/java/com/github/pagehelper/test/basic/provider/SqlCacheInterceptor.java
class SqlCacheInterceptor (line 37) | @Intercepts({
method intercept (line 43) | @Override
method plugin (line 55) | @Override
method setProperties (line 60) | @Override
FILE: src/test/java/com/github/pagehelper/test/basic/provider/TestBoundSqlInterceptor.java
class TestBoundSqlInterceptor (line 33) | public class TestBoundSqlInterceptor implements BoundSqlInterceptor {
method boundSql (line 36) | @Override
FILE: src/test/java/com/github/pagehelper/test/basic/provider/TestProvider.java
class TestProvider (line 41) | public class TestProvider {
method testSelectSimple (line 43) | @Test
method testProvider (line 58) | @Test
method testUserProvider (line 80) | @Test
method testUserSelect (line 102) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/provider/TestProviderInteceptor.java
class TestProviderInteceptor (line 42) | public class TestProviderInteceptor {
method testInterceptor (line 44) | @Test
method testConcurrentExecution (line 74) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/sql/TestExists.java
class TestExists (line 39) | public class TestExists {
method testExists (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/sql/TestLeftjoin.java
class TestLeftjoin (line 39) | public class TestLeftjoin {
method testLeftjoin (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/sql/TestUnion.java
class TestUnion (line 39) | public class TestUnion {
method testUnion (line 44) | @Test
FILE: src/test/java/com/github/pagehelper/test/basic/sql/TestWith.java
class TestWith (line 40) | public class TestWith {
method testUnion (line 45) | @Test
FILE: src/test/java/com/github/pagehelper/test/features/autodialect/AutoDialectTest.java
class AutoDialectTest (line 40) | public class AutoDialectTest {
method test (line 42) | @Test
FILE: src/test/java/com/github/pagehelper/test/features/autodialect/DataSourceNegotiationAutoDialectTest.java
class DataSourceNegotiationAutoDialectTest (line 41) | public class DataSourceNegotiationAutoDialectTest {
method getHikari (line 49) | private HikariDataSource getHikari() {
method getDriud (line 57) | private DruidDataSource getDriud() {
method getTomcatJdbc (line 65) | private org.apache.tomcat.jdbc.pool.DataSource getTomcatJdbc() {
method getC3P0 (line 73) | private ComboPooledDataSource getC3P0() {
method getDbcp (line 81) | private BasicDataSource getDbcp() {
method getDefault (line 89) | private UnpooledDataSource getDefault() {
method testNegotiation (line 97) | @Test
method testDruid (line 133) | @Test
FILE: src/test/java/com/github/pagehelper/test/features/autodialect/SimpleAutoDialect.java
class SimpleAutoDialect (line 39) | public class SimpleAutoDialect implements AutoDialect<UnpooledDataSource> {
method extractDialectKey (line 41) | @Override
method extractDialect (line 50) | @Override
FILE: src/test/java/com/github/pagehelper/test/features/dialectclass/UsingDialectClassTest.java
class UsingDialectClassTest (line 47) | public class UsingDialectClassTest {
method test (line 56) | @Test
class Test1Dialect (line 133) | public static class Test1Dialect extends AbstractHelperDialect {
method processPageParameter (line 134) | @Override
method getPageSql (line 139) | @Override
class Test2Dialect (line 145) | public static class Test2Dialect extends AbstractHelperDialect {
method processPageParameter (line 146) | @Override
method getPageSql (line 151) | @Override
FILE: src/test/java/com/github/pagehelper/test/namespace/BasicTest.java
class BasicTest (line 41) | public class BasicTest {
method testNamespace1 (line 43) | @Test
method testNamespace3 (line 62) | @Test
method testNamespace2 (line 91) | @Test
FILE: src/test/java/com/github/pagehelper/test/pagesize/PageSizeLessThenOrEqualZeroTest.java
class PageSizeLessThenOrEqualZeroTest (line 40) | public class PageSizeLessThenOrEqualZeroTest {
method testWithStartPage (line 45) | @Test
method testWithRowbounds (line 71) | @Test
FILE: src/test/java/com/github/pagehelper/test/pagesize/PageSizeZeroTest.java
class PageSizeZeroTest (line 43) | public class PageSizeZeroTest {
method testWithStartPage (line 48) | @Test
method testWithRowbounds (line 74) | @Test
FILE: src/test/java/com/github/pagehelper/test/reasonable/PageTest.java
class PageTest (line 39) | public class PageTest {
method testMapperWithStartPage (line 43) | @Test
method testMapperWithStartPageAndReasonableFalse (line 72) | @Test
method testMapperWithStartPageAndReasonableTrue (line 107) | @Test
method testMapperWithStartPageAndPageSizeZeroFalse (line 142) | @Test
method testMapperWithStartPageAndPageSizeZeroTrue (line 169) | @Test
FILE: src/test/java/com/github/pagehelper/test/rowbounds/RowBoundsTest.java
class RowBoundsTest (line 43) | public class RowBoundsTest {
method testMapperWithRowBounds (line 52) | @Test
method testNamespaceWithRowBounds (line 96) | @Test
method testNamespaceWithRowBounds2 (line 130) | @Test
method testNamespaceWithRowBounds3 (line 156) | @Test
method testWithRowboundsAndCountTrue (line 197) | @Test
class IdBean (line 219) | class IdBean {
method getId (line 222) | public Integer getId() {
method setId (line 226) | public void setId(Integer id) {
FILE: src/test/java/com/github/pagehelper/util/MybatisAutoDialectHelper.java
class MybatisAutoDialectHelper (line 42) | public class MybatisAutoDialectHelper {
method getSqlSession (line 81) | public static SqlSession getSqlSession() {
FILE: src/test/java/com/github/pagehelper/util/MybatisHelper.java
class MybatisHelper (line 45) | public class MybatisHelper {
method getJdbcUrl (line 79) | @Override
method getSqlSession (line 91) | public static SqlSession getSqlSession() {
FILE: src/test/java/com/github/pagehelper/util/MybatisInterceptorHelper.java
class MybatisInterceptorHelper (line 42) | public class MybatisInterceptorHelper {
method getSqlSession (line 81) | public static SqlSession getSqlSession() {
FILE: src/test/java/com/github/pagehelper/util/MybatisPageSizeZeroHelper.java
class MybatisPageSizeZeroHelper (line 42) | public class MybatisPageSizeZeroHelper {
method getSqlSession (line 81) | public static SqlSession getSqlSession() {
FILE: src/test/java/com/github/pagehelper/util/MybatisReasonableHelper.java
class MybatisReasonableHelper (line 42) | public class MybatisReasonableHelper {
method getSqlSession (line 81) | public static SqlSession getSqlSession() {
FILE: src/test/java/com/github/pagehelper/util/MybatisRowBoundsHelper.java
class MybatisRowBoundsHelper (line 42) | public class MybatisRowBoundsHelper {
method getSqlSession (line 81) | public static SqlSession getSqlSession() {
FILE: src/test/java/com/github/pagehelper/util/Ognl.java
class Ognl (line 28) | public class Ognl {
method isNotNull (line 29) | public static boolean isNotNull(Object obj) {
FILE: src/test/java/com/github/pagehelper/util/SqlSafeUtilTest.java
class SqlSafeUtilTest (line 31) | public class SqlSafeUtilTest {
method check (line 33) | @Test
method assertSql (line 56) | private void assertSql(boolean injection, String sql) {
FILE: src/test/java/com/github/pagehelper/util/TestUtil.java
class TestUtil (line 34) | public class TestUtil {
method getXmlPath (line 37) | public synchronized static String getXmlPath() throws IOException {
FILE: src/test/resources/cirrodata/cirrodata.sql
type `user` (line 33) | CREATE TABLE `user`
FILE: src/test/resources/derby/derby.sql
type user (line 27) | create table user
FILE: src/test/resources/h2/h2.sql
type user (line 27) | create table user
FILE: src/test/resources/hsqldb/hsqldb.sql
type user (line 27) | create table user
FILE: src/test/resources/mariadb/mariadb.sql
type `user` (line 35) | CREATE TABLE `user`
FILE: src/test/resources/mysql/mysql.sql
type `user` (line 32) | CREATE TABLE `user`
FILE: src/test/resources/oracle/oracle.sql
type user (line 35) | create table user
FILE: src/test/resources/postgresql/postgresql.sql
type user (line 32) | CREATE TABLE user
FILE: src/test/resources/rowbounds/hsqldb.sql
type user (line 27) | create table user
FILE: src/test/resources/xugu/mysql.sql
type `user` (line 6) | CREATE TABLE `user` (
Condensed preview — 249 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,162K chars).
[
{
"path": ".editorconfig",
"chars": 187,
"preview": "root = true\n\n[*]\ncharset = utf-8\nindent_style = space\ntrim_trailing_whitespace = true\ninsert_final_newline = true\nend_of"
},
{
"path": ".github/FUNDING.yml",
"chars": 712,
"preview": "# These are supported funding model platforms\n\ngithub: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [u"
},
{
"path": ".github/issue_template.md",
"chars": 590,
"preview": "---\nname: PageHelper issue report template\nabout: If you would like to report a issue to PageHelper, please use this tem"
},
{
"path": ".github/workflows/pull-request.yml",
"chars": 480,
"preview": "name: Maven verify\non:\n pull_request:\n types: [ opened, reopened, edited ]\njobs:\n mvn_verify:\n runs-on: ubuntu-l"
},
{
"path": ".github/workflows/release.yml",
"chars": 942,
"preview": "name: Publish package to the Maven Central Repository\non:\n push:\n tags: [ \"*\" ]\njobs:\n publish:\n runs-on: ubuntu"
},
{
"path": ".gitignore",
"chars": 122,
"preview": "# Maven #\ntarget/\ndependency-reduced-pom.xml\n\n# IDEA #\n.idea/\n*.iml\n\n# Eclipse #\n.settings/\n.classpath\n.project\n\n.vscode"
},
{
"path": "LICENSE",
"chars": 1089,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2014-2022 abel533@gmail.com\n\nPermission is hereby granted, free of charge, to any p"
},
{
"path": "README.md",
"chars": 6791,
"preview": "\n# MyBatis 分页插件 - PageHelper\n\n[\n\n# MyBatis Pagination - PageHelper\n\n[\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com\n ~\n ~ Permission is hereby granted, f"
},
{
"path": "src/main/java/com/github/pagehelper/AutoDialect.java",
"chars": 2019,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/BoundSqlInterceptor.java",
"chars": 2135,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/BoundSqlInterceptorChain.java",
"chars": 2748,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/Constant.java",
"chars": 1508,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/CountMsIdGen.java",
"chars": 1943,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/Dialect.java",
"chars": 4668,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/IPage.java",
"chars": 1322,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/ISelect.java",
"chars": 1374,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/Page.java",
"chars": 16424,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/PageException.java",
"chars": 1559,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/PageHelper.java",
"chars": 8352,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/PageInfo.java",
"chars": 12554,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/PageInterceptor.java",
"chars": 12601,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/PageParam.java",
"chars": 2199,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/PageProperties.java",
"chars": 1458,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/PageRowBounds.java",
"chars": 1720,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/PageSerializable.java",
"chars": 2348,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/QueryInterceptor.java",
"chars": 3275,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/cache/Cache.java",
"chars": 1331,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/cache/CacheFactory.java",
"chars": 2802,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/cache/GuavaCache.java",
"chars": 2874,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/cache/SimpleCache.java",
"chars": 3434,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/AbstractDialect.java",
"chars": 2584,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/AbstractHelperDialect.java",
"chars": 9955,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/AbstractRowBoundsDialect.java",
"chars": 3296,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/ReplaceSql.java",
"chars": 1518,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/auto/C3P0AutoDialect.java",
"chars": 1523,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/auto/DataSourceAutoDialect.java",
"chars": 2549,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/auto/DataSourceNegotiationAutoDialect.java",
"chars": 3857,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/auto/DbcpAutoDialect.java",
"chars": 1502,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/auto/DefaultAutoDialect.java",
"chars": 3082,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/auto/DruidAutoDialect.java",
"chars": 1494,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/auto/HikariAutoDialect.java",
"chars": 1500,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/auto/TomcatAutoDialect.java",
"chars": 1481,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/AS400Dialect.java",
"chars": 2137,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/CirroDataDialect.java",
"chars": 2331,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/Db2Dialect.java",
"chars": 2491,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/FirebirdDialect.java",
"chars": 2650,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/GaussDBDialect.java",
"chars": 3533,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/HerdDBDialect.java",
"chars": 3461,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/HsqldbDialect.java",
"chars": 3325,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/InformixDialect.java",
"chars": 3489,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/MySqlDialect.java",
"chars": 3399,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/Oracle9iDialect.java",
"chars": 2728,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/OracleDialect.java",
"chars": 2539,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/OscarDialect.java",
"chars": 3397,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/PostgreSqlDialect.java",
"chars": 3541,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/SqlServer2012Dialect.java",
"chars": 2335,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/SqlServerDialect.java",
"chars": 6027,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/helper/XuguDialect.java",
"chars": 3398,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2017 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/replace/RegexWithNolockReplaceSql.java",
"chars": 1798,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/replace/SimpleWithNolockReplaceSql.java",
"chars": 1720,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/Db2RowBoundsDialect.java",
"chars": 2219,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/GaussDBRowBoundsDialect.java",
"chars": 2335,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/HerdDBRowBoundsDialect.java",
"chars": 2190,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/HsqldbRowBoundsDialect.java",
"chars": 2127,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/InformixRowBoundsDialect.java",
"chars": 2249,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/MySqlRowBoundsDialect.java",
"chars": 2178,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/OracleRowBoundsDialect.java",
"chars": 2477,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/PostgreSqlRowBoundsDialect.java",
"chars": 2301,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/SqlServer2012RowBoundsDialect.java",
"chars": 2036,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/SqlServerRowBoundsDialect.java",
"chars": 3779,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/XuguRowBoundsDialect.java",
"chars": 2177,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2017 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/dialect/rowbounds/package-info.java",
"chars": 1249,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/page/PageAutoDialect.java",
"chars": 14443,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/page/PageBoundSqlInterceptors.java",
"chars": 2347,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/page/PageMethod.java",
"chars": 5898,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/page/PageParams.java",
"chars": 6710,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/parser/CountSqlParser.java",
"chars": 5027,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/parser/OrderBySqlParser.java",
"chars": 1292,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/parser/SqlParser.java",
"chars": 1990,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/parser/SqlParserUtil.java",
"chars": 878,
"preview": "package com.github.pagehelper.parser;\n\nimport net.sf.jsqlparser.JSQLParserException;\nimport net.sf.jsqlparser.parser.Par"
},
{
"path": "src/main/java/com/github/pagehelper/parser/SqlServerSqlParser.java",
"chars": 1339,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/parser/defaults/DefaultCountSqlParser.java",
"chars": 11693,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/parser/defaults/DefaultOrderBySqlParser.java",
"chars": 3439,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/parser/defaults/DefaultSqlServerSqlParser.java",
"chars": 19028,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/ClassUtil.java",
"chars": 3601,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/ExecutorUtil.java",
"chars": 8928,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/MSUtils.java",
"chars": 3193,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/MetaObjectUtil.java",
"chars": 2675,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/MetaObjectWithReflectCache.java",
"chars": 2349,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/PageObjectUtil.java",
"chars": 6905,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/SqlSafeUtil.java",
"chars": 2530,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/StackTraceUtil.java",
"chars": 1605,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/main/java/com/github/pagehelper/util/StringUtil.java",
"chars": 1510,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/mapper/ProviderMethod.java",
"chars": 2484,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/mapper/UserMapper.java",
"chars": 4988,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/model/Code.java",
"chars": 1273,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/model/User.java",
"chars": 2269,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/model/UserCode.java",
"chars": 1994,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/model/UserExample.java",
"chars": 12630,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/model/UserQueryModel.java",
"chars": 1822,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/rowbounds/RowBoundsHelper.java",
"chars": 2693,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/rowbounds/test/PageRowBoundsTest.java",
"chars": 7217,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/rowbounds/test/RowBoundsTest.java",
"chars": 6162,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/sql/DefaultOrderBySqlParserTest.java",
"chars": 1769,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/sql/SqlServerTest.java",
"chars": 26293,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/sql/SqlTest.java",
"chars": 12501,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/ArgumentsMapTest.java",
"chars": 2403,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/ArgumentsObjTest.java",
"chars": 2792,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/AsyncCountTest.java",
"chars": 3712,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/CloseableTest.java",
"chars": 2163,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/CollectionMapTest.java",
"chars": 2231,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/CountColumnTest.java",
"chars": 2850,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/EnumTest.java",
"chars": 1936,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/IPageTest.java",
"chars": 2909,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/OffsetTest.java",
"chars": 3924,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/PageHelperTest.java",
"chars": 7474,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/PageInfoTest.java",
"chars": 12337,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/RemoveOrderTest.java",
"chars": 2599,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/TestDistinct.java",
"chars": 2075,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/TestExecute.java",
"chars": 2253,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/TestISelect.java",
"chars": 3474,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/TestIntMax.java",
"chars": 2520,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/TestLike.java",
"chars": 4079,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/TestNamespaceMap.java",
"chars": 2596,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/annotations/TestAnnotations.java",
"chars": 3498,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/cache/CacheTest.java",
"chars": 4583,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/cache/SecondCacheTest.java",
"chars": 3433,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/count/TestGroupBy.java",
"chars": 2568,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/count/TestOrderBy.java",
"chars": 2214,
"preview": "package com.github.pagehelper.test.basic.count;\n\nimport com.github.pagehelper.Page;\nimport com.github.pagehelper.PageHel"
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/count/TestSelectItems.java",
"chars": 3759,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/CacheTest.java",
"chars": 3548,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicChoose.java",
"chars": 3489,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicForeach.java",
"chars": 3193,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicIf.java",
"chars": 4224,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicIf2.java",
"chars": 2517,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicIfOrder.java",
"chars": 3015,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicIfTwoList.java",
"chars": 2949,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/TestDynamicWhere.java",
"chars": 2483,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/dynamic/Where.java",
"chars": 1557,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/example/TestExample.java",
"chars": 3462,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterArray.java",
"chars": 2267,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterList.java",
"chars": 2395,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterMap.java",
"chars": 2769,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterNone.java",
"chars": 2235,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/parameter/TestParameterOne.java",
"chars": 2244,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/provider/SqlCache.java",
"chars": 1549,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/provider/SqlCacheInterceptor.java",
"chars": 2478,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/provider/TestBoundSqlInterceptor.java",
"chars": 1984,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/provider/TestProvider.java",
"chars": 4175,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/provider/TestProviderInteceptor.java",
"chars": 3846,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/sql/TestExists.java",
"chars": 2455,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/sql/TestLeftjoin.java",
"chars": 2466,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/sql/TestUnion.java",
"chars": 2448,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/basic/sql/TestWith.java",
"chars": 2643,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/features/autodialect/AutoDialectTest.java",
"chars": 4170,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/features/autodialect/DataSourceNegotiationAutoDialectTest.java",
"chars": 6283,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/features/autodialect/SimpleAutoDialect.java",
"chars": 2363,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/features/dialectclass/UsingDialectClassTest.java",
"chars": 5851,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/namespace/BasicTest.java",
"chars": 3950,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/pagesize/PageSizeLessThenOrEqualZeroTest.java",
"chars": 3453,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/pagesize/PageSizeZeroTest.java",
"chars": 3463,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/reasonable/PageTest.java",
"chars": 7665,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/test/rowbounds/RowBoundsTest.java",
"chars": 8524,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/MybatisAutoDialectHelper.java",
"chars": 3133,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/MybatisHelper.java",
"chars": 3643,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/MybatisInterceptorHelper.java",
"chars": 3133,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/MybatisPageSizeZeroHelper.java",
"chars": 3135,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/MybatisReasonableHelper.java",
"chars": 3131,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/MybatisRowBoundsHelper.java",
"chars": 3129,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/Ognl.java",
"chars": 1322,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/SqlSafeUtilTest.java",
"chars": 1990,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/java/com/github/pagehelper/util/TestUtil.java",
"chars": 1902,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2023 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/resources/cirrodata/cirrodata.sql",
"chars": 11884,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2022 abel533@gmail.com\n *\n * Permission is hereby granted, free of"
},
{
"path": "src/test/resources/cirrodata/mybatis-config-pagesizezero.xml",
"chars": 2743,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/cirrodata/mybatis-config-reasonable.xml",
"chars": 2618,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/cirrodata/mybatis-config-rowbounds.xml",
"chars": 2686,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/cirrodata/mybatis-config.xml",
"chars": 2737,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/com/github/pagehelper/mapper/UserMapper.xml",
"chars": 21872,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com\n"
},
{
"path": "src/test/resources/db2/mybatis-config-pagesizezero.xml",
"chars": 2674,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/db2/mybatis-config-reasonable.xml",
"chars": 2549,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/db2/mybatis-config-rowbounds.xml",
"chars": 2617,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/db2/mybatis-config.xml",
"chars": 2668,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/derby/derby.sql",
"chars": 11750,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2022 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/resources/derby/mybatis-config-pagesizezero.xml",
"chars": 2563,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/derby/mybatis-config-reasonable.xml",
"chars": 2438,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/derby/mybatis-config-rowbounds.xml",
"chars": 2506,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/derby/mybatis-config.xml",
"chars": 2557,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/h2/h2.sql",
"chars": 11760,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2022 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/resources/h2/mybatis-config-pagesizezero.xml",
"chars": 2586,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/h2/mybatis-config-reasonable.xml",
"chars": 2459,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/h2/mybatis-config-rowbounds.xml",
"chars": 2526,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/h2/mybatis-config.xml",
"chars": 2576,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/hsqldb/hsqldb.sql",
"chars": 11759,
"preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2022 abel533@gmail.com\n *\n * Permission is hereby granted, free of "
},
{
"path": "src/test/resources/hsqldb/mybatis-config-autodialect.xml",
"chars": 3480,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/hsqldb/mybatis-config-interceptor.xml",
"chars": 2974,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/hsqldb/mybatis-config-pagesizezero.xml",
"chars": 2600,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
},
{
"path": "src/test/resources/hsqldb/mybatis-config-reasonable.xml",
"chars": 2473,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ The MIT License (MIT)\n ~\n ~ Copyright (c) 2014-2023 abel533@gmail.com"
}
]
// ... and 49 more files (download for full content)
About this extraction
This page contains the full source code of the pagehelper-org/Mybatis-PageHelper GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 249 files (1.1 MB), approximately 287.2k tokens, and a symbol index with 905 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.