Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
f8bc421a
Unverified
提交
f8bc421a
authored
7月 15, 2021
作者:
XiaJunjie2020
提交者:
GitHub
7月 15, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #242 from dataease/pr@dev@feat_同数据源直连数据集之间支持数据关联
feat: 同数据源直连数据集之间支持数据关联
上级
1d927404
a68323de
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
50 行增加
和
19 行删除
+50
-19
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+13
-0
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+0
-0
en.js
frontend/src/lang/en.js
+2
-1
tw.js
frontend/src/lang/tw.js
+2
-1
zh.js
frontend/src/lang/zh.js
+2
-1
AddCustom.vue
frontend/src/views/dataset/add/AddCustom.vue
+5
-5
DatasetGroupSelector.vue
frontend/src/views/dataset/common/DatasetGroupSelector.vue
+3
-1
FieldEdit.vue
frontend/src/views/dataset/data/FieldEdit.vue
+5
-5
UnionView.vue
frontend/src/views/dataset/data/UnionView.vue
+15
-2
ViewTable.vue
frontend/src/views/dataset/data/ViewTable.vue
+3
-3
没有找到文件。
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
f8bc421a
...
...
@@ -20,12 +20,14 @@ import io.dataease.datasource.provider.ProviderFactory;
import
io.dataease.datasource.request.DatasourceRequest
;
import
io.dataease.datasource.service.DatasourceService
;
import
io.dataease.dto.chart.*
;
import
io.dataease.dto.dataset.DataSetTableUnionDTO
;
import
io.dataease.dto.dataset.DataTableInfoDTO
;
import
io.dataease.i18n.Translator
;
import
io.dataease.listener.util.CacheUtils
;
import
io.dataease.provider.QueryProvider
;
import
io.dataease.service.dataset.DataSetTableFieldsService
;
import
io.dataease.service.dataset.DataSetTableService
;
import
io.dataease.service.dataset.DataSetTableUnionService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -56,6 +58,8 @@ public class ChartViewService {
private
DataSetTableFieldsService
dataSetTableFieldsService
;
@Resource
private
ExtChartGroupMapper
extChartGroupMapper
;
@Resource
private
DataSetTableUnionService
dataSetTableUnionService
;
//默认使用非公平
private
ReentrantLock
lock
=
new
ReentrantLock
();
...
...
@@ -197,6 +201,15 @@ public class ChartViewService {
}
else
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmp
(
dataTableInfoDTO
.
getSql
(),
xAxis
,
yAxis
,
customFilter
,
extFilterList
));
}
}
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
()))
{
datasourceRequest
.
setQuery
(
qp
.
getSQLSummaryAsTmp
(
sql
,
yAxis
,
customFilter
,
extFilterList
));
}
else
{
datasourceRequest
.
setQuery
(
qp
.
getSQLAsTmp
(
sql
,
xAxis
,
yAxis
,
customFilter
,
extFilterList
));
}
}
data
=
datasourceProvider
.
getData
(
datasourceRequest
);
/**
...
...
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
f8bc421a
差异被折叠。
点击展开。
frontend/src/lang/en.js
浏览文件 @
f8bc421a
...
...
@@ -954,7 +954,8 @@ export default {
left_join
:
'LEFT JOIN'
,
right_join
:
'RIGHT JOIN'
,
inner_join
:
'INNER JOIN'
,
full_join
:
'FULL JOIN'
full_join
:
'FULL JOIN'
,
can_not_union_diff_datasource
:
'Union dataset must have same data source'
},
datasource
:
{
datasource
:
'Data Source'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
f8bc421a
...
...
@@ -954,7 +954,8 @@ export default {
left_join
:
'左連接'
,
right_join
:
'右連接'
,
inner_join
:
'內連接'
,
full_join
:
'全連接'
full_join
:
'全連接'
,
can_not_union_diff_datasource
:
'被關聯數據集必須與當前數據集的數據源一致'
},
datasource
:
{
datasource
:
'數據源'
,
...
...
frontend/src/lang/zh.js
浏览文件 @
f8bc421a
...
...
@@ -954,7 +954,8 @@ export default {
left_join
:
'左连接'
,
right_join
:
'右连接'
,
inner_join
:
'内连接'
,
full_join
:
'全连接'
full_join
:
'全连接'
,
can_not_union_diff_datasource
:
'被关联数据集必须与当前数据集的数据源一致'
},
datasource
:
{
datasource
:
'数据源'
,
...
...
frontend/src/views/dataset/add/AddCustom.vue
浏览文件 @
f8bc421a
...
...
@@ -23,7 +23,7 @@
</el-row>
<el-col
style=
"display: flex;flex-direction: row"
>
<el-col
class=
"panel-height"
style=
"width: 220px;border-right:solid 1px #dcdfe6;border-top:solid 1px #dcdfe6;padding-right: 15px;overflow-y: auto;"
>
<dataset-group-selector
:custom-type=
"customType"
:table=
"table"
:
mode=
"1"
:
checked-list=
"checkedList"
:union-data=
"unionData"
@
getTable=
"getTable"
/>
<dataset-group-selector
:custom-type=
"customType"
:table=
"table"
:checked-list=
"checkedList"
:union-data=
"unionData"
@
getTable=
"getTable"
/>
</el-col>
<el-col
class=
"panel-height"
style=
"width: 235px;border-top:solid 1px #dcdfe6;padding: 0 15px;overflow-y: auto;"
>
<dataset-custom-field
:table=
"table"
:checked-list=
"checkedList"
@
getChecked=
"getChecked"
/>
...
...
@@ -151,9 +151,9 @@ export default {
id
:
this
.
param
.
tableId
,
name
:
this
.
name
,
sceneId
:
this
.
param
.
id
,
dataSourceId
:
null
,
dataSourceId
:
this
.
param
.
tableId
?
this
.
param
.
table
.
dataSourceId
:
this
.
table
.
dataSourceId
,
type
:
'custom'
,
mode
:
1
,
mode
:
this
.
param
.
tableId
?
this
.
param
.
table
.
mode
:
this
.
table
.
mode
,
info
:
'{"list":'
+
JSON
.
stringify
(
this
.
checkedList
)
+
'}'
}
post
(
'/dataset/table/customPreview'
,
table
).
then
(
response
=>
{
...
...
@@ -202,9 +202,9 @@ export default {
id
:
this
.
param
.
tableId
,
name
:
this
.
name
,
sceneId
:
this
.
param
.
id
,
dataSourceId
:
null
,
dataSourceId
:
this
.
table
.
dataSourceId
,
type
:
'custom'
,
mode
:
1
,
mode
:
this
.
table
.
mode
,
info
:
'{"list":'
+
JSON
.
stringify
(
this
.
checkedList
)
+
'}'
}
post
(
'/dataset/table/update'
,
table
).
then
(
response
=>
{
...
...
frontend/src/views/dataset/common/DatasetGroupSelector.vue
浏览文件 @
f8bc421a
...
...
@@ -265,7 +265,9 @@ export default {
mode
:
this
.
mode
<
0
?
null
:
this
.
mode
,
typeFilter
:
this
.
customType
?
this
.
customType
:
null
},
false
).
then
(
response
=>
{
this
.
tables
=
response
.
data
this
.
tables
=
response
.
data
.
filter
(
ele
=>
{
return
!
(
ele
.
mode
===
0
&&
ele
.
type
===
'sql'
)
})
for
(
let
i
=
0
;
i
<
this
.
tables
.
length
;
i
++
)
{
if
(
this
.
tables
[
i
].
mode
===
1
&&
this
.
kettleRunning
===
false
)
{
this
.
$set
(
this
.
tables
[
i
],
'disabled'
,
true
)
...
...
frontend/src/views/dataset/data/FieldEdit.vue
浏览文件 @
f8bc421a
...
...
@@ -81,16 +81,16 @@
</el-table-column>
<el-table-column
property=
"originName"
:label=
"$t('dataset.field_origin_name')"
width=
"100"
>
<
template
slot-scope=
"scope"
>
<span
:title=
"scope.row.originName"
class=
"field-class"
style=
"
display: inline-block;
width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
>
{{
scope
.
row
.
originName
}}
<span
:title=
"scope.row.originName"
class=
"field-class"
style=
"width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
>
<span
style=
"font-size: 12px;"
>
{{
scope
.
row
.
originName
}}
</span>
</span>
</
template
>
</el-table-column>
<el-table-column
property=
"groupType"
:label=
"$t('dataset.field_group_type')"
width=
"180"
>
<
template
slot-scope=
"scope"
>
<el-radio-group
v-model=
"scope.row.groupType"
>
<el-radio
label=
"d"
>
{{
$t
(
'chart.dimension'
)
}}
</el-radio
>
<el-radio
label=
"q"
>
{{
$t
(
'chart.quota'
)
}}
</el-radio
>
<el-radio-group
v-model=
"scope.row.groupType"
size=
"mini"
>
<el-radio
-button
label=
"d"
>
{{
$t
(
'chart.dimension'
)
}}
</el-radio-button
>
<el-radio
-button
label=
"q"
>
{{
$t
(
'chart.quota'
)
}}
</el-radio-button
>
</el-radio-group>
</
template
>
</el-table-column>
...
...
frontend/src/views/dataset/data/UnionView.vue
浏览文件 @
f8bc421a
...
...
@@ -94,7 +94,7 @@
<el-radio
class=
"union-relation-css"
label=
"1:N"
>
{{ $t('dataset.left_join') }}
</el-radio>
<el-radio
class=
"union-relation-css"
label=
"N:1"
>
{{ $t('dataset.right_join') }}
</el-radio>
<el-radio
class=
"union-relation-css"
label=
"1:1"
>
{{ $t('dataset.inner_join') }}
</el-radio>
<
el-radio
class=
"union-relation-css"
label=
"N:N"
>
{{ $t('dataset.full_join') }}
</el-radio
>
<
!-- <el-radio class="union-relation-css" label="N:N">{{ $t('dataset.full_join') }}</el-radio>--
>
</el-radio-group>
</el-col>
...
...
@@ -105,7 +105,7 @@
width=
"500"
trigger=
"click"
>
<dataset-group-selector-tree
:fix-height=
"true"
show-mode=
"union"
:custom-type=
"customType"
:mode=
"
1
"
@
getTable=
"getTable"
/>
<dataset-group-selector-tree
:fix-height=
"true"
show-mode=
"union"
:custom-type=
"customType"
:mode=
"
table.mode
"
@
getTable=
"getTable"
/>
<el-button
slot=
"reference"
size=
"mini"
style=
"width: 100%;"
>
<p
class=
"table-name-css"
:title=
"targetTable.name || $t('dataset.pls_slc_union_table')"
>
{{ targetTable.name || $t('dataset.pls_slc_union_table') }}
</p>
</el-button>
...
...
@@ -204,6 +204,9 @@ export default {
},
initUnion
()
{
if
(
this
.
table
.
id
)
{
if
(
this
.
table
.
mode
===
0
)
{
this
.
customType
=
[
'db'
]
}
post
(
'dataset/union/listByTableId/'
+
this
.
table
.
id
,
{}).
then
(
response
=>
{
// console.log(response)
this
.
unionData
=
response
.
data
...
...
@@ -301,6 +304,16 @@ export default {
})
return
}
if
(
this
.
table
.
mode
===
0
)
{
if
(
param
.
dataSourceId
!==
this
.
table
.
dataSourceId
)
{
this
.
$message
({
type
:
'error'
,
message
:
this
.
$t
(
'dataset.can_not_union_diff_datasource'
),
showClose
:
true
})
return
}
}
this
.
targetTable
=
param
this
.
union
.
targetTableId
=
param
.
id
this
.
union
.
targetTableFieldId
=
''
...
...
frontend/src/views/dataset/data/ViewTable.vue
浏览文件 @
f8bc421a
...
...
@@ -48,7 +48,7 @@
<el-tab-pane
:label=
"$t('dataset.data_preview')"
name=
"dataPreview"
>
<tab-data-preview
:param=
"param"
:table=
"table"
:fields=
"fields"
:data=
"data"
:page=
"page"
:form=
"tableViewRowForm"
@
reSearch=
"reSearch"
/>
</el-tab-pane>
<el-tab-pane
v-if=
"table.type !== 'custom'
&& table.mode === 1
"
:label=
"$t('dataset.join_view')"
name=
"joinView"
>
<el-tab-pane
v-if=
"table.type !== 'custom'"
:label=
"$t('dataset.join_view')"
name=
"joinView"
>
<union-view
:param=
"param"
:table=
"table"
/>
</el-tab-pane>
<el-tab-pane
v-if=
"table.mode === 1 && (table.type === 'db' || table.type === 'sql')"
:label=
"$t('dataset.update_info')"
name=
"updateInfo"
>
...
...
@@ -156,10 +156,10 @@ export default {
},
editSql
()
{
this
.
$emit
(
'switchComponent'
,
{
name
:
'AddSQL'
,
param
:
{
id
:
this
.
table
.
sceneId
,
tableId
:
this
.
table
.
id
}})
this
.
$emit
(
'switchComponent'
,
{
name
:
'AddSQL'
,
param
:
{
id
:
this
.
table
.
sceneId
,
tableId
:
this
.
table
.
id
,
table
:
this
.
table
}})
},
editCustom
()
{
this
.
$emit
(
'switchComponent'
,
{
name
:
'AddCustom'
,
param
:
{
id
:
this
.
table
.
sceneId
,
tableId
:
this
.
table
.
id
}})
this
.
$emit
(
'switchComponent'
,
{
name
:
'AddCustom'
,
param
:
{
id
:
this
.
table
.
sceneId
,
tableId
:
this
.
table
.
id
,
table
:
this
.
table
}})
},
reSearch
(
val
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论