Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
2c4e1d9d
Unverified
提交
2c4e1d9d
authored
7月 31, 2021
作者:
XiaJunjie2020
提交者:
GitHub
7月 31, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #446 from dataease/pr@v1.1@fix_tree搜索
fix: tree搜索
上级
e3282604
557e4c62
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
141 行增加
和
19 行删除
+141
-19
ExtChartGroupMapper.xml
.../java/io/dataease/base/mapper/ext/ExtChartGroupMapper.xml
+6
-0
ExtChartViewMapper.xml
...n/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
+3
-0
ExtDataSetGroupMapper.xml
...ava/io/dataease/base/mapper/ext/ExtDataSetGroupMapper.xml
+6
-0
ExtDataSetTableMapper.xml
...ava/io/dataease/base/mapper/ext/ExtDataSetTableMapper.xml
+3
-0
ChartViewController.java
...ava/io/dataease/controller/chart/ChartViewController.java
+11
-3
DataSetTableController.java
...o/dataease/controller/dataset/DataSetTableController.java
+5
-0
ChartGroupRequest.java
.../dataease/controller/request/chart/ChartGroupRequest.java
+3
-0
DataSetGroupRequest.java
...aease/controller/request/dataset/DataSetGroupRequest.java
+5
-0
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+40
-1
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+37
-1
Group.vue
frontend/src/views/chart/group/Group.vue
+11
-7
Group.vue
frontend/src/views/dataset/group/Group.vue
+11
-7
没有找到文件。
backend/src/main/java/io/dataease/base/mapper/ext/ExtChartGroupMapper.xml
浏览文件 @
2c4e1d9d
...
...
@@ -37,6 +37,12 @@
<if
test=
"createTime != null"
>
and chart_group.create_time = #{createTime,jdbcType=BIGINT}
</if>
<if
test=
"ids != null and ids.size() > 0"
>
and id in
<foreach
collection=
"ids"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</if>
</where>
<if
test=
"sort != null"
>
order by ${sort}
...
...
backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
浏览文件 @
2c4e1d9d
...
...
@@ -39,6 +39,9 @@
<if
test=
"sceneId != null"
>
and scene_id = #{sceneId,jdbcType=VARCHAR}
</if>
<if
test=
"name != null"
>
and name like CONCAT('%', #{name},'%')
</if>
</where>
<if
test=
"sort != null"
>
order by ${sort}
...
...
backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetGroupMapper.xml
浏览文件 @
2c4e1d9d
...
...
@@ -37,6 +37,12 @@
<if
test=
"createTime != null"
>
and dataset_group.create_time = #{createTime,jdbcType=BIGINT}
</if>
<if
test=
"ids != null and ids.size() > 0"
>
and id in
<foreach
collection=
"ids"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</if>
</where>
<if
test=
"sort != null"
>
order by ${sort}
...
...
backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.xml
浏览文件 @
2c4e1d9d
...
...
@@ -45,6 +45,9 @@
<if
test=
"sceneId != null"
>
and scene_id = #{sceneId,jdbcType=VARCHAR}
</if>
<if
test=
"name != null"
>
and name like CONCAT('%', #{name},'%')
</if>
<if
test=
"mode != null"
>
and mode = #{mode,jdbcType=INTEGER}
</if>
...
...
backend/src/main/java/io/dataease/controller/chart/ChartViewController.java
浏览文件 @
2c4e1d9d
...
...
@@ -4,7 +4,9 @@ import io.dataease.base.domain.ChartViewWithBLOBs;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.controller.request.chart.ChartExtRequest
;
import
io.dataease.controller.request.chart.ChartViewRequest
;
import
io.dataease.controller.request.dataset.DataSetTableRequest
;
import
io.dataease.dto.chart.ChartViewDTO
;
import
io.dataease.dto.dataset.DataSetTableDTO
;
import
io.dataease.service.chart.ChartViewService
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -63,7 +65,7 @@ public class ChartViewController {
}
@GetMapping
(
"searchAdviceSceneId/{panelId}"
)
public
String
searchAdviceSceneId
(
@PathVariable
String
panelId
){
public
String
searchAdviceSceneId
(
@PathVariable
String
panelId
)
{
return
chartViewService
.
searchAdviceSceneId
(
panelId
);
}
...
...
@@ -71,10 +73,16 @@ public class ChartViewController {
public
ChartViewDTO
getOneWithPermission
(
@PathVariable
String
id
,
@RequestBody
ChartExtRequest
requestList
)
throws
Exception
{
//如果能获取用户 则添加对应的权限
ChartViewDTO
dto
=
chartViewService
.
getData
(
id
,
requestList
);
if
(
dto
!=
null
&&
AuthUtils
.
getUser
()!=
null
)
{
ChartViewDTO
permissionDto
=
chartViewService
.
getOneWithPermission
(
dto
.
getId
());
if
(
dto
!=
null
&&
AuthUtils
.
getUser
()
!=
null
)
{
ChartViewDTO
permissionDto
=
chartViewService
.
getOneWithPermission
(
dto
.
getId
());
dto
.
setPrivileges
(
permissionDto
.
getPrivileges
());
}
return
dto
;
}
@PostMapping
(
"search"
)
public
List
<
ChartViewDTO
>
search
(
@RequestBody
ChartViewRequest
chartViewRequest
)
{
return
chartViewService
.
search
(
chartViewRequest
);
}
}
backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java
浏览文件 @
2c4e1d9d
...
...
@@ -108,4 +108,9 @@ public class DataSetTableController {
public
Boolean
checkDorisTableIsExists
(
@PathVariable
String
id
)
throws
Exception
{
return
dataSetTableService
.
checkDorisTableIsExists
(
id
);
}
@PostMapping
(
"search"
)
public
List
<
DataSetTableDTO
>
search
(
@RequestBody
DataSetTableRequest
dataSetTableRequest
)
{
return
dataSetTableService
.
search
(
dataSetTableRequest
);
}
}
backend/src/main/java/io/dataease/controller/request/chart/ChartGroupRequest.java
浏览文件 @
2c4e1d9d
...
...
@@ -3,9 +3,12 @@ package io.dataease.controller.request.chart;
import
io.dataease.base.domain.ChartGroup
;
import
lombok.Data
;
import
java.util.Set
;
@Data
public
class
ChartGroupRequest
extends
ChartGroup
{
private
String
sort
;
private
String
userId
;
private
Set
<
String
>
ids
;
}
backend/src/main/java/io/dataease/controller/request/dataset/DataSetGroupRequest.java
浏览文件 @
2c4e1d9d
...
...
@@ -3,6 +3,9 @@ package io.dataease.controller.request.dataset;
import
io.dataease.base.domain.DatasetGroup
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Set
;
/**
* @Author gin
* @Date 2021/2/22 1:30 下午
...
...
@@ -12,4 +15,6 @@ public class DataSetGroupRequest extends DatasetGroup {
private
String
sort
;
private
String
userId
;
private
Set
<
String
>
ids
;
}
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
2c4e1d9d
...
...
@@ -15,11 +15,15 @@ import io.dataease.controller.request.chart.ChartExtFilterRequest;
import
io.dataease.controller.request.chart.ChartExtRequest
;
import
io.dataease.controller.request.chart.ChartGroupRequest
;
import
io.dataease.controller.request.chart.ChartViewRequest
;
import
io.dataease.controller.request.dataset.DataSetGroupRequest
;
import
io.dataease.controller.request.dataset.DataSetTableRequest
;
import
io.dataease.datasource.provider.DatasourceProvider
;
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.DataSetGroupDTO
;
import
io.dataease.dto.dataset.DataSetTableDTO
;
import
io.dataease.dto.dataset.DataSetTableUnionDTO
;
import
io.dataease.dto.dataset.DataTableInfoDTO
;
import
io.dataease.i18n.Translator
;
...
...
@@ -110,6 +114,41 @@ public class ChartViewService {
return
group
;
}
public
List
<
ChartViewDTO
>
search
(
ChartViewRequest
chartViewRequest
)
{
String
userId
=
String
.
valueOf
(
AuthUtils
.
getUser
().
getUserId
());
chartViewRequest
.
setUserId
(
userId
);
List
<
ChartViewDTO
>
ds
=
extChartViewMapper
.
search
(
chartViewRequest
);
if
(
CollectionUtils
.
isEmpty
(
ds
))
{
return
ds
;
}
TreeSet
<
String
>
ids
=
new
TreeSet
<>();
ds
.
forEach
(
ele
->
{
ele
.
setIsLeaf
(
true
);
ele
.
setPid
(
ele
.
getSceneId
());
ids
.
add
(
ele
.
getPid
());
});
ChartGroupRequest
chartGroupRequest
=
new
ChartGroupRequest
();
chartGroupRequest
.
setUserId
(
userId
);
chartGroupRequest
.
setIds
(
ids
);
List
<
ChartGroupDTO
>
search
=
extChartGroupMapper
.
search
(
chartGroupRequest
);
while
(
CollectionUtils
.
isNotEmpty
(
search
))
{
ids
.
clear
();
search
.
forEach
(
ele
->
{
ChartViewDTO
dto
=
new
ChartViewDTO
();
BeanUtils
.
copyBean
(
dto
,
ele
);
dto
.
setIsLeaf
(
false
);
dto
.
setType
(
"group"
);
ds
.
add
(
dto
);
ids
.
add
(
ele
.
getPid
());
});
chartGroupRequest
.
setIds
(
ids
);
search
=
extChartGroupMapper
.
search
(
chartGroupRequest
);
}
return
ds
;
}
public
ChartViewWithBLOBs
get
(
String
id
)
{
return
chartViewMapper
.
selectByPrimaryKey
(
id
);
}
...
...
@@ -188,7 +227,7 @@ public class ChartViewService {
// 获取数据集
DatasetTable
table
=
dataSetTableService
.
get
(
view
.
getTableId
());
if
(
ObjectUtils
.
isEmpty
(
table
))
{
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_dataset_delete"
));
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_dataset_delete
_or_no_permission
"
));
}
// 判断连接方式,直连或者定时抽取 table.mode
DatasourceRequest
datasourceRequest
=
new
DatasourceRequest
();
...
...
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
2c4e1d9d
...
...
@@ -12,6 +12,7 @@ import io.dataease.commons.constants.JobStatus;
import
io.dataease.commons.constants.ScheduleType
;
import
io.dataease.commons.constants.TaskStatus
;
import
io.dataease.commons.utils.*
;
import
io.dataease.controller.request.chart.ChartGroupRequest
;
import
io.dataease.controller.request.dataset.DataSetGroupRequest
;
import
io.dataease.controller.request.dataset.DataSetTableRequest
;
import
io.dataease.controller.request.dataset.DataSetTaskRequest
;
...
...
@@ -232,6 +233,41 @@ public class DataSetTableService {
return
group
;
}
public
List
<
DataSetTableDTO
>
search
(
DataSetTableRequest
dataSetTableRequest
)
{
String
userId
=
String
.
valueOf
(
AuthUtils
.
getUser
().
getUserId
());
dataSetTableRequest
.
setUserId
(
userId
);
List
<
DataSetTableDTO
>
ds
=
extDataSetTableMapper
.
search
(
dataSetTableRequest
);
if
(
CollectionUtils
.
isEmpty
(
ds
))
{
return
ds
;
}
TreeSet
<
String
>
ids
=
new
TreeSet
<>();
ds
.
forEach
(
ele
->
{
ele
.
setIsLeaf
(
true
);
ele
.
setPid
(
ele
.
getSceneId
());
ids
.
add
(
ele
.
getPid
());
});
DataSetGroupRequest
dataSetGroupRequest
=
new
DataSetGroupRequest
();
dataSetGroupRequest
.
setUserId
(
userId
);
dataSetGroupRequest
.
setIds
(
ids
);
List
<
DataSetGroupDTO
>
search
=
extDataSetGroupMapper
.
search
(
dataSetGroupRequest
);
while
(
CollectionUtils
.
isNotEmpty
(
search
))
{
ids
.
clear
();
search
.
forEach
(
ele
->
{
DataSetTableDTO
dto
=
new
DataSetTableDTO
();
BeanUtils
.
copyBean
(
dto
,
ele
);
dto
.
setIsLeaf
(
false
);
dto
.
setType
(
"group"
);
ds
.
add
(
dto
);
ids
.
add
(
ele
.
getPid
());
});
dataSetGroupRequest
.
setIds
(
ids
);
search
=
extDataSetGroupMapper
.
search
(
dataSetGroupRequest
);
}
return
ds
;
}
public
DatasetTable
get
(
String
id
)
{
return
datasetTableMapper
.
selectByPrimaryKey
(
id
);
}
...
...
@@ -1409,7 +1445,7 @@ public class DataSetTableService {
public
static
boolean
checkIsRepeat
(
String
[]
array
)
{
HashSet
<
String
>
hashSet
=
new
HashSet
<
String
>();
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
if
(
StringUtils
.
isEmpty
(
array
[
i
]))
{
if
(
StringUtils
.
isEmpty
(
array
[
i
]))
{
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_excel_empty_column"
));
}
hashSet
.
add
(
array
[
i
]);
...
...
frontend/src/views/chart/group/Group.vue
浏览文件 @
2c4e1d9d
...
...
@@ -888,14 +888,18 @@ export default {
searchTree
(
val
)
{
const
queryCondition
=
{
withExtend
:
'parent'
,
modelType
:
'chart'
,
//
withExtend: 'parent',
//
modelType: 'chart',
name
:
val
}
authModel
(
queryCondition
).
then
(
res
=>
{
// this.highlights(res.data)
// authModel(queryCondition).then(res => {
// // this.highlights(res.data)
// this.tData = this.buildTree(res.data)
// // console.log(this.tData)
// })
post
(
'/chart/view/search'
,
queryCondition
).
then
(
res
=>
{
this
.
tData
=
this
.
buildTree
(
res
.
data
)
// console.log(this.tData)
})
},
...
...
@@ -907,8 +911,8 @@ export default {
const
roots
=
[]
arrs
.
forEach
(
el
=>
{
// 判断根节点 ###
el
.
type
=
el
.
modelInnerType
el
.
isLeaf
=
el
.
leaf
//
el.type = el.modelInnerType
//
el.isLeaf = el.leaf
if
(
el
[
this
.
treeProps
.
parentId
]
===
null
||
el
[
this
.
treeProps
.
parentId
]
===
0
||
el
[
this
.
treeProps
.
parentId
]
===
'0'
)
{
roots
.
push
(
el
)
return
...
...
frontend/src/views/dataset/group/Group.vue
浏览文件 @
2c4e1d9d
...
...
@@ -856,14 +856,18 @@ export default {
searchTree
(
val
)
{
const
queryCondition
=
{
withExtend
:
'parent'
,
modelType
:
'dataset'
,
//
withExtend: 'parent',
//
modelType: 'dataset',
name
:
val
}
authModel
(
queryCondition
).
then
(
res
=>
{
// this.highlights(res.data)
// authModel(queryCondition).then(res => {
// // this.highlights(res.data)
// this.tData = this.buildTree(res.data)
// // console.log(this.tData)
// })
post
(
'/dataset/table/search'
,
queryCondition
).
then
(
res
=>
{
this
.
tData
=
this
.
buildTree
(
res
.
data
)
// console.log(this.tData)
})
},
...
...
@@ -875,8 +879,8 @@ export default {
const
roots
=
[]
arrs
.
forEach
(
el
=>
{
// 判断根节点 ###
el
.
type
=
el
.
modelInnerType
el
.
isLeaf
=
el
.
leaf
//
el.type = el.modelInnerType
//
el.isLeaf = el.leaf
if
(
el
[
this
.
treeProps
.
parentId
]
===
null
||
el
[
this
.
treeProps
.
parentId
]
===
0
||
el
[
this
.
treeProps
.
parentId
]
===
'0'
)
{
roots
.
push
(
el
)
return
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论