public class CountSqlParser extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
KEEP_ORDERBY |
| Constructor and Description |
|---|
CountSqlParser() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addAggregateFunctions(String functions)
添加到聚合函数,可以是逗号隔开的多个函数前缀
|
String |
getSimpleCountSql(String sql)
获取普通的Count-sql
|
String |
getSimpleCountSql(String sql,
String name)
获取普通的Count-sql
|
String |
getSmartCountSql(String sql)
获取智能的countSql
|
String |
getSmartCountSql(String sql,
String name)
获取智能的countSql
|
boolean |
isSimpleCount(net.sf.jsqlparser.statement.select.PlainSelect select)
是否可以用简单的count查询方式
|
boolean |
orderByHashParameters(List<net.sf.jsqlparser.statement.select.OrderByElement> orderByElements)
判断Orderby是否包含参数,有参数的不能去
|
void |
processFromItem(net.sf.jsqlparser.statement.select.FromItem fromItem)
处理子查询
|
void |
processPlainSelect(net.sf.jsqlparser.statement.select.PlainSelect plainSelect)
处理PlainSelect类型的selectBody
|
void |
processSelectBody(net.sf.jsqlparser.statement.select.SelectBody selectBody)
处理selectBody去除Order by
|
void |
processWithItemsList(List<net.sf.jsqlparser.statement.select.WithItem> withItemsList)
处理WithItem
|
void |
sqlToCount(net.sf.jsqlparser.statement.select.Select select,
String name)
将sql转换为count查询
|
public static final String KEEP_ORDERBY
public static void addAggregateFunctions(String functions)
functions - public String getSmartCountSql(String sql)
sql - public String getSmartCountSql(String sql, String name)
sql - name - 列名,默认 0public String getSimpleCountSql(String sql)
sql - 原查询sqlpublic String getSimpleCountSql(String sql, String name)
sql - 原查询sqlpublic void sqlToCount(net.sf.jsqlparser.statement.select.Select select,
String name)
select - public boolean isSimpleCount(net.sf.jsqlparser.statement.select.PlainSelect select)
select - public void processSelectBody(net.sf.jsqlparser.statement.select.SelectBody selectBody)
selectBody - public void processPlainSelect(net.sf.jsqlparser.statement.select.PlainSelect plainSelect)
plainSelect - public void processWithItemsList(List<net.sf.jsqlparser.statement.select.WithItem> withItemsList)
withItemsList - public void processFromItem(net.sf.jsqlparser.statement.select.FromItem fromItem)
fromItem - public boolean orderByHashParameters(List<net.sf.jsqlparser.statement.select.OrderByElement> orderByElements)
orderByElements - Copyright © 2018. All rights reserved.