java.lang.Object
org.miaixz.bus.mapper.handler.AbstractSqlHandler
org.miaixz.bus.pager.handler.SqlParserHandler
org.miaixz.bus.pager.handler.PaginationHandler
- All Implemented Interfaces:
org.miaixz.bus.core.Handler,org.miaixz.bus.mapper.handler.MapperHandler
public class PaginationHandler
extends SqlParserHandler
implements org.miaixz.bus.mapper.handler.MapperHandler
分页:查询的分页
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields inherited from class org.miaixz.bus.mapper.handler.AbstractSqlHandler
DEFAULT_REFLECTOR_FACTORY, DELEGATE_BOUNDSQL, DELEGATE_BOUNDSQL_SQL, DELEGATE_MAPPEDSTATEMENT, MAPPEDSTATEMENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void在调试模式下记录分页调用堆栈。获取当前分页方言。booleanisDebug()检查是否启用调试模式。booleanisQuery(org.apache.ibatis.executor.Executor executor, org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler resultHandler, org.apache.ibatis.mapping.BoundSql boundSql) 判断是否需要执行分页查询。protected voidprocessSelect(net.sf.jsqlparser.statement.select.Select select, int index, String sql, Object obj) 处理 SELECT 语句,记录分页相关日志。voidquery(Object result, org.apache.ibatis.executor.Executor executor, org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler resultHandler, org.apache.ibatis.mapping.BoundSql boundSql) 执行分页查询,处理 COUNT 和分页逻辑。booleansetProperties(Properties properties) 设置分页处理器属性,初始化缓存和方言。Methods inherited from class org.miaixz.bus.pager.handler.SqlParserHandler
parse, parserMulti, parserSingle, parseStatements, processDelete, processInsert, processParser, processUpdate, validateSqlMethods inherited from class org.miaixz.bus.mapper.handler.AbstractSqlHandler
getMappedStatement, getMappedStatement, getMetaObject, getSqlParserInfo, mapperBoundSql, mapperStatementHandler, realTarget, setAdditionalParameterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.core.Handler
after, beforeMethods inherited from interface org.miaixz.bus.mapper.handler.MapperHandler
getBoundSql, isUpdate, prepare, update
-
Constructor Details
-
PaginationHandler
public PaginationHandler()
-
-
Method Details
-
isDebug
public boolean isDebug()检查是否启用调试模式。- Returns:
- 是否启用调试模式
-
debugStackTraceLog
protected void debugStackTraceLog()在调试模式下记录分页调用堆栈。 -
isQuery
public boolean isQuery(org.apache.ibatis.executor.Executor executor, org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler resultHandler, org.apache.ibatis.mapping.BoundSql boundSql) 判断是否需要执行分页查询。- Specified by:
isQueryin interfaceorg.miaixz.bus.mapper.handler.MapperHandler- Parameters:
executor- MyBatis 执行器mappedStatement- MappedStatement 对象parameter- 查询参数rowBounds- 分页参数resultHandler- 结果处理器boundSql- 绑定的 SQL- Returns:
- 是否需要分页查询
-
query
public void query(Object result, org.apache.ibatis.executor.Executor executor, org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler resultHandler, org.apache.ibatis.mapping.BoundSql boundSql) 执行分页查询,处理 COUNT 和分页逻辑。- Specified by:
queryin interfaceorg.miaixz.bus.mapper.handler.MapperHandler- Parameters:
result- 分页结果executor- MyBatis 执行器mappedStatement- MappedStatement 对象parameter- 查询参数rowBounds- 分页参数resultHandler- 结果处理器boundSql- 绑定的 SQL
-
processSelect
protected void processSelect(net.sf.jsqlparser.statement.select.Select select, int index, String sql, Object obj) 处理 SELECT 语句,记录分页相关日志。- Overrides:
processSelectin classSqlParserHandler- Parameters:
select- SELECT 语句对象index- 索引sql- 原始 SQL 语句obj- 附加对象
-
setProperties
设置分页处理器属性,初始化缓存和方言。- Specified by:
setPropertiesin interfaceorg.miaixz.bus.core.Handler- Parameters:
properties- 配置属性- Returns:
- 是否设置成功
-
getDialect
获取当前分页方言。- Returns:
- 分页方言
-