Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄营
datax-cloud
Commits
86cf65a3
Commit
86cf65a3
authored
Nov 19, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
ddca17e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
74 deletions
+159
-74
ChartServiceImpl.java
...ax/service/data/visual/service/impl/ChartServiceImpl.java
+22
-5
index.vue
datax-ui/src/components/PivotTable/index.vue
+135
-67
visual-chart.js
datax-ui/src/utils/visual-chart.js
+2
-2
No files found.
datax-modules/data-visual-service-parent/data-visual-service/src/main/java/cn/datax/service/data/visual/service/impl/ChartServiceImpl.java
View file @
86cf65a3
...
...
@@ -18,8 +18,10 @@ import cn.datax.service.data.visual.service.ChartService;
import
cn.datax.service.data.visual.mapstruct.ChartMapper
;
import
cn.datax.service.data.visual.dao.ChartDao
;
import
cn.datax.common.base.BaseServiceImpl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -125,11 +127,26 @@ public class ChartServiceImpl extends BaseServiceImpl<ChartDao, ChartEntity> imp
List
<
ChartItem
>
groups
=
new
ArrayList
<>();
groups
.
addAll
(
rows
);
groups
.
addAll
(
columns
);
String
groupJoining
=
groups
.
stream
().
map
(
s
->
s
.
getCol
()).
collect
(
Collectors
.
joining
(
", "
,
" "
,
","
));
sql
.
append
(
"SELECT"
).
append
(
groupJoining
);
String
measureJoining
=
Optional
.
ofNullable
(
measures
).
orElse
(
new
ArrayList
<>()).
stream
().
map
(
s
->
new
StringBuilder
().
append
(
s
.
getAggregateType
()).
append
(
"("
).
append
(
s
.
getCol
()).
append
(
") AS "
).
append
(
s
.
getCol
())).
collect
(
Collectors
.
joining
(
", "
,
" "
,
" "
));
sql
.
append
(
measureJoining
);
sql
.
append
(
"FROM ("
).
append
(
setSql
).
append
(
") TEMP_VIEW "
).
append
(
"GROUP BY "
).
append
(
groups
.
stream
().
map
(
s
->
s
.
getCol
()).
collect
(
Collectors
.
joining
(
", "
)));
sql
.
append
(
"SELECT"
);
String
groupJoining
=
null
;
String
measureJoining
=
null
;
if
(
CollUtil
.
isNotEmpty
(
groups
))
{
groupJoining
=
groups
.
stream
().
map
(
s
->
s
.
getCol
()).
collect
(
Collectors
.
joining
(
", "
,
" "
,
" "
));
sql
.
append
(
groupJoining
);
}
if
(
CollUtil
.
isNotEmpty
(
measures
))
{
if
(
StrUtil
.
isNotBlank
(
groupJoining
))
{
sql
.
append
(
","
);
}
else
{
sql
.
append
(
" "
);
}
measureJoining
=
measures
.
stream
().
map
(
s
->
new
StringBuilder
().
append
(
s
.
getAggregateType
()).
append
(
"("
).
append
(
s
.
getCol
()).
append
(
") AS "
).
append
(
s
.
getCol
())).
collect
(
Collectors
.
joining
(
", "
,
" "
,
" "
));
sql
.
append
(
measureJoining
);
}
sql
.
append
(
"FROM ("
).
append
(
setSql
).
append
(
") TEMP_VIEW"
);
if
(
CollUtil
.
isNotEmpty
(
groups
))
{
sql
.
append
(
" GROUP BY "
).
append
(
groups
.
stream
().
map
(
s
->
s
.
getCol
()).
collect
(
Collectors
.
joining
(
", "
)));
}
List
<
Map
<
String
,
Object
>>
data
=
dbQuery
.
queryList
(
sql
.
toString
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
2
);
map
.
put
(
"data"
,
data
);
...
...
datax-ui/src/components/PivotTable/index.vue
View file @
86cf65a3
This diff is collapsed.
Click to expand it.
datax-ui/src/utils/visual-chart.js
View file @
86cf65a3
...
...
@@ -4,9 +4,9 @@ const chartTypes = [
status
:
true
,
component
:
'ChartTable'
,
rule
:
{
text
:
'
0个或多个 行维;0个或多个 列维;0
个或多个 指标'
,
text
:
'
1个或多个 行维;0个或多个 列维;1
个或多个 指标'
,
check
(
rows
,
columns
,
measures
)
{
return
rows
.
length
>=
0
&&
columns
.
length
>=
0
&&
measures
.
length
>=
0
return
rows
.
length
>=
1
&&
columns
.
length
>=
0
&&
measures
.
length
>=
1
}
}
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment