Package org.aoju.bus.pager
Class PageContext
java.lang.Object
org.aoju.bus.pager.proxy.PageMethod
org.aoju.bus.pager.PageContext
- All Implemented Interfaces:
Dialect,BoundSqlHandler.Chain
Mybatis - 通用分页拦截器
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields inherited from class org.aoju.bus.pager.proxy.PageMethod
DEFAULT_COUNT, LOCAL_PAGEFields inherited from interface org.aoju.bus.pager.plugins.BoundSqlHandler.Chain
DO_NOTHING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAll()完成所有任务后booleanafterCount(long count, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds) 执行完 count 查询后分页查询后,处理分页结果,拦截器中直接 return 该方法的返回值booleanbeforeCount(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds) 执行分页前,返回 true 会进行 count 查询,false 会继续下面的 beforePage 判断booleanbeforePage(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds) 执行分页前,返回 true 会进行分页查询,false 会返回默认查询结果org.apache.ibatis.mapping.BoundSqldoBoundSql(BoundSqlHandler.Type type, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey cacheKey) getCountSql(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.BoundSql boundSql, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey countKey) 生成 count 查询 sqlgetPageSql(String sql, Page page, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey pageKey) getPageSql(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.BoundSql boundSql, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey pageKey) 生成分页查询 sqlprocessParameterObject(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey pageKey) 处理查询参数对象voidsetProperties(Properties properties) 设置参数booleanskip(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds) 跳过 count 和 分页查询Methods inherited from class org.aoju.bus.pager.proxy.PageMethod
clearPage, count, getLocalPage, offsetPage, offsetPage, orderBy, setLocalPage, setStaticProperties, startPage, startPage, startPage, startPage, startPage
-
Constructor Details
-
PageContext
public PageContext()
-
-
Method Details
-
skip
-
beforeCount
public boolean beforeCount(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds) Description copied from interface:Dialect执行分页前,返回 true 会进行 count 查询,false 会继续下面的 beforePage 判断- Specified by:
beforeCountin interfaceDialect- Parameters:
ms- MappedStatementparameterObject- 方法参数rowBounds- 分页参数- Returns:
- the object
-
getCountSql
public String getCountSql(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.BoundSql boundSql, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey countKey) Description copied from interface:Dialect生成 count 查询 sql- Specified by:
getCountSqlin interfaceDialect- Parameters:
ms- MappedStatementboundSql- 绑定 SQL 对象parameterObject- 方法参数rowBounds- 分页参数countKey- count 缓存 key- Returns:
- the object
-
afterCount
public boolean afterCount(long count, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds) Description copied from interface:Dialect执行完 count 查询后- Specified by:
afterCountin interfaceDialect- Parameters:
count- 查询结果总数parameterObject- 接口参数rowBounds- 分页参数- Returns:
- true 继续分页查询,false 直接返回
-
processParameterObject
public Object processParameterObject(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey pageKey) Description copied from interface:Dialect处理查询参数对象- Specified by:
processParameterObjectin interfaceDialect- Parameters:
ms- MappedStatementparameterObject- 方法参数boundSql- 绑定 SQL 对象pageKey- 分页缓存 key- Returns:
- the object
-
beforePage
public boolean beforePage(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds) Description copied from interface:Dialect执行分页前,返回 true 会进行分页查询,false 会返回默认查询结果- Specified by:
beforePagein interfaceDialect- Parameters:
ms- MappedStatementparameterObject- 方法参数rowBounds- 分页参数- Returns:
- the object
-
getPageSql
public String getPageSql(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.BoundSql boundSql, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey pageKey) Description copied from interface:Dialect生成分页查询 sql- Specified by:
getPageSqlin interfaceDialect- Parameters:
ms- MappedStatementboundSql- 绑定 SQL 对象parameterObject- 方法参数rowBounds- 分页参数pageKey- 分页缓存 key- Returns:
- the object
-
getPageSql
-
afterPage
-
afterAll
-
doBoundSql
public org.apache.ibatis.mapping.BoundSql doBoundSql(BoundSqlHandler.Type type, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey cacheKey) - Specified by:
doBoundSqlin interfaceBoundSqlHandler.Chain
-
setProperties
Description copied from interface:Dialect设置参数- Specified by:
setPropertiesin interfaceDialect- Parameters:
properties- 插件属性
-