forked from github/dataease
fix(视图): 修复doris中使用case语法报错
This commit is contained in:
parent
1b33d38f66
commit
1b83afc800
@ -155,7 +155,10 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("previewSql");
|
||||
st_sql.add("isGroup", isGroup);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) {
|
||||
st_sql.add("useAliasForGroup", true);
|
||||
st_sql.add("groups", xFields);
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
@ -345,7 +348,10 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("querySql");
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) {
|
||||
st_sql.add("useAliasForGroup", true);
|
||||
st_sql.add("groups", xFields);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
@ -435,7 +441,10 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("previewSql");
|
||||
st_sql.add("isGroup", false);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) {
|
||||
st_sql.add("useAliasForGroup", true);
|
||||
st_sql.add("groups", xFields);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String sql = st_sql.render();
|
||||
@ -558,7 +567,10 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("querySql");
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) {
|
||||
st_sql.add("useAliasForGroup", true);
|
||||
st_sql.add("groups", xFields);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
@ -672,7 +684,10 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("querySql");
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) {
|
||||
st_sql.add("useAliasForGroup", true);
|
||||
st_sql.add("groups", xFields);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
|
@ -1,4 +1,4 @@
|
||||
querySql(limitFiled, groups, aggregators, filters, orders, table, notUseAs)
|
||||
querySql(limitFiled, groups, aggregators, filters, orders, table, notUseAs, useAliasForGroup)
|
||||
::=<<
|
||||
SELECT
|
||||
<if(limitFiled)>
|
||||
@ -25,8 +25,13 @@ WHERE
|
||||
<endif>
|
||||
<if(groups)>
|
||||
GROUP BY
|
||||
<if(!useAliasForGroup)>
|
||||
<groups:{group|<if(group)><group.fieldName><endif>}; separator=",\n">
|
||||
<endif>
|
||||
<if(useAliasForGroup)>
|
||||
<groups:{group|<if(group)><group.fieldAlias><endif>}; separator=",\n">
|
||||
<endif>
|
||||
<endif>
|
||||
<if(orders)>
|
||||
ORDER BY
|
||||
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; separator=",\n">
|
||||
@ -34,7 +39,7 @@ ORDER BY
|
||||
>>
|
||||
|
||||
|
||||
previewSql(limitFiled, groups, aggregators, filters, orders, table, isGroup, notUseAs)
|
||||
previewSql(limitFiled, groups, aggregators, filters, orders, table, isGroup, notUseAs, useAliasForGroup)
|
||||
::=<<
|
||||
SELECT
|
||||
<if(limitFiled)>
|
||||
@ -61,8 +66,13 @@ WHERE
|
||||
<endif>
|
||||
<if(isGroup && groups)>
|
||||
GROUP BY
|
||||
<if(!useAliasForGroup)>
|
||||
<groups:{group|<if(group)><group.fieldName><endif>}; separator=",\n">
|
||||
<endif>
|
||||
<if(useAliasForGroup)>
|
||||
<groups:{group|<if(group)><group.fieldAlias><endif>}; separator=",\n">
|
||||
<endif>
|
||||
<endif>
|
||||
<if(orders)>
|
||||
ORDER BY
|
||||
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; separator=",\n">
|
||||
|
Loading…
Reference in New Issue
Block a user