Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
bc4ef29b
提交
bc4ef29b
authored
11月 01, 2021
作者:
junjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:视图默认返回1000条数据;doris默认不排序
上级
a74f09cc
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
217 行增加
和
159 行删除
+217
-159
QueryProvider.java
...end/src/main/java/io/dataease/provider/QueryProvider.java
+20
-16
CKQueryProvider.java
...rc/main/java/io/dataease/provider/ck/CKQueryProvider.java
+29
-20
DorisQueryProvider.java
...n/java/io/dataease/provider/doris/DorisQueryProvider.java
+0
-0
EsQueryProvider.java
...rc/main/java/io/dataease/provider/es/EsQueryProvider.java
+28
-19
MongoQueryProvider.java
...java/io/dataease/provider/mongodb/MongoQueryProvider.java
+29
-20
MysqlQueryProvider.java
...n/java/io/dataease/provider/mysql/MysqlQueryProvider.java
+29
-20
OracleQueryProvider.java
...java/io/dataease/provider/oracle/OracleQueryProvider.java
+29
-20
PgQueryProvider.java
...rc/main/java/io/dataease/provider/pg/PgQueryProvider.java
+0
-0
SqlserverQueryProvider.java
...o/dataease/provider/sqlserver/SqlserverQueryProvider.java
+29
-20
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+24
-24
没有找到文件。
backend/src/main/java/io/dataease/provider/QueryProvider.java
浏览文件 @
bc4ef29b
package
io
.
dataease
.
provider
;
import
com.google.gson.Gson
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.Datasource
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
...
...
@@ -34,29 +35,32 @@ public abstract class QueryProvider {
public
abstract
String
createQuerySqlWithLimit
(
String
sql
,
List
<
DatasetTableField
>
fields
,
Integer
limit
,
boolean
isGroup
);
public
abstract
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
);
public
abstract
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
);
public
abstract
String
getSQLAsTmp
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
);
public
abstract
String
getSQLAsTmp
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
);
public
abstract
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
);
public
abstract
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
);
public
abstract
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
);
public
abstract
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
);
public
abstract
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
);
public
abstract
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
,
ChartViewWithBLOBs
view
);
public
abstract
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
);
public
abstract
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
ChartViewWithBLOBs
view
);
public
abstract
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
);
public
abstract
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
,
ChartViewWithBLOBs
view
);
public
abstract
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
);
public
abstract
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
ChartViewWithBLOBs
view
);
public
abstract
String
searchTable
(
String
table
);
public
abstract
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
);
public
abstract
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
);
public
Integer
transFieldSize
(
String
type
)
{
public
Integer
transFieldSize
(
String
type
)
{
return
50
;
};
}
;
/**
* 单指标汇总
*
...
...
@@ -66,7 +70,7 @@ public abstract class QueryProvider {
* @param extFilterRequestList
* @return
*/
public
abstract
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
);
public
abstract
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
);
public
abstract
String
wrapSql
(
String
sql
);
...
...
@@ -74,15 +78,15 @@ public abstract class QueryProvider {
public
abstract
String
createRawQuerySQLAsTmp
(
String
sql
,
List
<
DatasetTableField
>
fields
);
public
void
setSchema
(
SQLObj
tableObj
,
Datasource
ds
){
if
(
ds
!=
null
&&
!
tableObj
.
getTableName
().
startsWith
(
"("
)
&&
!
tableObj
.
getTableName
().
endsWith
(
")"
))
{
public
void
setSchema
(
SQLObj
tableObj
,
Datasource
ds
)
{
if
(
ds
!=
null
&&
!
tableObj
.
getTableName
().
startsWith
(
"("
)
&&
!
tableObj
.
getTableName
().
endsWith
(
")"
))
{
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
JdbcConfiguration
.
class
).
getSchema
();
schema
=
String
.
format
(
PgConstants
.
KEYWORD_TABLE
,
schema
);
schema
=
String
.
format
(
PgConstants
.
KEYWORD_TABLE
,
schema
);
tableObj
.
setTableName
(
schema
+
"."
+
tableObj
.
getTableName
());
}
}
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
)
{
return
"select * from tableName"
;
}
}
backend/src/main/java/io/dataease/provider/ck/CKQueryProvider.java
浏览文件 @
bc4ef29b
package
io
.
dataease
.
provider
.
ck
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.DatasetTableFieldExample
;
import
io.dataease.base.domain.Datasource
;
...
...
@@ -198,7 +199,7 @@ public class CKQueryProvider extends QueryProvider {
}
@Override
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
CKConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -300,11 +301,11 @@ public class CKQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
CKConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -372,22 +373,22 @@ public class CKQueryProvider extends QueryProvider {
.
build
();
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
)
{
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
CKConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -492,16 +493,16 @@ public class CKQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
);
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
ChartViewWithBLOBs
view
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
,
view
);
}
@Override
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
)
{
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
CKConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -606,12 +607,12 @@ public class CKQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
);
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
ChartViewWithBLOBs
view
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
,
view
);
}
@Override
...
...
@@ -620,7 +621,7 @@ public class CKQueryProvider extends QueryProvider {
}
@Override
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
// 字段汇总 排序等
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
CKConstants
.
KEYWORD_TABLE
,
table
))
...
...
@@ -688,12 +689,12 @@ public class CKQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
);
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
,
view
);
}
@Override
...
...
@@ -1091,4 +1092,12 @@ public class CKQueryProvider extends QueryProvider {
}
return
originField
;
}
private
String
sqlLimit
(
String
sql
,
ChartViewWithBLOBs
view
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
view
.
getResultMode
(),
"custom"
))
{
return
sql
+
" LIMIT 0,"
+
view
.
getResultCount
();
}
else
{
return
sql
;
}
}
}
backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java
浏览文件 @
bc4ef29b
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/provider/es/EsQueryProvider.java
浏览文件 @
bc4ef29b
package
io
.
dataease
.
provider
.
es
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.DatasetTableFieldExample
;
import
io.dataease.base.domain.Datasource
;
...
...
@@ -198,7 +199,7 @@ public class EsQueryProvider extends QueryProvider {
}
@Override
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
EsSqlLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -300,27 +301,27 @@ public class EsQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
return
null
;
}
@Override
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
return
null
;
}
@Override
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
)
{
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
EsSqlLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -425,16 +426,16 @@ public class EsQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
);
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
ChartViewWithBLOBs
view
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
,
view
);
}
@Override
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
)
{
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
EsSqlLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -539,12 +540,12 @@ public class EsQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
);
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
ChartViewWithBLOBs
view
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
,
view
);
}
@Override
...
...
@@ -553,7 +554,7 @@ public class EsQueryProvider extends QueryProvider {
}
@Override
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
// 字段汇总 排序等
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
EsSqlLConstants
.
KEYWORD_TABLE
,
table
))
...
...
@@ -621,12 +622,12 @@ public class EsQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
);
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
,
view
);
}
@Override
...
...
@@ -655,7 +656,7 @@ public class EsQueryProvider extends QueryProvider {
}
@Override
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
)
{
return
createSQLPreview
(
"SELECT * FROM "
+
String
.
format
(
EsSqlLConstants
.
KEYWORD_TABLE
,
tableName
),
null
);
}
...
...
@@ -972,4 +973,12 @@ public class EsQueryProvider extends QueryProvider {
}
return
originField
;
}
private
String
sqlLimit
(
String
sql
,
ChartViewWithBLOBs
view
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
view
.
getResultMode
(),
"custom"
))
{
return
sql
+
" LIMIT "
+
view
.
getResultCount
();
}
else
{
return
sql
;
}
}
}
backend/src/main/java/io/dataease/provider/mongodb/MongoQueryProvider.java
浏览文件 @
bc4ef29b
package
io
.
dataease
.
provider
.
mongodb
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.DatasetTableFieldExample
;
import
io.dataease.base.domain.Datasource
;
...
...
@@ -143,7 +144,7 @@ public class MongoQueryProvider extends QueryProvider {
}
@Override
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MongoConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -245,11 +246,11 @@ public class MongoQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MongoConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -317,22 +318,22 @@ public class MongoQueryProvider extends QueryProvider {
.
build
();
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
)
{
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MongoConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -437,16 +438,16 @@ public class MongoQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
);
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
ChartViewWithBLOBs
view
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
,
view
);
}
@Override
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
)
{
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MongoConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -551,12 +552,12 @@ public class MongoQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
);
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
ChartViewWithBLOBs
view
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
,
view
);
}
@Override
...
...
@@ -565,7 +566,7 @@ public class MongoQueryProvider extends QueryProvider {
}
@Override
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
// 字段汇总 排序等
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MongoConstants
.
KEYWORD_TABLE
,
table
))
...
...
@@ -633,12 +634,12 @@ public class MongoQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
);
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
,
view
);
}
@Override
...
...
@@ -992,4 +993,12 @@ public class MongoQueryProvider extends QueryProvider {
}
return
originField
;
}
private
String
sqlLimit
(
String
sql
,
ChartViewWithBLOBs
view
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
view
.
getResultMode
(),
"custom"
))
{
return
sql
+
" LIMIT 0,"
+
view
.
getResultCount
();
}
else
{
return
sql
;
}
}
}
backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java
浏览文件 @
bc4ef29b
package
io
.
dataease
.
provider
.
mysql
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.DatasetTableFieldExample
;
import
io.dataease.base.domain.Datasource
;
...
...
@@ -166,7 +167,7 @@ public class MysqlQueryProvider extends QueryProvider {
}
@Override
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MySQLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -268,11 +269,11 @@ public class MysqlQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MySQLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -340,22 +341,22 @@ public class MysqlQueryProvider extends QueryProvider {
.
build
();
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
)
{
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MySQLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -460,16 +461,16 @@ public class MysqlQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
);
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
ChartViewWithBLOBs
view
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
,
view
);
}
@Override
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
)
{
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MySQLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -574,12 +575,12 @@ public class MysqlQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
);
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
ChartViewWithBLOBs
view
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
,
view
);
}
@Override
...
...
@@ -588,7 +589,7 @@ public class MysqlQueryProvider extends QueryProvider {
}
@Override
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
// 字段汇总 排序等
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
MySQLConstants
.
KEYWORD_TABLE
,
table
))
...
...
@@ -656,12 +657,12 @@ public class MysqlQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
);
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
,
view
);
}
@Override
...
...
@@ -1051,4 +1052,12 @@ public class MysqlQueryProvider extends QueryProvider {
}
return
originField
;
}
private
String
sqlLimit
(
String
sql
,
ChartViewWithBLOBs
view
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
view
.
getResultMode
(),
"custom"
))
{
return
sql
+
" LIMIT 0,"
+
view
.
getResultCount
();
}
else
{
return
sql
;
}
}
}
backend/src/main/java/io/dataease/provider/oracle/OracleQueryProvider.java
浏览文件 @
bc4ef29b
package
io
.
dataease
.
provider
.
oracle
;
import
com.google.gson.Gson
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.DatasetTableFieldExample
;
import
io.dataease.base.domain.Datasource
;
...
...
@@ -212,7 +213,7 @@ public class OracleQueryProvider extends QueryProvider {
}
@Override
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
OracleConstants
.
ALIAS_FIX
,
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
)))
...
...
@@ -315,11 +316,11 @@ public class OracleQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
OracleConstants
.
ALIAS_FIX
,
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
)))
...
...
@@ -388,21 +389,21 @@ public class OracleQueryProvider extends QueryProvider {
.
build
();
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
)
{
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
OracleConstants
.
ALIAS_FIX
,
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
)))
...
...
@@ -508,16 +509,16 @@ public class OracleQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
);
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
ChartViewWithBLOBs
view
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
,
view
);
}
@Override
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
)
{
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
OracleConstants
.
ALIAS_FIX
,
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
)))
...
...
@@ -623,12 +624,12 @@ public class OracleQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
);
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
ChartViewWithBLOBs
view
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
,
view
);
}
@Override
...
...
@@ -637,7 +638,7 @@ public class OracleQueryProvider extends QueryProvider {
}
@Override
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
// 字段汇总 排序等
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
table
))
...
...
@@ -704,12 +705,12 @@ public class OracleQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
);
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
,
view
);
}
@Override
...
...
@@ -1124,4 +1125,12 @@ public class OracleQueryProvider extends QueryProvider {
}
return
originField
;
}
private
String
sqlLimit
(
String
sql
,
ChartViewWithBLOBs
view
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
view
.
getResultMode
(),
"custom"
))
{
return
"SELECT * FROM ("
+
sqlFix
(
sql
)
+
") DE_RESULT_TMP "
+
" WHERE rownum <= "
+
view
.
getResultCount
();
}
else
{
return
sql
;
}
}
}
backend/src/main/java/io/dataease/provider/pg/PgQueryProvider.java
浏览文件 @
bc4ef29b
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/provider/sqlserver/SqlserverQueryProvider.java
浏览文件 @
bc4ef29b
package
io
.
dataease
.
provider
.
sqlserver
;
import
com.google.gson.Gson
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.DatasetTableFieldExample
;
import
io.dataease.base.domain.Datasource
;
...
...
@@ -172,7 +173,7 @@ public class SqlserverQueryProvider extends QueryProvider {
}
@Override
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQL
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -259,11 +260,11 @@ public class SqlserverQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
public
String
getSQLTableInfo
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -324,22 +325,22 @@ public class SqlserverQueryProvider extends QueryProvider {
.
build
();
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmpTableInfo
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
return
getSQLTableInfo
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
);
public
String
getSQLAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQL
(
"("
+
sqlFix
(
sql
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
null
,
view
);
}
@Override
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
)
{
public
String
getSQLStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -448,16 +449,16 @@ public class SqlserverQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
);
public
String
getSQLAsTmpStack
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extStack
,
ChartViewWithBLOBs
view
)
{
return
getSQLStack
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extStack
,
null
,
view
);
}
@Override
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
)
{
public
String
getSQLScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
Datasource
ds
,
ChartViewWithBLOBs
view
)
{
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
))
.
tableAlias
(
String
.
format
(
TABLE_ALIAS_PREFIX
,
0
))
...
...
@@ -563,12 +564,12 @@ public class SqlserverQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
);
public
String
getSQLAsTmpScatter
(
String
table
,
List
<
ChartViewFieldDTO
>
xAxis
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
List
<
ChartViewFieldDTO
>
extBubble
,
ChartViewWithBLOBs
view
)
{
return
getSQLScatter
(
"("
+
sqlFix
(
table
)
+
")"
,
xAxis
,
yAxis
,
customFilter
,
extFilterRequestList
,
extBubble
,
null
,
view
);
}
@Override
...
...
@@ -577,7 +578,7 @@ public class SqlserverQueryProvider extends QueryProvider {
}
@Override
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
public
String
getSQLSummary
(
String
table
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
// 字段汇总 排序等
SQLObj
tableObj
=
SQLObj
.
builder
()
.
tableName
((
table
.
startsWith
(
"("
)
&&
table
.
endsWith
(
")"
))
?
table
:
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
))
...
...
@@ -637,12 +638,12 @@ public class SqlserverQueryProvider extends QueryProvider {
if
(
CollectionUtils
.
isNotEmpty
(
aggWheres
))
st
.
add
(
"filters"
,
aggWheres
);
if
(
CollectionUtils
.
isNotEmpty
(
orders
))
st
.
add
(
"orders"
,
orders
);
if
(
ObjectUtils
.
isNotEmpty
(
tableSQL
))
st
.
add
(
"table"
,
tableSQL
);
return
s
t
.
render
(
);
return
s
qlLimit
(
st
.
render
(),
view
);
}
@Override
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
);
public
String
getSQLSummaryAsTmp
(
String
sql
,
List
<
ChartViewFieldDTO
>
yAxis
,
List
<
ChartCustomFilterDTO
>
customFilter
,
List
<
ChartExtFilterRequest
>
extFilterRequestList
,
ChartViewWithBLOBs
view
)
{
return
getSQLSummary
(
"("
+
sqlFix
(
sql
)
+
")"
,
yAxis
,
customFilter
,
extFilterRequestList
,
view
);
}
@Override
...
...
@@ -996,4 +997,12 @@ public class SqlserverQueryProvider extends QueryProvider {
}
return
originField
;
}
private
String
sqlLimit
(
String
sql
,
ChartViewWithBLOBs
view
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
view
.
getResultMode
(),
"custom"
))
{
return
String
.
format
(
"SELECT top %s * from ( %s ) as DE_SQLSERVER_TMP "
,
view
.
getResultCount
(),
sqlFix
(
sql
));
}
else
{
return
sql
;
}
}
}
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
bc4ef29b
...
...
@@ -332,42 +332,42 @@ public class ChartViewService {
if
(
StringUtils
.
equalsIgnoreCase
(
table
.
getType
(),
"db"
))
{
datasourceRequest
.
setTable
(
dataTableInfoDTO
.
getTable
());
if
(
StringUtils
.
equalsIgnoreCase
(
"text"
,
view
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
"gauge"
,
view
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
"liquid"
,
view
.
getType
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLSummary
(
dataTableInfoDTO
.
getTable
(),
yAxis
,
customFilter
,
extFilterList
));
datasourceRequest
.
setQuery
(
qp
.
getSQLSummary
(
dataTableInfoDTO
.
getTable
(),
yAxis
,
customFilter
,
extFilterList
,
view
));
}
else
if
(
StringUtils
.
containsIgnoreCase
(
view
.
getType
(),
"stack"
))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLStack
(
dataTableInfoDTO
.
getTable
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extStack
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQLStack
(
dataTableInfoDTO
.
getTable
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extStack
,
ds
,
view
));
}
else
if
(
StringUtils
.
containsIgnoreCase
(
view
.
getType
(),
"scatter"
))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLScatter
(
dataTableInfoDTO
.
getTable
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extBubble
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQLScatter
(
dataTableInfoDTO
.
getTable
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extBubble
,
ds
,
view
));
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
"table-info"
,
view
.
getType
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLTableInfo
(
dataTableInfoDTO
.
getTable
(),
xAxis
,
customFilter
,
extFilterList
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQLTableInfo
(
dataTableInfoDTO
.
getTable
(),
xAxis
,
customFilter
,
extFilterList
,
ds
,
view
));
}
else
{
datasourceRequest
.
setQuery
(
qp
.
getSQL
(
dataTableInfoDTO
.
getTable
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQL
(
dataTableInfoDTO
.
getTable
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
ds
,
view
));
}
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
table
.
getType
(),
"sql"
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
"text"
,
view
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
"gauge"
,
view
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
"liquid"
,
view
.
getType
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLSummaryAsTmp
(
dataTableInfoDTO
.
getSql
(),
yAxis
,
customFilter
,
extFilterList
));
datasourceRequest
.
setQuery
(
qp
.
getSQLSummaryAsTmp
(
dataTableInfoDTO
.
getSql
(),
yAxis
,
customFilter
,
extFilterList
,
view
));
}
else
if
(
StringUtils
.
containsIgnoreCase
(
view
.
getType
(),
"stack"
))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpStack
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extStack
));
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpStack
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extStack
,
view
));
}
else
if
(
StringUtils
.
containsIgnoreCase
(
view
.
getType
(),
"scatter"
))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpScatter
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extBubble
));
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpScatter
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extBubble
,
view
));
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
"table-info"
,
view
.
getType
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpTableInfo
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
customFilter
,
extFilterList
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpTableInfo
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
customFilter
,
extFilterList
,
ds
,
view
));
}
else
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmp
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
));
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmp
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
view
));
}
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
table
.
getType
(),
"custom"
))
{
DataTableInfoDTO
dt
=
new
Gson
().
fromJson
(
table
.
getInfo
(),
DataTableInfoDTO
.
class
);
List
<
DataSetTableUnionDTO
>
list
=
dataSetTableUnionService
.
listByTableId
(
dt
.
getList
().
get
(
0
).
getTableId
());
String
sql
=
dataSetTableService
.
getCustomSQLDatasource
(
dt
,
list
,
ds
);
if
(
StringUtils
.
equalsIgnoreCase
(
"text"
,
view
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
"gauge"
,
view
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
"liquid"
,
view
.
getType
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLSummaryAsTmp
(
sql
,
yAxis
,
customFilter
,
extFilterList
));
datasourceRequest
.
setQuery
(
qp
.
getSQLSummaryAsTmp
(
sql
,
yAxis
,
customFilter
,
extFilterList
,
view
));
}
else
if
(
StringUtils
.
containsIgnoreCase
(
view
.
getType
(),
"stack"
))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpStack
(
sql
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extStack
));
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpStack
(
sql
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extStack
,
view
));
}
else
if
(
StringUtils
.
containsIgnoreCase
(
view
.
getType
(),
"scatter"
))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpScatter
(
sql
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extBubble
));
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpScatter
(
sql
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extBubble
,
view
));
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
"table-info"
,
view
.
getType
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpTableInfo
(
sql
,
xAxis
,
customFilter
,
extFilterList
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmpTableInfo
(
sql
,
xAxis
,
customFilter
,
extFilterList
,
ds
,
view
));
}
else
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmp
(
sql
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
));
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmp
(
sql
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
view
));
}
}
data
=
datasourceProvider
.
getData
(
datasourceRequest
);
...
...
@@ -391,15 +391,15 @@ public class ChartViewService {
datasourceRequest
.
setTable
(
tableName
);
QueryProvider
qp
=
ProviderFactory
.
getQueryProvider
(
ds
.
getType
());
if
(
StringUtils
.
equalsIgnoreCase
(
"text"
,
view
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
"gauge"
,
view
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
"liquid"
,
view
.
getType
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLSummary
(
tableName
,
yAxis
,
customFilter
,
extFilterList
));
datasourceRequest
.
setQuery
(
qp
.
getSQLSummary
(
tableName
,
yAxis
,
customFilter
,
extFilterList
,
view
));
}
else
if
(
StringUtils
.
containsIgnoreCase
(
view
.
getType
(),
"stack"
))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLStack
(
tableName
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extStack
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQLStack
(
tableName
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extStack
,
ds
,
view
));
}
else
if
(
StringUtils
.
containsIgnoreCase
(
view
.
getType
(),
"scatter"
))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLScatter
(
tableName
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extBubble
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQLScatter
(
tableName
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
extBubble
,
ds
,
view
));
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
"table-info"
,
view
.
getType
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLTableInfo
(
tableName
,
xAxis
,
customFilter
,
extFilterList
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQLTableInfo
(
tableName
,
xAxis
,
customFilter
,
extFilterList
,
ds
,
view
));
}
else
{
datasourceRequest
.
setQuery
(
qp
.
getSQL
(
tableName
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
ds
));
datasourceRequest
.
setQuery
(
qp
.
getSQL
(
tableName
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
,
ds
,
view
));
}
/*// 定时抽取使用缓存
Object cache;
...
...
@@ -435,10 +435,10 @@ public class ChartViewService {
}
}
}
// 返回数据量判定
if
(
StringUtils
.
equalsIgnoreCase
(
"custom"
,
view
.
getResultMode
())
&&
data
.
size
()
>
view
.
getResultCount
())
{
data
=
data
.
subList
(
0
,
view
.
getResultCount
());
}
//
// 返回数据量判定
//
if (StringUtils.equalsIgnoreCase("custom", view.getResultMode()) && data.size() > view.getResultCount()) {
//
data = data.subList(0, view.getResultCount());
//
}
Map
<
String
,
Object
>
map
=
new
TreeMap
<>();
// 图表组件可再扩展
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论