Class SqlServer

All Implemented Interfaces:
Dialect
Direct Known Subclasses:
SqlServer2012

public class SqlServer extends AbstractPaging
数据库方言 sqlserver
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

  • Constructor Details

    • SqlServer

      public SqlServer()
  • Method Details

    • 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:
      getCountSql in interface Dialect
      Overrides:
      getCountSql in class AbstractPaging
      Parameters:
      ms - MappedStatement
      boundSql - 绑定 SQL 对象
      parameterObject - 方法参数
      rowBounds - 分页参数
      countKey - count 缓存 key
      Returns:
      the object
    • processPageParameter

      public Object processPageParameter(org.apache.ibatis.mapping.MappedStatement ms, Map<String,Object> paramMap, Page page, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey pageKey)
      Description copied from class: AbstractPaging
      处理分页参数
      Specified by:
      processPageParameter in class AbstractPaging
      Parameters:
      ms - MappedStatement
      paramMap - Map
      page - Page
      boundSql - BoundSql
      pageKey - CacheKey
      Returns:
      结果
    • getPageSql

      public String getPageSql(String sql, Page page, org.apache.ibatis.cache.CacheKey pageKey)
      Description copied from class: AbstractPaging
      单独处理分页部分
      Specified by:
      getPageSql in class AbstractPaging
      Parameters:
      sql - sql
      page - Page
      pageKey - CacheKey
      Returns:
      the string
    • 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)
      分页查询,Pager转换SQL时报错with(nolock)不识别的问题, 重写父类AbstractPaging.getPageSql转换出错的方法。 1. this.replaceSql.replace(sql);先转换成假的表名 2. 然后进行SQL转换 3. this.replaceSql.restore(sql);最后再恢复成真的with(nolock)
      Specified by:
      getPageSql in interface Dialect
      Overrides:
      getPageSql in class AbstractPaging
      Parameters:
      ms - MappedStatement
      boundSql - 绑定 SQL 对象
      parameterObject - 方法参数
      rowBounds - 分页参数
      pageKey - 分页缓存 key
      Returns:
      the object
    • setProperties

      public void setProperties(Properties properties)
      Description copied from interface: Dialect
      设置参数
      Specified by:
      setProperties in interface Dialect
      Overrides:
      setProperties in class AbstractPaging
      Parameters:
      properties - 插件属性