Class DefaultCountSqlParser
java.lang.Object
org.miaixz.bus.pager.parser.defaults.DefaultCountSqlParser
- All Implemented Interfaces:
CountSqlParser
sql解析类,提供更智能的count查询sql
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected static final net.sf.jsqlparser.expression.AliasFields inherited from interface org.miaixz.bus.pager.parser.CountSqlParser
AGGREGATE_FUNCTIONS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSimpleCountSql(String sql) 获取普通的Count-sqlgetSimpleCountSql(String sql, String name) 获取普通的Count-sqlgetSmartCountSql(String sql, String countColumn) 获取智能的countSqlbooleanisSimpleCount(net.sf.jsqlparser.statement.select.PlainSelect select) 是否可以用简单的count查询方式protected boolean保留 order byprotected boolean保留子查询 order bybooleanorderByHashParameters(List<net.sf.jsqlparser.statement.select.OrderByElement> orderByElements) 判断Orderby是否包含参数,有参数的不能去voidprocessFromItem(net.sf.jsqlparser.statement.select.FromItem fromItem) 处理子查询voidprocessPlainSelect(net.sf.jsqlparser.statement.select.PlainSelect plainSelect) 处理PlainSelect类型的selectBodyvoidprocessSelect(net.sf.jsqlparser.statement.select.Select select) 处理selectBody去除Order byvoidprocessWithItemsList(List<net.sf.jsqlparser.statement.select.WithItem> withItemsList) 处理WithItemnet.sf.jsqlparser.statement.select.SelectsqlToCount(net.sf.jsqlparser.statement.select.Select select, String name) 将sql转换为count查询Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.pager.parser.CountSqlParser
getSmartCountSql
-
Field Details
-
KEEP_ORDERBY
- See Also:
-
TABLE_ALIAS
protected static final net.sf.jsqlparser.expression.Alias TABLE_ALIAS -
skipFunctions
-
falseFunctions
-
-
Constructor Details
-
DefaultCountSqlParser
public DefaultCountSqlParser()
-
-
Method Details
-
getSmartCountSql
获取智能的countSql- Specified by:
getSmartCountSqlin interfaceCountSqlParser- Parameters:
sql- sqlcountColumn- 列名,默认 0- Returns:
- the string
-
getSimpleCountSql
获取普通的Count-sql- Parameters:
sql- 原查询sql- Returns:
- 返回count查询sql
-
getSimpleCountSql
获取普通的Count-sql- Parameters:
sql- 原查询sqlname- 名称- Returns:
- 返回count查询sql
-
sqlToCount
public net.sf.jsqlparser.statement.select.Select sqlToCount(net.sf.jsqlparser.statement.select.Select select, String name) 将sql转换为count查询- Parameters:
select- 原查询sqlname- 名称- Returns:
- 返回count查询sql
-
isSimpleCount
public boolean isSimpleCount(net.sf.jsqlparser.statement.select.PlainSelect select) 是否可以用简单的count查询方式- Parameters:
select- 查询- Returns:
- the boolean
-
processSelect
public void processSelect(net.sf.jsqlparser.statement.select.Select select) 处理selectBody去除Order by- Parameters:
select- 查询信息
-
processPlainSelect
public void processPlainSelect(net.sf.jsqlparser.statement.select.PlainSelect plainSelect) 处理PlainSelect类型的selectBody- Parameters:
plainSelect- 计划查询
-
processWithItemsList
处理WithItem- Parameters:
withItemsList- WithItem
-
processFromItem
public void processFromItem(net.sf.jsqlparser.statement.select.FromItem fromItem) 处理子查询- Parameters:
fromItem- FromItem
-
keepOrderBy
protected boolean keepOrderBy()保留 order by -
keepSubSelectOrderBy
protected boolean keepSubSelectOrderBy()保留子查询 order by -
orderByHashParameters
public boolean orderByHashParameters(List<net.sf.jsqlparser.statement.select.OrderByElement> orderByElements) 判断Orderby是否包含参数,有参数的不能去- Parameters:
orderByElements- OrderByElement- Returns:
- the boolean
-