Package com.github.pagehelper.parser
Class CountJSqlParser47
- java.lang.Object
-
- com.github.pagehelper.parser.CountJSqlParser47
-
- All Implemented Interfaces:
com.github.pagehelper.parser.CountSqlParser
public class CountJSqlParser47 extends Object implements com.github.pagehelper.parser.CountSqlParser
sql解析类,提供更智能的count查询sql- Author:
- liuzh
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>falseFunctionsstatic StringKEEP_ORDERBYprotected Set<String>skipFunctionsprotected static net.sf.jsqlparser.expression.AliasTABLE_ALIAS
-
Constructor Summary
Constructors Constructor Description CountJSqlParser47()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetSimpleCountSql(String sql)获取普通的Count-sqlStringgetSimpleCountSql(String sql, String name)获取普通的Count-sqlStringgetSmartCountSql(String sql, String countColumn)获取智能的countSqlbooleanisSimpleCount(net.sf.jsqlparser.statement.select.PlainSelect select)是否可以用简单的count查询方式protected booleankeepOrderBy()保留 order byprotected booleankeepSubSelectOrderBy()保留子查询 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查询
-
-
-
Method Detail
-
getSmartCountSql
public String getSmartCountSql(String sql, String countColumn)
获取智能的countSql- Specified by:
getSmartCountSqlin interfacecom.github.pagehelper.parser.CountSqlParser- Parameters:
sql-countColumn- 列名,默认 0- Returns:
-
getSimpleCountSql
public String getSimpleCountSql(String sql)
获取普通的Count-sql- Parameters:
sql- 原查询sql- Returns:
- 返回count查询sql
-
getSimpleCountSql
public String getSimpleCountSql(String sql, String name)
获取普通的Count-sql- Parameters:
sql- 原查询sql- 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-
-
isSimpleCount
public boolean isSimpleCount(net.sf.jsqlparser.statement.select.PlainSelect select)
是否可以用简单的count查询方式- Parameters:
select-- Returns:
-
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
public void processWithItemsList(List<net.sf.jsqlparser.statement.select.WithItem> withItemsList)
处理WithItem- Parameters:
withItemsList-
-
processFromItem
public void processFromItem(net.sf.jsqlparser.statement.select.FromItem fromItem)
处理子查询- Parameters:
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-- Returns:
-
-