Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
eaf774ae
提交
eaf774ae
authored
4月 28, 2022
作者:
junjun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复关联数据集缺失schema
上级
68d40f40
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
3 行删除
+18
-3
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+18
-3
没有找到文件。
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
eaf774ae
package
io
.
dataease
.
service
.
dataset
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
io.dataease.auth.annotation.DeCleaner
;
import
io.dataease.auth.api.dto.CurrentUserDto
;
...
...
@@ -960,6 +962,8 @@ public class DataSetTableService {
res
.
put
(
"data"
,
jsonArray
);
return
res
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
e
.
getMessage
());
return
res
;
}
}
...
...
@@ -1321,6 +1325,17 @@ public class DataSetTableService {
DatasourceTypes
datasourceTypes
=
DatasourceTypes
.
valueOf
(
ds
.
getType
());
String
keyword
=
datasourceTypes
.
getKeywordPrefix
()
+
"%s"
+
datasourceTypes
.
getKeywordSuffix
();
String
configuration
=
ds
.
getConfiguration
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
configuration
);
String
schema
=
jsonObject
.
getString
(
"schema"
);
String
joinPrefix
=
""
;
if
(
StringUtils
.
isNotEmpty
(
schema
)
&&
(
StringUtils
.
equalsIgnoreCase
(
ds
.
getType
(),
DatasourceTypes
.
db2
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
ds
.
getType
(),
DatasourceTypes
.
sqlServer
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
ds
.
getType
(),
DatasourceTypes
.
oracle
.
getType
())
||
StringUtils
.
equalsIgnoreCase
(
ds
.
getType
(),
DatasourceTypes
.
pg
.
getType
())))
{
joinPrefix
=
String
.
format
(
keyword
,
schema
)
+
"."
;
}
List
<
UnionDTO
>
union
=
dataTableInfoDTO
.
getUnion
();
// 所有选中的字段,即select后的查询字段
Map
<
String
,
String
[]>
checkedInfo
=
new
LinkedHashMap
<>();
...
...
@@ -1386,7 +1401,7 @@ public class DataSetTableService {
String
currentTableName
=
new
Gson
().
fromJson
(
currentTable
.
getInfo
(),
DataTableInfoDTO
.
class
)
.
getTable
();
join
.
append
(
" "
).
append
(
joinType
).
append
(
" "
).
append
(
String
.
format
(
keyword
,
currentTableName
))
join
.
append
(
" "
).
append
(
joinType
).
append
(
" "
).
append
(
joinPrefix
).
append
(
String
.
format
(
keyword
,
currentTableName
))
.
append
(
" ON "
);
for
(
int
i
=
0
;
i
<
unionParamDTO
.
getUnionFields
().
size
();
i
++)
{
UnionItemDTO
unionItemDTO
=
unionParamDTO
.
getUnionFields
().
get
(
i
);
...
...
@@ -1409,13 +1424,13 @@ public class DataSetTableService {
if
(
StringUtils
.
isEmpty
(
f
))
{
DEException
.
throwException
(
Translator
.
get
(
"i18n_union_ds_no_checked"
));
}
sql
=
MessageFormat
.
format
(
"SELECT {0} FROM {1}"
,
f
,
String
.
format
(
keyword
,
tableName
))
+
join
.
toString
();
sql
=
MessageFormat
.
format
(
"SELECT {0} FROM {1}"
,
f
,
joinPrefix
+
String
.
format
(
keyword
,
tableName
))
+
join
.
toString
();
}
else
{
String
f
=
StringUtils
.
join
(
checkedInfo
.
get
(
tableName
),
","
);
if
(
StringUtils
.
isEmpty
(
f
))
{
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_union_ds_no_checked"
));
}
sql
=
MessageFormat
.
format
(
"SELECT {0} FROM {1}"
,
f
,
String
.
format
(
keyword
,
tableName
));
sql
=
MessageFormat
.
format
(
"SELECT {0} FROM {1}"
,
f
,
joinPrefix
+
String
.
format
(
keyword
,
tableName
));
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"sql"
,
sql
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论