Module bus.pager

Interface Dialect

All Known Implementing Classes:
AbstractDialect, AbstractPaging, AbstractRowBounds, AS400, CirroData, Db2, Db2RowBounds, Firebird, HerdDB, HerdDBRowBounds, Hsqldb, HsqldbRowBounds, Informix, InformixRowBounds, MySql, MySqlRowBounds, Oracle, Oracle9i, OracleRowBounds, Oscar, PageContext, PostgreSql, PostgreSqlRowBounds, SqlServer, SqlServer2012, SqlServer2012RowBounds, SqlServerRowBounds, Xugudb, XugudbRowBounds

public interface Dialect
数据库方言,针对不同数据库进行实现
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    完成所有任务后
    boolean
    afterCount(long count, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    执行完 count 查询后
    afterPage(List pageList, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    分页查询后,处理分页结果,拦截器中直接 return 该方法的返回值
    default <T> Future<T>
    执行异步 count 查询
    boolean
    beforeCount(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    执行分页前,返回 true 会进行 count 查询,false 会继续下面的 beforePage 判断
    boolean
    beforePage(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    执行分页前,返回 true 会进行分页查询,false 会返回默认查询结果
    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 查询 sql
    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)
    生成分页查询 sql
    default boolean
    是否使用异步 count 查询,使用异步后不会根据返回的 count 数来判断是否有必要进行分页查询
    processParameterObject(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey pageKey)
    处理查询参数对象
    void
    设置参数
    boolean
    skip(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    跳过 count 和 分页查询
  • Method Details

    • skip

      boolean skip(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      跳过 count 和 分页查询
      Parameters:
      ms - MappedStatement
      parameterObject - 方法参数
      rowBounds - 分页参数
      Returns:
      true 跳过,返回默认查询结果,false 执行分页查询
    • isAsyncCount

      default boolean isAsyncCount()
      是否使用异步 count 查询,使用异步后不会根据返回的 count 数来判断是否有必要进行分页查询
      Returns:
      true 异步,false 同步
    • asyncCountTask

      default <T> Future<T> asyncCountTask(Callable<T> task)
      执行异步 count 查询
      Type Parameters:
      T - 引用对象
      Parameters:
      task - 异步查询任务
      Returns:
      the object
    • beforeCount

      boolean beforeCount(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      执行分页前,返回 true 会进行 count 查询,false 会继续下面的 beforePage 判断
      Parameters:
      ms - MappedStatement
      parameterObject - 方法参数
      rowBounds - 分页参数
      Returns:
      the object
    • getCountSql

      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)
      生成 count 查询 sql
      Parameters:
      ms - MappedStatement
      boundSql - 绑定 SQL 对象
      parameterObject - 方法参数
      rowBounds - 分页参数
      countKey - count 缓存 key
      Returns:
      the object
    • afterCount

      boolean afterCount(long count, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      执行完 count 查询后
      Parameters:
      count - 查询结果总数
      parameterObject - 接口参数
      rowBounds - 分页参数
      Returns:
      true 继续分页查询,false 直接返回
    • processParameterObject

      Object processParameterObject(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey pageKey)
      处理查询参数对象
      Parameters:
      ms - MappedStatement
      parameterObject - 方法参数
      boundSql - 绑定 SQL 对象
      pageKey - 分页缓存 key
      Returns:
      the object
    • beforePage

      boolean beforePage(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      执行分页前,返回 true 会进行分页查询,false 会返回默认查询结果
      Parameters:
      ms - MappedStatement
      parameterObject - 方法参数
      rowBounds - 分页参数
      Returns:
      the object
    • getPageSql

      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)
      生成分页查询 sql
      Parameters:
      ms - MappedStatement
      boundSql - 绑定 SQL 对象
      parameterObject - 方法参数
      rowBounds - 分页参数
      pageKey - 分页缓存 key
      Returns:
      the object
    • afterPage

      Object afterPage(List pageList, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      分页查询后,处理分页结果,拦截器中直接 return 该方法的返回值
      Parameters:
      pageList - 分页查询结果
      parameterObject - 方法参数
      rowBounds - 分页参数
      Returns:
      the object
    • afterAll

      void afterAll()
      完成所有任务后
    • setProperties

      void setProperties(Properties properties)
      设置参数
      Parameters:
      properties - 插件属性