java.lang.Object
org.miaixz.bus.pager.dialect.AbstractDialect
org.miaixz.bus.pager.dialect.AbstractPaging
org.miaixz.bus.pager.dialect.base.SqlServer
- All Implemented Interfaces:
Dialect
- Direct Known Subclasses:
SqlServer2012
数据库方言 sqlserver
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsFields inherited from class org.miaixz.bus.pager.dialect.AbstractPaging
PAGEPARAMETER_FIRST, PAGEPARAMETER_SECOND, SUFFIX_COUNT, SUFFIX_PAGEFields inherited from class org.miaixz.bus.pager.dialect.AbstractDialect
countSqlParser, orderBySqlParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCountSql(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.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) 分页查询,Pager转换SQL时报错with(nolock)不识别的问题, 重写父类AbstractPaging.getPageSql转换出错的方法。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) 处理分页参数voidsetProperties(Properties properties) 设置参数Methods inherited from class org.miaixz.bus.pager.dialect.AbstractPaging
afterAll, afterCount, afterPage, beforeCount, beforePage, getLocalPage, handleParameter, processParameterObject, skipMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.pager.Dialect
asyncCountTask, isAsyncCount
-
Field Details
-
sqlServerSqlParser
-
CACHE_COUNTSQL
-
CACHE_PAGESQL
-
replaceSql
-
-
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:
getCountSqlin interfaceDialect- Overrides:
getCountSqlin classAbstractPaging- Parameters:
ms- MappedStatementboundSql- 绑定 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:
processPageParameterin classAbstractPaging- Parameters:
ms- MappedStatementparamMap- Mappage- PageboundSql- BoundSqlpageKey- CacheKey- Returns:
- 结果
-
getPageSql
Description copied from class:AbstractPaging单独处理分页部分- Specified by:
getPageSqlin classAbstractPaging- Parameters:
sql- sqlpage- PagepageKey- 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:
getPageSqlin interfaceDialect- Overrides:
getPageSqlin classAbstractPaging- Parameters:
ms- MappedStatementboundSql- 绑定 SQL 对象parameterObject- 方法参数rowBounds- 分页参数pageKey- 分页缓存 key- Returns:
- the object
-
setProperties
Description copied from interface:Dialect设置参数- Specified by:
setPropertiesin interfaceDialect- Overrides:
setPropertiesin classAbstractPaging- Parameters:
properties- 插件属性
-