java.lang.Object
org.miaixz.bus.pager.dialect.AbstractDialect
org.miaixz.bus.pager.dialect.AbstractRowBounds
org.miaixz.bus.pager.dialect.rowbounds.SqlServerRowBounds
- All Implemented Interfaces:
Dialect
- Direct Known Subclasses:
SqlServer2012RowBounds
SQL Server dialect for pagination based on
RowBounds. This class provides SQL Server-specific SQL generation
for pagination using offset and limit.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ReplaceSqlUtility for replacing and restoring SQL parts, especially for `with(nolock)`.protected SqlServerSqlParserSQL Server specific SQL parser for pagination.Fields 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) Generates the SQL for the count query for SQL Server.getPageSql(String sql, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey pageKey) Generates the SQL Server-specific pagination SQL usingRowBounds.voidsetProperties(Properties properties) Sets the properties for this SQL Server RowBounds dialect.Methods inherited from class org.miaixz.bus.pager.dialect.AbstractRowBounds
afterAll, afterCount, afterPage, beforeCount, beforePage, getPageSql, 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
SQL Server specific SQL parser for pagination. -
replaceSql
Utility for replacing and restoring SQL parts, especially for `with(nolock)`.
-
-
Constructor Details
-
SqlServerRowBounds
public SqlServerRowBounds()
-
-
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) Generates the SQL for the count query for SQL Server. It applies SQL replacement rules before and after generating the count SQL.- Specified by:
getCountSqlin interfaceDialect- Overrides:
getCountSqlin classAbstractDialect- Parameters:
ms- the MappedStatement objectboundSql- the BoundSql object containing the original SQL and parametersparameterObject- the parameter object for the queryrowBounds- the RowBounds object containing pagination parameterscountKey- the CacheKey for the count query- Returns:
- the generated count SQL string
-
getPageSql
public String getPageSql(String sql, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey pageKey) Generates the SQL Server-specific pagination SQL usingRowBounds. It applies SQL replacement rules, converts the SQL to a paginated form, and substitutes pagination parameters.- Specified by:
getPageSqlin classAbstractRowBounds- Parameters:
sql- the original SQL stringrowBounds- theRowBoundsobject containing offset and limitpageKey- the CacheKey for the paginated query- Returns:
- the SQL Server-specific paginated SQL string
-
setProperties
Sets the properties for this SQL Server RowBounds dialect. It initializes theSqlServerSqlParserandReplaceSqlimplementation.- Specified by:
setPropertiesin interfaceDialect- Overrides:
setPropertiesin classAbstractRowBounds- Parameters:
properties- the properties to set
-