Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
7052f9b9
提交
7052f9b9
authored
12月 20, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:dataease/dataease into dev
上级
5f5f33a8
1e20ed8d
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
682 行增加
和
559 行删除
+682
-559
Dockerfile
Dockerfile
+2
-2
pom.xml
backend/pom.xml
+11
-0
IndexController.java
...src/main/java/io/dataease/controller/IndexController.java
+1
-1
CKQueryProvider.java
...n/java/io/dataease/provider/query/ck/CKQueryProvider.java
+73
-64
Db2QueryProvider.java
...java/io/dataease/provider/query/db2/Db2QueryProvider.java
+63
-54
DorisQueryProvider.java
.../io/dataease/provider/query/doris/DorisQueryProvider.java
+62
-54
EsQueryProvider.java
...n/java/io/dataease/provider/query/es/EsQueryProvider.java
+59
-51
HiveQueryProvider.java
...va/io/dataease/provider/query/hive/HiveQueryProvider.java
+60
-51
MongoQueryProvider.java
...o/dataease/provider/query/mongodb/MongoQueryProvider.java
+50
-41
MysqlQueryProvider.java
.../io/dataease/provider/query/mysql/MysqlQueryProvider.java
+0
-3
OracleQueryProvider.java
...o/dataease/provider/query/oracle/OracleQueryProvider.java
+63
-55
PgQueryProvider.java
...n/java/io/dataease/provider/query/pg/PgQueryProvider.java
+60
-51
RedshiftQueryProvider.java
...taease/provider/query/redshift/RedshiftQueryProvider.java
+56
-47
SqlserverQueryProvider.java
...ease/provider/query/sqlserver/SqlserverQueryProvider.java
+60
-51
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+1
-1
ComponentWrapper.vue
.../components/canvas/components/Editor/ComponentWrapper.vue
+1
-5
Preview.vue
frontend/src/components/canvas/components/Editor/Preview.vue
+1
-1
UserView.vue
frontend/src/components/canvas/custom-component/UserView.vue
+19
-9
style.js
frontend/src/components/canvas/utils/style.js
+15
-6
scatter.js
frontend/src/views/chart/chart/scatter/scatter.js
+4
-2
ChartComponent.vue
frontend/src/views/chart/components/ChartComponent.vue
+5
-1
ResultFilterEditor.vue
.../src/views/chart/components/filter/ResultFilterEditor.vue
+11
-4
index.vue
frontend/src/views/panel/edit/index.vue
+5
-5
没有找到文件。
Dockerfile
浏览文件 @
7052f9b9
FROM
registry.cn-qingdao.aliyuncs.com/dataease/fabric8-java-alpine-openjdk8-jre:
3.15.0
FROM
registry.cn-qingdao.aliyuncs.com/dataease/fabric8-java-alpine-openjdk8-jre:
edge
RUN
echo
-e
'http://mirrors.aliyun.com/alpine/
v3.15/main/\nhttp://mirrors.aliyun.com/alpine/v3.15
/community/'
>
/etc/apk/repositories
RUN
echo
-e
'http://mirrors.aliyun.com/alpine/
edge/main/\nhttp://mirrors.aliyun.com/alpine/edge
/community/'
>
/etc/apk/repositories
RUN
apk add chromium chromium-chromedriver fontconfig
--no-cache
--allow-untrusted
RUN
apk add chromium chromium-chromedriver fontconfig
--no-cache
--allow-untrusted
...
...
backend/pom.xml
浏览文件 @
7052f9b9
...
@@ -407,6 +407,17 @@
...
@@ -407,6 +407,17 @@
<include
name=
"*.html"
/>
<include
name=
"*.html"
/>
</fileset>
</fileset>
</move>
</move>
<move
todir=
"src/main/resources/static/de-app"
>
<fileset
dir=
"../../dataease-app/dist/build/h5"
>
<exclude
name=
"*.html"
/>
</fileset>
</move>
<move
file=
"../../dataease-app/dist/build/h5/index.html"
tofile=
"src/main/resources/templates/app.html"
/>
</target>
</target>
</configuration>
</configuration>
<goals>
<goals>
...
...
backend/src/main/java/io/dataease/controller/IndexController.java
浏览文件 @
7052f9b9
...
@@ -61,7 +61,7 @@ public class IndexController {
...
@@ -61,7 +61,7 @@ public class IndexController {
@GetMapping
(
"/tempMobileLink/{id}/{token}"
)
@GetMapping
(
"/tempMobileLink/{id}/{token}"
)
public
void
tempMobileLink
(
@PathVariable
(
"id"
)
String
id
,
@PathVariable
(
"token"
)
String
token
)
{
public
void
tempMobileLink
(
@PathVariable
(
"id"
)
String
id
,
@PathVariable
(
"token"
)
String
token
)
{
String
url
=
"
http://localhost:8081
/#preview/"
+
id
;
String
url
=
"/#preview/"
+
id
;
HttpServletResponse
response
=
ServletUtils
.
response
();
HttpServletResponse
response
=
ServletUtils
.
response
();
Cookie
cookie
=
new
Cookie
(
"Authorization"
,
token
);
Cookie
cookie
=
new
Cookie
(
"Authorization"
,
token
);
cookie
.
setPath
(
"/"
);
cookie
.
setPath
(
"/"
);
...
...
backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -770,79 +770,88 @@ public class CKQueryProvider extends QueryProvider {
...
@@ -770,79 +770,88 @@ public class CKQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
continue
;
}
String
whereName
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
CKConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
CKConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_STRING
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
CKConstants
.
toDateTime
,
originName
);
}
}
String
value
=
filterItemDTO
.
getValue
();
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_INT
||
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_FLOAT
||
field
.
getDeExtractType
()
==
4
)
{
String
whereName
=
""
;
String
cast
=
String
.
format
(
CKConstants
.
toFloat64
,
originName
);
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
whereName
=
String
.
format
(
CKConstants
.
toDateTime
,
cast
);
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
CKConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
CKConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_STRING
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
CKConstants
.
toDateTime
,
originName
);
}
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_INT
||
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_FLOAT
||
field
.
getDeExtractType
()
==
4
)
{
String
cast
=
String
.
format
(
CKConstants
.
toFloat64
,
originName
);
whereName
=
String
.
format
(
CKConstants
.
toDateTime
,
cast
);
}
if
(
field
.
getDeExtractType
()
==
1
)
{
whereName
=
originName
;
}
}
else
{
whereName
=
originName
;
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
""
;
whereName
=
originName
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
}
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
whereValue
=
"''"
;
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
whereValue
=
"''"
;
}
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
}
else
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
whereValue
=
"'%"
+
value
+
"%'"
;
String
value
=
filterItemDTO
.
getValue
();
}
else
{
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
String
whereValue
=
""
;
whereValue
=
String
.
format
(
CKConstants
.
toDateTime
,
"'"
+
value
+
"'"
);
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
whereValue
=
String
.
format
(
CKConstants
.
toDateTime
,
"'"
+
value
+
"'"
);
}
else
{
whereValue
=
String
.
format
(
CKConstants
.
WHERE_VALUE_VALUE
,
value
);
}
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
&&
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
"is null"
)
.
build
());
}
else
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
&&
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
"is not null"
)
.
build
());
}
else
{
}
else
{
whereValue
=
String
.
format
(
CKConstants
.
WHERE_VALUE_VALUE
,
value
);
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
}
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
&&
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
add
(
SQLObj
.
builder
()
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
.
whereField
(
whereName
)
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
.
whereTermAndValue
(
"is null"
)
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
.
build
());
}
else
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
&&
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
"is not null"
)
.
build
());
}
else
{
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
}
}
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
}
}
...
...
backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java
浏览文件 @
7052f9b9
...
@@ -737,68 +737,77 @@ public class Db2QueryProvider extends QueryProvider {
...
@@ -737,68 +737,77 @@ public class Db2QueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
continue
;
}
String
whereName
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
Db2Constants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
Db2Constants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_STRING
||
field
.
getDeExtractType
()
==
5
)
{
originName
=
String
.
format
(
Db2Constants
.
STR_TO_DATE
,
originName
);
whereName
=
String
.
format
(
Db2Constants
.
DATE_FORMAT
,
originName
,
Db2Constants
.
DEFAULT_DATE_FORMAT
);
}
}
String
value
=
filterItemDTO
.
getValue
();
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_INT
||
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_FLOAT
)
{
String
whereName
=
""
;
String
cast
=
String
.
format
(
Db2Constants
.
CAST
,
originName
,
Db2Constants
.
DEFAULT_INT_FORMAT
);
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
whereName
=
String
.
format
(
Db2Constants
.
FROM_UNIXTIME
,
cast
,
Db2Constants
.
DEFAULT_DATE_FORMAT
);
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
Db2Constants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
Db2Constants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_STRING
||
field
.
getDeExtractType
()
==
5
)
{
originName
=
String
.
format
(
Db2Constants
.
STR_TO_DATE
,
originName
);
whereName
=
String
.
format
(
Db2Constants
.
DATE_FORMAT
,
originName
,
Db2Constants
.
DEFAULT_DATE_FORMAT
);
}
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_INT
||
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_FLOAT
)
{
String
cast
=
String
.
format
(
Db2Constants
.
CAST
,
originName
,
Db2Constants
.
DEFAULT_INT_FORMAT
);
whereName
=
String
.
format
(
Db2Constants
.
FROM_UNIXTIME
,
cast
,
Db2Constants
.
DEFAULT_DATE_FORMAT
);
}
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_TIME
)
{
whereName
=
originName
;
}
}
else
{
whereName
=
originName
;
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
""
;
whereName
=
originName
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
}
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
whereValue
=
"''"
;
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
whereValue
=
"''"
;
}
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
}
else
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
whereValue
=
"'%"
+
value
+
"%'"
;
String
value
=
filterItemDTO
.
getValue
();
}
else
{
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
if
(
field
.
getDeType
().
equals
(
DeTypeConstants
.
DE_TIME
))
{
String
whereValue
=
""
;
whereValue
=
String
.
format
(
Db2Constants
.
DATE_FORMAT
,
"'"
+
value
+
"'"
,
Db2Constants
.
DEFAULT_DATE_FORMAT
);
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
}
else
{
whereValue
=
String
.
format
(
Db2Constants
.
WHERE_VALUE_VALUE
,
value
);
if
(
field
.
getDeType
().
equals
(
DeTypeConstants
.
DE_TIME
))
{
whereValue
=
String
.
format
(
Db2Constants
.
DATE_FORMAT
,
"'"
+
value
+
"'"
,
Db2Constants
.
DEFAULT_DATE_FORMAT
);
}
else
{
whereValue
=
String
.
format
(
Db2Constants
.
WHERE_VALUE_VALUE
,
value
);
}
}
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/provider/query/doris/DorisQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -752,68 +752,76 @@ public class DorisQueryProvider extends QueryProvider {
...
@@ -752,68 +752,76 @@ public class DorisQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
}
String
value
=
filterItemDTO
.
getValue
();
String
whereName
=
""
;
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
continue
;
// 解析origin name中有关联的字段生成sql表达式
}
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
String
whereName
=
""
;
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
String
originName
;
originName
=
String
.
format
(
DorisConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getDataeaseName
());
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
}
else
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
String
.
format
(
DorisConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getDataeaseName
());
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
DorisConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getDataeaseName
());
}
else
{
originName
=
String
.
format
(
DorisConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getDataeaseName
());
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
||
field
.
getDeExtractType
()
==
1
)
{
whereName
=
String
.
format
(
DorisConstants
.
STR_TO_DATE
,
originName
,
DorisConstants
.
DEFAULT_DATE_FORMAT
);
}
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
cast
=
String
.
format
(
DorisConstants
.
CAST
,
originName
,
DorisConstants
.
DEFAULT_INT_FORMAT
)
+
"/1000"
;
whereName
=
String
.
format
(
DorisConstants
.
FROM_UNIXTIME
,
cast
,
DorisConstants
.
DEFAULT_DATE_FORMAT
);
}
}
}
else
if
(
field
.
getDeType
()
==
0
)
{
whereName
=
String
.
format
(
DorisConstants
.
CAST
,
originName
,
DorisConstants
.
VARCHAR
);
}
else
{
whereName
=
originName
;
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
||
field
.
getDeExtractType
()
==
1
)
{
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
whereName
=
String
.
format
(
DorisConstants
.
STR_TO_DATE
,
originName
,
DorisConstants
.
DEFAULT_DATE_FORMAT
);
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
}
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
cast
=
String
.
format
(
DorisConstants
.
CAST
,
originName
,
DorisConstants
.
DEFAULT_INT_FORMAT
)
+
"/1000"
;
whereName
=
String
.
format
(
DorisConstants
.
FROM_UNIXTIME
,
cast
,
DorisConstants
.
DEFAULT_DATE_FORMAT
);
}
}
else
if
(
field
.
getDeType
()
==
0
)
{
whereName
=
String
.
format
(
DorisConstants
.
CAST
,
originName
,
DorisConstants
.
VARCHAR
);
}
else
{
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
""
;
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
whereValue
=
""
;
String
value
=
filterItemDTO
.
getValue
();
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
whereValue
=
"''"
;
String
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
""
;
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
""
;
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
}
else
{
whereValue
=
"''"
;
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
String
.
format
(
DorisConstants
.
WHERE_NUMBER_VALUE
,
value
);
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
}
else
{
whereValue
=
String
.
format
(
DorisConstants
.
WHERE_VALUE_VALUE
,
value
);
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
whereValue
=
String
.
format
(
DorisConstants
.
WHERE_NUMBER_VALUE
,
value
);
}
else
{
whereValue
=
String
.
format
(
DorisConstants
.
WHERE_VALUE_VALUE
,
value
);
}
}
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/provider/query/es/EsQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -767,63 +767,71 @@ public class EsQueryProvider extends QueryProvider {
...
@@ -767,63 +767,71 @@ public class EsQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
continue
;
}
String
whereName
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
EsSqlLConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
EsSqlLConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
EsSqlLConstants
.
CAST
,
originName
,
"timestamp"
);
}
}
String
value
=
filterItemDTO
.
getValue
();
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_INT
||
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_FLOAT
||
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_BOOL
)
{
String
whereName
=
""
;
String
cast
=
String
.
format
(
EsSqlLConstants
.
CAST
,
originName
,
"timestamp"
);
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
whereName
=
String
.
format
(
EsSqlLConstants
.
DATETIME_FORMAT
,
cast
,
EsSqlLConstants
.
DEFAULT_DATE_FORMAT
);
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
EsSqlLConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
EsSqlLConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
EsSqlLConstants
.
CAST
,
originName
,
"timestamp"
);
}
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_INT
||
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_FLOAT
||
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_BOOL
)
{
String
cast
=
String
.
format
(
EsSqlLConstants
.
CAST
,
originName
,
"timestamp"
);
whereName
=
String
.
format
(
EsSqlLConstants
.
DATETIME_FORMAT
,
cast
,
EsSqlLConstants
.
DEFAULT_DATE_FORMAT
);
}
if
(
field
.
getDeExtractType
()
==
1
)
{
whereName
=
originName
;
}
}
else
{
whereName
=
originName
;
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
""
;
whereName
=
originName
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
EsSqlLConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
List
<
String
>
strList
=
new
ArrayList
<>();
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
else
{
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
String
value
=
filterItemDTO
.
getValue
();
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereValue
=
""
;
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
EsSqlLConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -731,63 +731,72 @@ public class HiveQueryProvider extends QueryProvider {
...
@@ -731,63 +731,72 @@ public class HiveQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
continue
;
}
String
whereName
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
HiveConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
HiveConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_STRING
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
HiveConstants
.
STR_TO_DATE
,
originName
,
HiveConstants
.
DEFAULT_DATE_FORMAT
);
}
}
String
value
=
filterItemDTO
.
getValue
();
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_INT
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
whereName
=
""
;
String
cast
=
String
.
format
(
HiveConstants
.
CAST
,
originName
,
HiveConstants
.
DEFAULT_INT_FORMAT
)
+
"/1000"
;
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
whereName
=
String
.
format
(
HiveConstants
.
FROM_UNIXTIME
,
cast
,
HiveConstants
.
DEFAULT_DATE_FORMAT
);
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
HiveConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
HiveConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
}
if
(
field
.
getDeType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_STRING
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
HiveConstants
.
STR_TO_DATE
,
originName
,
HiveConstants
.
DEFAULT_DATE_FORMAT
);
}
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_INT
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
cast
=
String
.
format
(
HiveConstants
.
CAST
,
originName
,
HiveConstants
.
DEFAULT_INT_FORMAT
)
+
"/1000"
;
whereName
=
String
.
format
(
HiveConstants
.
FROM_UNIXTIME
,
cast
,
HiveConstants
.
DEFAULT_DATE_FORMAT
);
}
if
(
field
.
getDeExtractType
()
==
DeTypeConstants
.
DE_TIME
)
{
whereName
=
originName
;
}
}
else
{
whereName
=
originName
;
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
""
;
whereName
=
originName
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
HiveConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
List
<
String
>
strList
=
new
ArrayList
<>();
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
else
{
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
String
value
=
filterItemDTO
.
getValue
();
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereValue
=
""
;
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
HiveConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/provider/query/mongodb/MongoQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -710,50 +710,59 @@ public class MongoQueryProvider extends QueryProvider {
...
@@ -710,50 +710,59 @@ public class MongoQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
continue
;
}
}
String
whereName
=
""
;
String
value
=
filterItemDTO
.
getValue
();
String
originName
;
String
whereName
=
""
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
DeTypeConstants
.
DE_INT
)
{
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
// 解析origin name中有关联的字段生成sql表达式
String
whereValue
=
""
;
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
String
originName
;
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
DeTypeConstants
.
DE_TIME
)
{
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
DeTypeConstants
.
DE_INT
)
{
originName
=
String
.
format
(
MongoConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
// 解析origin name中有关联的字段生成sql表达式
}
else
{
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
originName
=
String
.
format
(
MongoConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
DeTypeConstants
.
DE_TIME
)
{
}
originName
=
String
.
format
(
MongoConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
whereName
=
originName
;
}
else
{
originName
=
String
.
format
(
MongoConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
}
}
whereName
=
originName
;
}
else
{
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
whereValue
=
""
;
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
String
value
=
filterItemDTO
.
getValue
();
whereValue
=
""
;
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
String
whereValue
=
""
;
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
"''"
;
whereValue
=
""
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
whereValue
=
""
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
whereValue
=
"''"
;
}
else
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
String
.
format
(
MongoConstants
.
WHERE_VALUE_VALUE
,
value
);
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
MongoConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -771,9 +771,6 @@ public class MysqlQueryProvider extends QueryProvider {
...
@@ -771,9 +771,6 @@ public class MysqlQueryProvider extends QueryProvider {
}
else
{
}
else
{
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
}
String
value
=
filterItemDTO
.
getValue
();
String
value
=
filterItemDTO
.
getValue
();
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereValue
=
""
;
String
whereValue
=
""
;
...
...
backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -786,69 +786,77 @@ public class OracleQueryProvider extends QueryProvider {
...
@@ -786,69 +786,77 @@ public class OracleQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
}
String
value
=
filterItemDTO
.
getValue
();
String
whereName
=
""
;
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
continue
;
// 解析origin name中有关联的字段生成sql表达式
}
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
String
whereName
=
""
;
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
String
originName
;
originName
=
String
.
format
(
OracleConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
}
else
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
String
.
format
(
OracleConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
OracleConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
OracleConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
OracleConstants
.
TO_DATE
,
originName
,
OracleConstants
.
DEFAULT_DATE_FORMAT
);
whereName
=
String
.
format
(
OracleConstants
.
TO_DATE
,
originName
,
OracleConstants
.
DEFAULT_DATE_FORMAT
);
}
}
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
cast
=
String
.
format
(
OracleConstants
.
CAST
,
originName
,
OracleConstants
.
DEFAULT_INT_FORMAT
)
+
"/1000"
;
String
cast
=
String
.
format
(
OracleConstants
.
CAST
,
originName
,
OracleConstants
.
DEFAULT_INT_FORMAT
)
+
"/1000"
;
whereName
=
String
.
format
(
OracleConstants
.
FROM_UNIXTIME
,
cast
,
OracleConstants
.
DEFAULT_DATE_FORMAT
);
whereName
=
String
.
format
(
OracleConstants
.
FROM_UNIXTIME
,
cast
,
OracleConstants
.
DEFAULT_DATE_FORMAT
);
}
}
if
(
field
.
getDeExtractType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
1
)
{
whereName
=
originName
;
}
}
else
{
whereName
=
originName
;
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
""
;
whereName
=
originName
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
}
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
whereValue
=
"''"
;
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
whereValue
=
"''"
;
}
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
}
else
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
whereValue
=
"'%"
+
value
+
"%'"
;
String
value
=
filterItemDTO
.
getValue
();
}
else
{
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
if
(
field
.
getDeType
()
==
1
)
{
String
whereValue
=
""
;
whereValue
=
String
.
format
(
OracleConstants
.
TO_DATE
,
"'"
+
value
+
"'"
,
OracleConstants
.
DEFAULT_DATE_FORMAT
);
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
}
else
{
whereValue
=
String
.
format
(
OracleConstants
.
WHERE_VALUE_VALUE
,
value
);
if
(
field
.
getDeType
()
==
1
)
{
whereValue
=
String
.
format
(
OracleConstants
.
TO_DATE
,
"'"
+
value
+
"'"
,
OracleConstants
.
DEFAULT_DATE_FORMAT
);
}
else
{
whereValue
=
String
.
format
(
OracleConstants
.
WHERE_VALUE_VALUE
,
value
);
}
}
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -762,63 +762,72 @@ public class PgQueryProvider extends QueryProvider {
...
@@ -762,63 +762,72 @@ public class PgQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
continue
;
}
String
whereName
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
PgConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
PgConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
PgConstants
.
CAST
,
originName
,
"timestamp"
);
}
}
String
value
=
filterItemDTO
.
getValue
();
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
whereName
=
""
;
String
cast
=
String
.
format
(
PgConstants
.
CAST
,
originName
,
"bigint"
);
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
whereName
=
String
.
format
(
PgConstants
.
FROM_UNIXTIME
,
cast
);
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
PgConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
PgConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
PgConstants
.
CAST
,
originName
,
"timestamp"
);
}
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
cast
=
String
.
format
(
PgConstants
.
CAST
,
originName
,
"bigint"
);
whereName
=
String
.
format
(
PgConstants
.
FROM_UNIXTIME
,
cast
);
}
if
(
field
.
getDeExtractType
()
==
1
)
{
whereName
=
originName
;
}
}
else
{
whereName
=
originName
;
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
""
;
whereName
=
originName
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
PgConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
List
<
String
>
strList
=
new
ArrayList
<>();
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
else
{
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
String
value
=
filterItemDTO
.
getValue
();
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereValue
=
""
;
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
PgConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -703,59 +703,68 @@ public class RedshiftQueryProvider extends QueryProvider {
...
@@ -703,59 +703,68 @@ public class RedshiftQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
continue
;
}
String
whereName
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
PgConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
PgConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
PgConstants
.
CAST
,
originName
,
"timestamp"
);
}
}
String
value
=
filterItemDTO
.
getValue
();
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
whereName
=
""
;
String
cast
=
String
.
format
(
PgConstants
.
CAST
,
originName
,
"bigint"
);
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
whereName
=
String
.
format
(
PgConstants
.
FROM_UNIXTIME
,
cast
);
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
PgConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
PgConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
PgConstants
.
CAST
,
originName
,
"timestamp"
);
}
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
cast
=
String
.
format
(
PgConstants
.
CAST
,
originName
,
"bigint"
);
whereName
=
String
.
format
(
PgConstants
.
FROM_UNIXTIME
,
cast
);
}
if
(
field
.
getDeExtractType
()
==
1
)
{
whereName
=
originName
;
}
}
else
{
whereName
=
originName
;
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
PgConstants
.
WHERE_VALUE_NULL
;
whereName
=
originName
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereTerm
=
String
.
format
(
whereTerm
,
originName
);
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
PgConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
List
<
String
>
strList
=
new
ArrayList
<>();
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
else
{
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
String
value
=
filterItemDTO
.
getValue
();
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereValue
=
""
;
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
PgConstants
.
WHERE_VALUE_NULL
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereTerm
=
String
.
format
(
whereTerm
,
originName
);
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
PgConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/provider/query/sqlserver/SqlserverQueryProvider.java
浏览文件 @
7052f9b9
...
@@ -796,63 +796,72 @@ public class SqlserverQueryProvider extends QueryProvider {
...
@@ -796,63 +796,72 @@ public class SqlserverQueryProvider extends QueryProvider {
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
for
(
ChartFieldCustomFilterDTO
request
:
requestList
)
{
List
<
SQLObj
>
list
=
new
ArrayList
<>();
List
<
SQLObj
>
list
=
new
ArrayList
<>();
DatasetTableField
field
=
request
.
getField
();
DatasetTableField
field
=
request
.
getField
();
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
if
(
ObjectUtils
.
isEmpty
(
field
))
{
continue
;
continue
;
}
String
whereName
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
SqlServerSQLConstants
.
STRING_TO_DATE
,
originName
);
}
}
String
value
=
filterItemDTO
.
getValue
();
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
whereName
=
""
;
String
cast
=
String
.
format
(
SqlServerSQLConstants
.
LONG_TO_DATE
,
originName
+
"/1000"
);
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
whereName
=
String
.
format
(
SqlServerSQLConstants
.
FROM_UNIXTIME
,
cast
);
String
whereValue
=
""
;
String
originName
;
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
2
)
{
// 解析origin name中有关联的字段生成sql表达式
originName
=
calcFieldRegex
(
field
.
getOriginName
(),
tableObj
);
}
else
if
(
ObjectUtils
.
isNotEmpty
(
field
.
getExtField
())
&&
field
.
getExtField
()
==
1
)
{
originName
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
else
{
originName
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_FIX
,
tableObj
.
getTableAlias
(),
field
.
getOriginName
());
}
}
if
(
field
.
getDeType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
1
)
{
if
(
field
.
getDeExtractType
()
==
0
||
field
.
getDeExtractType
()
==
5
)
{
whereName
=
String
.
format
(
SqlServerSQLConstants
.
STRING_TO_DATE
,
originName
);
}
if
(
field
.
getDeExtractType
()
==
2
||
field
.
getDeExtractType
()
==
3
||
field
.
getDeExtractType
()
==
4
)
{
String
cast
=
String
.
format
(
SqlServerSQLConstants
.
LONG_TO_DATE
,
originName
+
"/1000"
);
whereName
=
String
.
format
(
SqlServerSQLConstants
.
FROM_UNIXTIME
,
cast
);
}
if
(
field
.
getDeExtractType
()
==
1
)
{
whereName
=
originName
;
}
}
else
{
whereName
=
originName
;
whereName
=
originName
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
}
else
{
whereValue
=
""
;
whereName
=
originName
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
SqlServerSQLConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
}
List
<
String
>
strList
=
new
ArrayList
<>();
if
(
StringUtils
.
equalsIgnoreCase
(
request
.
getFilterType
(),
"enum"
))
{
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
request
.
getEnumCheckField
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
whereName
+
" IN ('"
+
String
.
join
(
"','"
,
request
.
getEnumCheckField
())
+
"'))"
);
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
else
{
List
<
ChartCustomFilterItemDTO
>
filter
=
request
.
getFilter
();
for
(
ChartCustomFilterItemDTO
filterItemDTO
:
filter
)
{
String
value
=
filterItemDTO
.
getValue
();
String
whereTerm
=
transMysqlFilterTerm
(
filterItemDTO
.
getTerm
());
String
whereValue
=
""
;
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_null"
))
{
whereValue
=
""
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"not_empty"
))
{
whereValue
=
"''"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"in"
))
{
whereValue
=
"('"
+
StringUtils
.
join
(
value
,
"','"
)
+
"')"
;
}
else
if
(
StringUtils
.
containsIgnoreCase
(
filterItemDTO
.
getTerm
(),
"like"
))
{
whereValue
=
"'%"
+
value
+
"%'"
;
}
else
{
whereValue
=
String
.
format
(
SqlServerSQLConstants
.
WHERE_VALUE_VALUE
,
value
);
}
list
.
add
(
SQLObj
.
builder
()
.
whereField
(
whereName
)
.
whereTermAndValue
(
whereTerm
+
whereValue
)
.
build
());
}
List
<
String
>
strList
=
new
ArrayList
<>();
list
.
forEach
(
ele
->
strList
.
add
(
ele
.
getWhereField
()
+
" "
+
ele
.
getWhereTermAndValue
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
res
.
add
(
"("
+
String
.
join
(
" "
+
getLogic
(
request
.
getLogic
())
+
" "
,
strList
)
+
")"
);
}
}
}
}
}
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
return
CollectionUtils
.
isNotEmpty
(
res
)
?
"("
+
String
.
join
(
" AND "
,
res
)
+
")"
:
null
;
...
...
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
7052f9b9
...
@@ -509,7 +509,7 @@ public class ChartViewService {
...
@@ -509,7 +509,7 @@ public class ChartViewService {
if
(
StringUtils
.
equalsIgnoreCase
(
resultData
,
"sub"
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
resultData
,
"sub"
))
{
item
[
dataIndex
]
=
new
BigDecimal
(
cValue
).
subtract
(
new
BigDecimal
(
lastValue
)).
toString
();
item
[
dataIndex
]
=
new
BigDecimal
(
cValue
).
subtract
(
new
BigDecimal
(
lastValue
)).
toString
();
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
resultData
,
"percent"
))
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
resultData
,
"percent"
))
{
if
(
Integer
.
parseInt
(
lastValue
)
==
0
)
{
if
(
new
BigDecimal
(
lastValue
).
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
item
[
dataIndex
]
=
null
;
item
[
dataIndex
]
=
null
;
}
else
{
}
else
{
item
[
dataIndex
]
=
new
BigDecimal
(
cValue
)
item
[
dataIndex
]
=
new
BigDecimal
(
cValue
)
...
...
frontend/src/components/canvas/components/Editor/ComponentWrapper.vue
浏览文件 @
7052f9b9
...
@@ -169,11 +169,7 @@ export default {
...
@@ -169,11 +169,7 @@ export default {
this
.
$store
.
commit
(
'setCurComponent'
,
{
component
:
this
.
config
,
index
:
this
.
index
})
this
.
$store
.
commit
(
'setCurComponent'
,
{
component
:
this
.
config
,
index
:
this
.
index
})
},
},
showViewDetails
()
{
showViewDetails
()
{
if
(
this
.
terminal
===
'pc'
)
{
this
.
$refs
.
wrapperChild
.
openChartDetailsDialog
()
this
.
$refs
.
wrapperChild
.
openChartDetailsDialog
()
}
else
{
this
.
previewVisible
=
true
}
},
},
closePreview
()
{
closePreview
()
{
this
.
previewVisible
=
false
this
.
previewVisible
=
false
...
...
frontend/src/components/canvas/components/Editor/Preview.vue
浏览文件 @
7052f9b9
...
@@ -266,7 +266,7 @@ export default {
...
@@ -266,7 +266,7 @@ export default {
if
(
this
.
terminal
===
'pc'
)
{
if
(
this
.
terminal
===
'pc'
)
{
this
.
chartDetailsVisible
=
true
this
.
chartDetailsVisible
=
true
}
else
{
}
else
{
this
.
mobileChartDetailsVisible
this
.
mobileChartDetailsVisible
=
true
}
}
},
},
exportExcel
()
{
exportExcel
()
{
...
...
frontend/src/components/canvas/custom-component/UserView.vue
浏览文件 @
7052f9b9
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
:chart=
"chart"
:chart=
"chart"
:track-menu=
"trackMenu"
:track-menu=
"trackMenu"
:search-count=
"searchCount"
:search-count=
"searchCount"
:terminal-type=
"scaleCoefficientType"
@
onChartClick=
"chartClick"
@
onChartClick=
"chartClick"
@
onJumpClick=
"jumpClick"
@
onJumpClick=
"jumpClick"
/>
/>
...
@@ -141,10 +142,17 @@ export default {
...
@@ -141,10 +142,17 @@ export default {
},
},
computed
:
{
computed
:
{
scaleCoefficient
()
{
scaleCoefficient
()
{
if
(
this
.
terminal
===
'pc'
)
{
if
(
this
.
terminal
===
'pc'
&&
!
this
.
mobileLayoutStatus
)
{
return
1.1
return
1.1
}
else
{
}
else
{
return
4
return
4.5
}
},
scaleCoefficientType
()
{
if
(
this
.
terminal
===
'pc'
&&
!
this
.
mobileLayoutStatus
)
{
return
'pc'
}
else
{
return
'mobile'
}
}
},
},
editBarViewShowFlag
()
{
editBarViewShowFlag
()
{
...
@@ -227,7 +235,8 @@ export default {
...
@@ -227,7 +235,8 @@ export default {
'nowPanelTrackInfo'
,
'nowPanelTrackInfo'
,
'nowPanelJumpInfo'
,
'nowPanelJumpInfo'
,
'publicLinkStatus'
,
'publicLinkStatus'
,
'previewCanvasScale'
'previewCanvasScale'
,
'mobileLayoutStatus'
])
])
},
},
...
@@ -310,17 +319,18 @@ export default {
...
@@ -310,17 +319,18 @@ export default {
const
scale
=
Math
.
min
(
this
.
previewCanvasScale
.
scalePointWidth
,
this
.
previewCanvasScale
.
scalePointHeight
)
*
this
.
scaleCoefficient
const
scale
=
Math
.
min
(
this
.
previewCanvasScale
.
scalePointWidth
,
this
.
previewCanvasScale
.
scalePointHeight
)
*
this
.
scaleCoefficient
const
customAttrChart
=
JSON
.
parse
(
this
.
sourceCustomAttrStr
)
const
customAttrChart
=
JSON
.
parse
(
this
.
sourceCustomAttrStr
)
const
customStyleChart
=
JSON
.
parse
(
this
.
sourceCustomStyleStr
)
const
customStyleChart
=
JSON
.
parse
(
this
.
sourceCustomStyleStr
)
recursionTransObj
(
customAttrTrans
,
customAttrChart
,
scale
)
recursionTransObj
(
customAttrTrans
,
customAttrChart
,
scale
,
this
.
scaleCoefficientType
)
recursionTransObj
(
customStyleTrans
,
customStyleChart
,
scale
)
recursionTransObj
(
customStyleTrans
,
customStyleChart
,
scale
,
this
.
scaleCoefficientType
)
// 移动端地图标签不显示
if
(
this
.
chart
.
type
===
'map'
&&
this
.
scaleCoefficientType
===
'mobile'
)
{
customAttrChart
.
label
.
show
=
false
}
this
.
chart
=
{
this
.
chart
=
{
...
this
.
chart
,
...
this
.
chart
,
customAttr
:
JSON
.
stringify
(
customAttrChart
),
customAttr
:
JSON
.
stringify
(
customAttrChart
),
customStyle
:
JSON
.
stringify
(
customStyleChart
)
customStyle
:
JSON
.
stringify
(
customStyleChart
)
}
}
// console.log('customAttrChartSource:' + JSON.stringify(JSON.parse(this.sourceCustomAttrStr)))
// console.log('customAttrChart:' + JSON.stringify(customAttrChart))
// console.log('customStyleChartSource:' + JSON.stringify(JSON.parse(this.sourceCustomStyleStr)))
// console.log('customStyleChart:' + JSON.stringify(customStyleChart))
this
.
mergeStyle
()
this
.
mergeStyle
()
},
},
mergeStyle
()
{
mergeStyle
()
{
...
...
frontend/src/components/canvas/utils/style.js
浏览文件 @
7052f9b9
...
@@ -150,27 +150,36 @@ export const customStyleTrans = {
...
@@ -150,27 +150,36 @@ export const customStyleTrans = {
}
}
}
}
// 移动端特殊属性
export
const
mobileSpecialProps
=
{
'lineWidth'
:
3
,
// 线宽固定值
'lineSymbolSize'
:
5
// 折点固定值
}
export
function
getScaleValue
(
propValue
,
scale
)
{
export
function
getScaleValue
(
propValue
,
scale
)
{
const
propValueTemp
=
Math
.
round
(
propValue
*
scale
)
const
propValueTemp
=
Math
.
round
(
propValue
*
scale
)
return
propValueTemp
>
1
?
propValueTemp
:
1
return
propValueTemp
>
1
?
propValueTemp
:
1
}
}
export
function
recursionTransObj
(
template
,
infoObj
,
scale
)
{
export
function
recursionTransObj
(
template
,
infoObj
,
scale
,
terminal
)
{
// console.log('recursionObj++')
for
(
const
templateKey
in
template
)
{
for
(
const
templateKey
in
template
)
{
// 如果是数组 进行赋值计算
// 如果是数组 进行赋值计算
if
(
template
[
templateKey
]
instanceof
Array
)
{
if
(
template
[
templateKey
]
instanceof
Array
)
{
template
[
templateKey
].
forEach
(
templateProp
=>
{
template
[
templateKey
].
forEach
(
templateProp
=>
{
if
(
infoObj
[
templateKey
]
&&
infoObj
[
templateKey
][
templateProp
])
{
if
(
infoObj
[
templateKey
]
&&
infoObj
[
templateKey
][
templateProp
])
{
const
afterValue
=
getScaleValue
(
infoObj
[
templateKey
][
templateProp
],
scale
)
// 移动端特殊属性值设置
console
.
log
(
templateKey
+
'.'
+
templateProp
+
'='
+
infoObj
[
templateKey
][
templateProp
]
+
';scale:'
+
scale
+
',after:'
+
afterValue
)
if
(
terminal
===
'mobile'
&&
mobileSpecialProps
[
templateProp
]
!==
undefined
)
{
infoObj
[
templateKey
][
templateProp
]
=
afterValue
// console.log('mobile:' + templateProp + mobileSpecialProps[templateProp])
infoObj
[
templateKey
][
templateProp
]
=
mobileSpecialProps
[
templateProp
]
}
else
{
infoObj
[
templateKey
][
templateProp
]
=
getScaleValue
(
infoObj
[
templateKey
][
templateProp
],
scale
)
}
}
}
})
})
}
else
{
}
else
{
// 如果是对象 继续进行递归
// 如果是对象 继续进行递归
if
(
infoObj
[
templateKey
])
{
if
(
infoObj
[
templateKey
])
{
recursionTransObj
(
template
[
templateKey
],
infoObj
[
templateKey
],
scale
)
recursionTransObj
(
template
[
templateKey
],
infoObj
[
templateKey
],
scale
,
terminal
)
}
}
}
}
}
}
...
...
frontend/src/views/chart/chart/scatter/scatter.js
浏览文件 @
7052f9b9
...
@@ -2,8 +2,10 @@ import { hexColorToRGBA } from '@/views/chart/chart/util'
...
@@ -2,8 +2,10 @@ import { hexColorToRGBA } from '@/views/chart/chart/util'
import
{
componentStyle
}
from
'../common/common'
import
{
componentStyle
}
from
'../common/common'
let
bubbleArray
=
[]
let
bubbleArray
=
[]
let
terminalType
=
'pc'
export
function
baseScatterOption
(
chart_option
,
chart
)
{
export
function
baseScatterOption
(
chart_option
,
chart
,
terminal
=
'pc'
)
{
terminalType
=
terminal
// 处理shape attr
// 处理shape attr
let
customAttr
=
{}
let
customAttr
=
{}
if
(
chart
.
customAttr
)
{
if
(
chart
.
customAttr
)
{
...
@@ -59,7 +61,7 @@ export function baseScatterOption(chart_option, chart) {
...
@@ -59,7 +61,7 @@ export function baseScatterOption(chart_option, chart) {
}
}
const
funcSize
=
function
(
data
)
{
const
funcSize
=
function
(
data
)
{
const
k
=
8
0
const
k
=
terminalType
===
'pc'
?
80
:
3
0
const
max
=
Math
.
max
(...
bubbleArray
)
const
max
=
Math
.
max
(...
bubbleArray
)
return
(
data
[
2
]
/
max
)
*
k
return
(
data
[
2
]
/
max
)
*
k
}
}
frontend/src/views/chart/components/ChartComponent.vue
浏览文件 @
7052f9b9
...
@@ -60,6 +60,10 @@ export default {
...
@@ -60,6 +60,10 @@ export default {
type
:
Number
,
type
:
Number
,
required
:
false
,
required
:
false
,
default
:
0
default
:
0
},
terminalType
:
{
type
:
String
,
default
:
'pc'
}
}
},
},
data
()
{
data
()
{
...
@@ -154,7 +158,7 @@ export default {
...
@@ -154,7 +158,7 @@ export default {
}
else
if
(
chart
.
type
===
'gauge'
)
{
}
else
if
(
chart
.
type
===
'gauge'
)
{
chart_option
=
baseGaugeOption
(
JSON
.
parse
(
JSON
.
stringify
(
BASE_GAUGE
)),
chart
)
chart_option
=
baseGaugeOption
(
JSON
.
parse
(
JSON
.
stringify
(
BASE_GAUGE
)),
chart
)
}
else
if
(
chart
.
type
===
'scatter'
)
{
}
else
if
(
chart
.
type
===
'scatter'
)
{
chart_option
=
baseScatterOption
(
JSON
.
parse
(
JSON
.
stringify
(
BASE_SCATTER
)),
chart
)
chart_option
=
baseScatterOption
(
JSON
.
parse
(
JSON
.
stringify
(
BASE_SCATTER
)),
chart
,
this
.
terminalType
)
}
else
if
(
chart
.
type
===
'treemap'
)
{
}
else
if
(
chart
.
type
===
'treemap'
)
{
chart_option
=
baseTreemapOption
(
JSON
.
parse
(
JSON
.
stringify
(
BASE_TREEMAP
)),
chart
)
chart_option
=
baseTreemapOption
(
JSON
.
parse
(
JSON
.
stringify
(
BASE_TREEMAP
)),
chart
)
}
else
if
(
chart
.
type
===
'chart-mix'
)
{
}
else
if
(
chart
.
type
===
'chart-mix'
)
{
...
...
frontend/src/views/chart/components/filter/ResultFilterEditor.vue
浏览文件 @
7052f9b9
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
<div
style=
"display: inline-block;"
>
<div
style=
"display: inline-block;"
>
<el-button
icon=
"el-icon-plus"
circle
size=
"mini"
style=
"margin-bottom: 10px;"
@
click=
"addFilter"
/>
<el-button
icon=
"el-icon-plus"
circle
size=
"mini"
style=
"margin-bottom: 10px;"
@
click=
"addFilter"
/>
<el-radio-group
<el-radio-group
v-show=
"item.filter && item.filter.length > 1"
v-model=
"logic"
v-model=
"logic"
size=
"mini"
size=
"mini"
style=
"margin-left: 10px;"
style=
"margin-left: 10px;"
...
@@ -61,6 +62,7 @@
...
@@ -61,6 +62,7 @@
<el-select
<el-select
v-model=
"enumCheckField"
v-model=
"enumCheckField"
filterable
filterable
collapse-tags
multiple
multiple
:placeholder=
"$t('chart.pls_slc')"
:placeholder=
"$t('chart.pls_slc')"
size=
"mini"
size=
"mini"
...
@@ -215,6 +217,7 @@ export default {
...
@@ -215,6 +217,7 @@ export default {
mounted
()
{
mounted
()
{
this
.
initOptions
()
this
.
initOptions
()
this
.
init
()
this
.
init
()
this
.
initEnumOptions
()
},
},
methods
:
{
methods
:
{
initOptions
()
{
initOptions
()
{
...
@@ -232,10 +235,14 @@ export default {
...
@@ -232,10 +235,14 @@ export default {
this
.
logic
=
this
.
item
.
logic
this
.
logic
=
this
.
item
.
logic
this
.
filterType
=
this
.
item
.
filterType
this
.
filterType
=
this
.
item
.
filterType
this
.
enumCheckField
=
this
.
item
.
enumCheckField
this
.
enumCheckField
=
this
.
item
.
enumCheckField
// 查找枚举的
},
multFieldValues
([
this
.
item
.
id
]).
then
(
res
=>
{
initEnumOptions
()
{
this
.
fieldOptions
=
this
.
optionDatas
(
res
.
data
)
// 查找枚举值
})
if
(
this
.
item
.
deType
===
0
||
this
.
item
.
deType
===
5
)
{
multFieldValues
([
this
.
item
.
id
]).
then
(
res
=>
{
this
.
fieldOptions
=
this
.
optionDatas
(
res
.
data
)
})
}
},
},
optionDatas
(
datas
)
{
optionDatas
(
datas
)
{
if
(
!
datas
)
return
null
if
(
!
datas
)
return
null
...
...
frontend/src/views/panel/edit/index.vue
浏览文件 @
7052f9b9
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
<el-row
v-if=
"mobileLayoutStatus"
class=
"mobile_canvas_main"
>
<el-row
v-if=
"mobileLayoutStatus"
class=
"mobile_canvas_main"
>
<el-col
:span=
"8"
class=
"this_mobile_canvas_cell"
>
<el-col
:span=
"8"
class=
"this_mobile_canvas_cell"
>
<div
<div
v-proportion=
"2.
5
"
v-proportion=
"2.
1
"
:style=
"customCanvasMobileStyle"
:style=
"customCanvasMobileStyle"
class=
"this_mobile_canvas"
class=
"this_mobile_canvas"
@
drop=
"handleDrop"
@
drop=
"handleDrop"
...
@@ -955,10 +955,10 @@ export default {
...
@@ -955,10 +955,10 @@ export default {
.this_mobile_canvas
{
.this_mobile_canvas
{
border-radius
:
30px
;
border-radius
:
30px
;
min-width
:
28
0px
;
min-width
:
30
0px
;
max-width
:
3
0
0px
;
max-width
:
3
5
0px
;
min-height
:
7
00px
;
min-height
:
6
00px
;
max-height
:
7
5
0px
;
max-height
:
7
0
0px
;
overflow
:
hidden
;
overflow
:
hidden
;
background-color
:
#000000
;
background-color
:
#000000
;
background-size
:
100%
100%
!
important
;
background-size
:
100%
100%
!
important
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论