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
56a87d51
Commit
56a87d51
authored
Oct 10, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
221e59bc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
200 additions
and
29 deletions
+200
-29
DictMappingController.java
...rvice/data/standard/controller/DictMappingController.java
+12
-0
ContrastDictDao.java
...a/cn/datax/service/data/standard/dao/ContrastDictDao.java
+5
-0
DictMappingService.java
...tax/service/data/standard/service/DictMappingService.java
+4
-0
DictMappingServiceImpl.java
...ce/data/standard/service/impl/DictMappingServiceImpl.java
+43
-1
ContrastDictMapper.xml
...-service/src/main/resources/mapper/ContrastDictMapper.xml
+11
-0
package.json
datax-ui/package.json
+1
-0
dictmapping.js
datax-ui/src/api/standard/dictmapping.js
+7
-0
index.vue
datax-ui/src/views/standard/dictmapping/index.vue
+117
-28
No files found.
datax-modules/data-standard-service-parent/data-standard-service/src/main/java/cn/datax/service/data/standard/controller/DictMappingController.java
View file @
56a87d51
...
...
@@ -22,4 +22,16 @@ public class DictMappingController extends BaseController {
Map
<
String
,
Object
>
map
=
dictMappingService
.
getDictMapping
(
id
);
return
R
.
ok
().
setData
(
map
);
}
@PostMapping
(
"/auto/{id}"
)
public
R
dictAutoMapping
(
@PathVariable
String
id
)
{
dictMappingService
.
dictAutoMapping
(
id
);
return
R
.
ok
();
}
@PostMapping
(
"/manual/{id}"
)
public
R
dictManualMapping
(
@PathVariable
String
id
)
{
dictMappingService
.
dictManualMapping
(
id
);
return
R
.
ok
();
}
}
datax-modules/data-standard-service-parent/data-standard-service/src/main/java/cn/datax/service/data/standard/dao/ContrastDictDao.java
View file @
56a87d51
...
...
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>
* 字典对照信息表 Mapper 接口
...
...
@@ -20,5 +22,8 @@ import org.apache.ibatis.annotations.Param;
public
interface
ContrastDictDao
extends
BaseDao
<
ContrastDictEntity
>
{
@Override
List
<
ContrastDictEntity
>
selectList
(
@Param
(
Constants
.
WRAPPER
)
Wrapper
<
ContrastDictEntity
>
queryWrapper
);
@Override
<
E
extends
IPage
<
ContrastDictEntity
>>
E
selectPage
(
E
page
,
@Param
(
Constants
.
WRAPPER
)
Wrapper
<
ContrastDictEntity
>
queryWrapper
);
}
datax-modules/data-standard-service-parent/data-standard-service/src/main/java/cn/datax/service/data/standard/service/DictMappingService.java
View file @
56a87d51
...
...
@@ -5,4 +5,8 @@ import java.util.Map;
public
interface
DictMappingService
{
Map
<
String
,
Object
>
getDictMapping
(
String
id
);
void
dictAutoMapping
(
String
id
);
void
dictManualMapping
(
String
id
);
}
datax-modules/data-standard-service-parent/data-standard-service/src/main/java/cn/datax/service/data/standard/service/impl/DictMappingServiceImpl.java
View file @
56a87d51
...
...
@@ -13,6 +13,7 @@ import cn.datax.service.data.standard.mapstruct.ContrastDictMapper;
import
cn.datax.service.data.standard.mapstruct.DictMapper
;
import
cn.datax.service.data.standard.service.DictMappingService
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -40,12 +42,17 @@ public class DictMappingServiceImpl implements DictMappingService {
@Autowired
private
DictMapper
dictMapper
;
private
static
String
BIND_GB_CODE
=
"gb_code"
;
private
static
String
BIND_GB_NAME
=
"gb_name"
;
@Override
public
Map
<
String
,
Object
>
getDictMapping
(
String
id
)
{
ContrastEntity
contrastEntity
=
contrastDao
.
selectById
(
id
);
String
contrastId
=
contrastEntity
.
getId
();
String
gbTypeId
=
contrastEntity
.
getGbTypeId
();
List
<
ContrastDictEntity
>
contrastDictEntityList
=
contrastDictDao
.
selectList
(
Wrappers
.<
ContrastDictEntity
>
lambdaQuery
().
eq
(
ContrastDictEntity:
:
getContrastId
,
contrastId
));
QueryWrapper
<
ContrastDictEntity
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"d.contrast_id"
,
contrastId
);
List
<
ContrastDictEntity
>
contrastDictEntityList
=
contrastDictDao
.
selectList
(
queryWrapper
);
List
<
ContrastDictVo
>
contrastDictList
=
contrastDictEntityList
.
stream
().
map
(
contrastDictMapper:
:
toVO
).
collect
(
Collectors
.
toList
());
List
<
DictEntity
>
dictEntityList
=
dictDao
.
selectList
(
Wrappers
.<
DictEntity
>
lambdaQuery
().
eq
(
DictEntity:
:
getTypeId
,
gbTypeId
).
eq
(
DictEntity:
:
getStatus
,
DataConstant
.
TrueOrFalse
.
TRUE
.
getKey
()));
List
<
DictVo
>
dictList
=
dictEntityList
.
stream
().
map
(
dictMapper:
:
toVO
).
collect
(
Collectors
.
toList
());
...
...
@@ -60,4 +67,39 @@ public class DictMappingServiceImpl implements DictMappingService {
map
.
put
(
"right"
,
dictList
);
return
map
;
}
@Override
public
void
dictAutoMapping
(
String
id
)
{
ContrastEntity
contrastEntity
=
contrastDao
.
selectById
(
id
);
String
contrastId
=
contrastEntity
.
getId
();
String
gbTypeId
=
contrastEntity
.
getGbTypeId
();
String
bindGbColumn
=
contrastEntity
.
getBindGbColumn
();
// 查询未对照数据
QueryWrapper
<
ContrastDictEntity
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"d.contrast_id"
,
contrastId
);
queryWrapper
.
eq
(
"d.status"
,
DataConstant
.
TrueOrFalse
.
FALSE
.
getKey
());
List
<
ContrastDictEntity
>
contrastDictEntityList
=
contrastDictDao
.
selectList
(
queryWrapper
);
// 查询标准字典数据
List
<
DictEntity
>
dictEntityList
=
dictDao
.
selectList
(
Wrappers
.<
DictEntity
>
lambdaQuery
().
eq
(
DictEntity:
:
getTypeId
,
gbTypeId
).
eq
(
DictEntity:
:
getStatus
,
DataConstant
.
TrueOrFalse
.
TRUE
.
getKey
()));
contrastDictEntityList
.
stream
().
forEach
(
c
->
{
dictEntityList
.
stream
().
filter
(
d
->
{
if
(
BIND_GB_CODE
.
equals
(
bindGbColumn
))
{
return
Objects
.
equals
(
c
.
getColCode
(),
d
.
getGbCode
());
}
else
{
return
Objects
.
equals
(
c
.
getColName
(),
d
.
getGbName
());
}
}).
forEach
(
s
->
{
// 更新对照结果
String
contrastGbId
=
s
.
getId
();
c
.
setStatus
(
DataConstant
.
TrueOrFalse
.
TRUE
.
getKey
());
c
.
setContrastGbId
(
contrastGbId
);
contrastDictDao
.
updateById
(
c
);
});
});
}
@Override
public
void
dictManualMapping
(
String
id
)
{
}
}
datax-modules/data-standard-service-parent/data-standard-service/src/main/resources/mapper/ContrastDictMapper.xml
View file @
56a87d51
...
...
@@ -53,6 +53,17 @@
${alias}.contrast_id, ${alias}.col_code, ${alias}.col_name, ${alias}.contrast_gb_id
</sql>
<select
id=
"selectList"
resultMap=
"ExtendResultMap"
>
SELECT c.source_name, c.table_name, c.column_name, t.gb_type_code, t.gb_type_name,
sd.gb_code AS contrast_gb_code, sd.gb_name AS contrast_gb_name,
<include
refid=
"Dict_Column_List"
><property
name=
"alias"
value=
"d"
/></include>
FROM standard_contrast_dict d
LEFT JOIN standard_contrast c ON c.id = d.contrast_id
LEFT JOIN standard_type t ON t.id = c.gb_type_id
LEFT JOIN standard_dict sd ON sd.id = d.contrast_gb_id
${ew.customSqlSegment}
</select>
<select
id=
"selectPage"
resultMap=
"ExtendResultMap"
>
SELECT c.source_name, c.table_name, c.column_name, t.gb_type_code, t.gb_type_name,
sd.gb_code AS contrast_gb_code, sd.gb_name AS contrast_gb_name,
...
...
datax-ui/package.json
View file @
56a87d51
...
...
@@ -20,6 +20,7 @@
"echarts"
:
"^4.8.0"
,
"element-ui"
:
"2.13.2"
,
"good-storage"
:
"^1.1.1"
,
"jsplumb"
:
"^2.14.6"
,
"normalize.css"
:
"7.0.0"
,
"nprogress"
:
"0.2.0"
,
"path-to-regexp"
:
"2.4.0"
,
...
...
datax-ui/src/api/standard/dictmapping.js
View file @
56a87d51
...
...
@@ -6,3 +6,10 @@ export function getDictMapping(id) {
method
:
'get'
})
}
export
function
dictAutoMapping
(
id
)
{
return
request
({
url
:
'/data/standard/mappings/auto/'
+
id
,
method
:
'post'
})
}
datax-ui/src/views/standard/dictmapping/index.vue
View file @
56a87d51
...
...
@@ -30,6 +30,7 @@
<el-col
:span=
"24"
>
<el-button
type=
"primary"
size=
"mini"
@
click=
"handleAuto"
>
自动对照
</el-button>
<el-button
type=
"primary"
size=
"mini"
@
click=
"handleManual"
>
手动对照
</el-button>
<el-button
type=
"primary"
size=
"mini"
>
取消对照
</el-button>
</el-col>
</el-row>
<el-row>
...
...
@@ -57,34 +58,42 @@
</el-alert>
</el-col>
</el-row>
<el-row
:gutter=
"20"
>
<el-row
id=
"jsplumbContainer"
:gutter=
"20"
>
<el-col
:span=
"9"
>
<el-table
v-loading=
"loading"
:data=
"leftTableDataList"
border
tooltip-effect=
"dark"
:height=
"tableHeight"
style=
"width: 100%; margin: 15px 0;"
>
<el-table-column
prop=
"colCode"
label=
"字典编码"
align=
"center"
show-overflow-tooltip
/>
<el-table-column
prop=
"colName"
label=
"字典名称"
align=
"center"
show-overflow-tooltip
/>
<el-table-column
prop=
"contrastGbCode"
label=
"映射编码"
align=
"center"
show-overflow-tooltip
/>
<el-table-column
prop=
"contrastGbName"
label=
"映射名称"
align=
"center"
show-overflow-tooltip
/>
</el-table>
<table
id=
"leftTable"
>
<thead>
<tr>
<th>
字典编码
</th>
<th>
字典名称
</th>
<th>
映射编码
</th>
<th>
映射名称
</th>
</tr>
</thead>
<tbody>
<tr
v-for=
"(data, index) in leftTableDataList"
:key=
"index"
:id=
"'item_left_' + data.id"
>
<td>
{{ data.colCode }}
</td>
<td>
{{ data.colName }}
</td>
<td>
{{ data.contrastGbCode }}
</td>
<td>
{{ data.contrastGbName }}
</td>
</tr>
</tbody>
</table>
</el-col>
<el-col
:span=
"9"
:offset=
"6"
>
<el-table
v-loading=
"loading"
:data=
"rightTableDataList"
border
tooltip-effect=
"dark"
:height=
"tableHeight"
style=
"width: 100%; margin: 15px 0;"
>
<el-table-column
prop=
"gbCode"
label=
"标准编码"
align=
"center"
show-overflow-tooltip
/>
<el-table-column
prop=
"gbName"
label=
"标准名称"
align=
"center"
show-overflow-tooltip
/>
</el-table>
<table
id=
"rightTable"
>
<thead>
<tr>
<th>
标准编码
</th>
<th>
标准名称
</th>
</tr>
</thead>
<tbody>
<tr
v-for=
"(data, index) in rightTableDataList"
:key=
"index"
:id=
"'item_right_' + data.id"
>
<td>
{{ data.gbCode }}
</td>
<td>
{{ data.gbName }}
</td>
</tr>
</tbody>
</table>
</el-col>
</el-row>
</el-card>
...
...
@@ -95,7 +104,8 @@
<
script
>
import
{
getContrastTree
}
from
'@/api/standard/contrast'
import
{
getDictMapping
}
from
'@/api/standard/dictmapping'
import
{
getDictMapping
,
dictAutoMapping
}
from
'@/api/standard/dictmapping'
import
{
jsPlumb
}
from
'jsplumb'
export
default
{
name
:
'DictMapping'
,
...
...
@@ -116,13 +126,54 @@ export default {
},
contrastId
:
undefined
,
title
:
''
,
description
:
''
description
:
''
,
jsPlumb
:
null
}
},
created
()
{
this
.
getTree
()
},
mounted
()
{
this
.
jsPlumb
=
jsPlumb
.
getInstance
({
// 锚点位置;对任何没有声明描点的Endpoint设置锚点,用于source及target节点
Anchor
:
[
'Right'
,
'Left'
],
// 连线的source和target Anchor
Anchors
:
[
'Right'
,
'Left'
],
// 鼠标不能拖动删除线
ConnectionsDetachable
:
false
,
// 删除线的时候节点不删除
DeleteEndpointsOnDetach
:
false
,
// 连线的样式,有四种默认类型:Bezier(贝塞尔曲线),Straight(直线),Flowchart(流程图),State machine(状态机)
Connector
:
'Bezier'
,
// 父级元素id;假如页面元素所在上层不同,最外层父级一定要设置
Container
:
'jsplumbContainer'
})
this
.
$nextTick
(()
=>
{
this
.
initJsPlumb
()
})
},
methods
:
{
initJsPlumb
()
{
const
_this
=
this
this
.
jsPlumb
.
ready
(
function
()
{
// 双击连接线(删除)
_this
.
jsPlumb
.
bind
(
'dblclick'
,
function
(
conn
,
originalEvent
)
{
console
.
log
(
'dblclick'
,
conn
)
})
// 连线
_this
.
jsPlumb
.
bind
(
'connection'
,
function
(
evt
)
{
console
.
log
(
'connection'
,
evt
)
})
// 删除连线
_this
.
jsPlumb
.
bind
(
'connectionDetached'
,
function
(
evt
)
{
console
.
log
(
'connectionDetached'
,
evt
)
})
// beforeDrop
_this
.
jsPlumb
.
bind
(
'beforeDrop'
,
function
(
evt
)
{
console
.
log
(
'beforeDrop'
,
evt
)
})
})
},
getTree
()
{
getContrastTree
().
then
(
response
=>
{
if
(
response
.
success
)
{
...
...
@@ -152,11 +203,35 @@ export default {
this
.
rightTableDataList
=
data
.
right
this
.
title
=
data
.
title
this
.
description
=
data
.
description
this
.
$nextTick
(()
=>
{
this
.
initEndpoint
()
})
}
})
},
initEndpoint
()
{
console
.
log
(
this
.
leftTableDataList
.
length
)
this
.
leftTableDataList
.
filter
(
item
=>
item
.
status
===
'1'
).
forEach
(
function
(
item
,
index
,
arr
)
{
this
.
jsPlumb
.
addEndpoint
(
'item_left_'
+
item
.
id
,
{
anchors
:
[
'Right'
],
uuid
:
item
.
id
})
})
// this.jsPlumb.addEndpoint('item_right', {
// anchors: ['Left'],
// uuid: 'toId'
// })
// const connection = this.jsPlumb.connect({ uuids: ['fromId', 'toId'] })
// // 初始化label
// connection.getOverlay('label-1').setLabel('映射连线')
},
handleAuto
()
{
console
.
log
(
this
.
contrastId
)
dictAutoMapping
(
this
.
contrastId
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
$message
.
success
(
'对照成功'
)
this
.
getDictMapping
()
}
})
},
handleManual
()
{
console
.
log
(
this
.
contrastId
)
...
...
@@ -189,4 +264,18 @@ export default {
}
}
}
#leftTable
,
#rightTable
{
width
:
100%
;
margin
:
15px
0
;
border-collapse
:
collapse
;
tr
th
{
color
:
#909399
;
font-weight
:
bold
;
}
tr
th
,
tr
td
{
font-size
:
14px
;
border
:
1px
solid
#EBEEF5
;
padding
:
5px
10px
;
}
}
</
style
>
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