Module bus.pager

Class PaginationHandler

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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    在调试模式下记录分页调用堆栈。
    获取当前分页方言。
    boolean
    检查是否启用调试模式。
    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)
    判断是否需要执行分页查询。
    protected void
    processSelect(net.sf.jsqlparser.statement.select.Select select, int index, String sql, Object obj)
    处理 SELECT 语句,记录分页相关日志。
    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 和分页逻辑。
    boolean
    设置分页处理器属性,初始化缓存和方言。

    Methods inherited from class org.miaixz.bus.mapper.handler.AbstractSqlHandler

    getMappedStatement, getMappedStatement, getMetaObject, getSqlParserInfo, mapperBoundSql, mapperStatementHandler, realTarget, setAdditionalParameter

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.miaixz.bus.core.Handler

    after, before

    Methods 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:
      isQuery in interface org.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:
      query in interface org.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:
      processSelect in class SqlParserHandler
      Parameters:
      select - SELECT 语句对象
      index - 索引
      sql - 原始 SQL 语句
      obj - 附加对象
    • setProperties

      public boolean setProperties(Properties properties)
      设置分页处理器属性,初始化缓存和方言。
      Specified by:
      setProperties in interface org.miaixz.bus.core.Handler
      Parameters:
      properties - 配置属性
      Returns:
      是否设置成功
    • getDialect

      public Dialect getDialect()
      获取当前分页方言。
      Returns:
      分页方言