forked from github/dataease
commit
94bd4406a4
@ -129,7 +129,7 @@ public class DorisQueryProvider extends QueryProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||||
ST st_sql = stg.getInstanceOf("querySql");
|
ST st_sql = stg.getInstanceOf("previewSql");
|
||||||
st_sql.add("isGroup", isGroup);
|
st_sql.add("isGroup", isGroup);
|
||||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||||
|
@ -127,7 +127,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||||
ST st_sql = stg.getInstanceOf("querySql");
|
ST st_sql = stg.getInstanceOf("previewSql");
|
||||||
st_sql.add("isGroup", isGroup);
|
st_sql.add("isGroup", isGroup);
|
||||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||||
|
@ -101,7 +101,7 @@ public class OracleQueryProvider extends QueryProvider {
|
|||||||
List<SQLObj> xFields = xFields(table, fields);
|
List<SQLObj> xFields = xFields(table, fields);
|
||||||
|
|
||||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||||
ST st_sql = stg.getInstanceOf("querySql");
|
ST st_sql = stg.getInstanceOf("previewSql");
|
||||||
st_sql.add("isGroup", isGroup);
|
st_sql.add("isGroup", isGroup);
|
||||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||||
|
@ -1,4 +1,34 @@
|
|||||||
querySql(groups, aggregators, filters, orders, table, isGroup)
|
querySql(groups, aggregators, filters, orders, table)
|
||||||
|
::=<<
|
||||||
|
SELECT
|
||||||
|
<if(!groups && !aggregators)>
|
||||||
|
*
|
||||||
|
<endif>
|
||||||
|
<if(groups)>
|
||||||
|
<groups:{group|<if(group)><group.fieldName> AS <group.fieldAlias><endif>}; separator=",\n">
|
||||||
|
<endif>
|
||||||
|
<if(groups && aggregators)>,<endif>
|
||||||
|
<if(aggregators)>
|
||||||
|
<aggregators:{agg|<if(agg)><agg.fieldName> AS <agg.fieldAlias><endif>}; separator=",\n">
|
||||||
|
<endif>
|
||||||
|
FROM
|
||||||
|
<table.tableName> <table.tableAlias>
|
||||||
|
<if(filters)>
|
||||||
|
WHERE
|
||||||
|
<filters:{filter|<if(filter)><filter.whereField> <filter.whereTermAndValue><endif>}; separator="\nAND ">
|
||||||
|
<endif>
|
||||||
|
<if(groups)>
|
||||||
|
GROUP BY
|
||||||
|
<groups:{group|<if(group)><group.fieldName><endif>}; separator=",\n">
|
||||||
|
<endif>
|
||||||
|
<if(orders)>
|
||||||
|
ORDER BY
|
||||||
|
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; separator=",\n">
|
||||||
|
<endif>
|
||||||
|
>>
|
||||||
|
|
||||||
|
|
||||||
|
previewSql(groups, aggregators, filters, orders, table, isGroup)
|
||||||
::=<<
|
::=<<
|
||||||
SELECT
|
SELECT
|
||||||
<if(!groups && !aggregators)>
|
<if(!groups && !aggregators)>
|
||||||
|
Loading…
Reference in New Issue
Block a user