Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-service
Project
Project
Details
Activity
Releases
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
姚本章
jz-dmp-service
Commits
72413f6c
Commit
72413f6c
authored
Jan 28, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
ddde5e1e
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
88 additions
and
15 deletions
+88
-15
OfflineSynchController.java
...es/controller/DataIntegration/OfflineSynchController.java
+39
-12
DmpSyncingDatasourceTypeDao.java
...a/com/jz/dmp/modules/dao/DmpSyncingDatasourceTypeDao.java
+2
-0
DmpSyncingDatasourceType.java
...va/com/jz/dmp/modules/model/DmpSyncingDatasourceType.java
+6
-0
DmpSyncingDatasourceTypeService.java
.../dmp/modules/service/DmpSyncingDatasourceTypeService.java
+9
-0
OfflineSynchService.java
.../java/com/jz/dmp/modules/service/OfflineSynchService.java
+1
-1
DmpSyncingDatasourceTypeServiceImpl.java
...les/service/impl/DmpSyncingDatasourceTypeServiceImpl.java
+17
-0
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+4
-2
DmpSyncingDatasourceTypeMapper.xml
...n/resources/mapper/dmp/DmpSyncingDatasourceTypeMapper.xml
+9
-0
OfflineSynchMapper.xml
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
+1
-0
No files found.
src/main/java/com/jz/dmp/modules/controller/DataIntegration/OfflineSynchController.java
View file @
72413f6c
...
@@ -5,10 +5,12 @@ import com.jz.common.constant.ResultCode;
...
@@ -5,10 +5,12 @@ import com.jz.common.constant.ResultCode;
import
com.jz.common.page.BasePageBean
;
import
com.jz.common.page.BasePageBean
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.*
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.*
;
import
com.jz.dmp.modules.service.DmpNavigationTreeService
;
import
com.jz.dmp.modules.controller.dataService.bean.SoureTableColumnsReq
;
import
com.jz.dmp.modules.service.DmpSyncingDatasourceTypeService
;
import
com.jz.dmp.modules.service.OfflineSynchService
;
import
com.jz.dmp.modules.service.OfflineSynchService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -16,9 +18,7 @@ import org.springframework.validation.annotation.Validated;
...
@@ -16,9 +18,7 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @Description:离线同步
* @Description:离线同步
...
@@ -34,6 +34,9 @@ public class OfflineSynchController {
...
@@ -34,6 +34,9 @@ public class OfflineSynchController {
@Autowired
@Autowired
private
OfflineSynchService
offlineSynchService
;
private
OfflineSynchService
offlineSynchService
;
@Autowired
private
DmpSyncingDatasourceTypeService
dmpSyncingDatasourceTypeService
;
/**
/**
* 离线同步任务列表分页查询
* 离线同步任务列表分页查询
*
*
...
@@ -62,12 +65,29 @@ public class OfflineSynchController {
...
@@ -62,12 +65,29 @@ public class OfflineSynchController {
*/
*/
@ApiOperation
(
value
=
"获取源数据库名称-下拉框"
,
notes
=
"获取源数据库名称"
)
@ApiOperation
(
value
=
"获取源数据库名称-下拉框"
,
notes
=
"获取源数据库名称"
)
@GetMapping
(
value
=
"/sourceDbList"
)
@GetMapping
(
value
=
"/sourceDbList"
)
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
,
required
=
true
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
,
required
=
true
)
public
JsonResult
<
List
<
SourceDbNameListDto
>>
getSourceDbList
(
@RequestParam
Integer
projectId
)
throws
Exception
{
,
@ApiImplicitParam
(
name
=
"datasourceTypeId"
,
value
=
"数据源类型id"
)
JsonResult
<
List
<
SourceDbNameListDto
>>
jsonResult
=
offlineSynchService
.
querygSourceDbList
(
projectId
);
,
@ApiImplicitParam
(
name
=
"type"
,
value
=
"01:来源,02目标"
)
})
public
JsonResult
<
List
<
SourceDbNameListDto
>>
getSourceDbList
(
@RequestParam
Integer
projectId
,
@RequestParam
(
required
=
false
)
String
type
,
@RequestParam
String
datasourceTypeId
)
throws
Exception
{
JsonResult
<
List
<
SourceDbNameListDto
>>
jsonResult
=
offlineSynchService
.
querygSourceDbList
(
projectId
,
datasourceTypeId
);
return
jsonResult
;
return
jsonResult
;
}
}
/**
* 获取数据源——下拉框
*
* @return
* @since 2021-01-21
* @author Bellamy
*/
@ApiOperation
(
value
=
"获取数据源—下拉框"
,
notes
=
"获取数据源—下拉框"
)
@GetMapping
(
value
=
"/datasourceList"
)
public
JsonResult
getDatasourceList
()
throws
Exception
{
JsonResult
list
=
dmpSyncingDatasourceTypeService
.
queryDatasourceList
();
return
list
;
}
/**
/**
* 根据源数据库id,获取源数据表——下拉框
* 根据源数据库id,获取源数据表——下拉框
*
*
...
@@ -76,7 +96,7 @@ public class OfflineSynchController {
...
@@ -76,7 +96,7 @@ public class OfflineSynchController {
*/
*/
@ApiOperation
(
value
=
"根据源数据库id,获取源数据表-下拉框"
,
notes
=
"根据源数据库id,获取源数据表"
)
@ApiOperation
(
value
=
"根据源数据库id,获取源数据表-下拉框"
,
notes
=
"根据源数据库id,获取源数据表"
)
@GetMapping
(
value
=
"/sourceTableList"
)
@GetMapping
(
value
=
"/sourceTableList"
)
@ApiImplicitParam
(
name
=
"sourceDbId"
,
value
=
"源数据库id"
,
required
=
true
)
@ApiImplicitParam
s
({
@ApiImplicitParam
(
name
=
"sourceDbId"
,
value
=
"源数据库id"
,
required
=
true
)}
)
public
JsonResult
getSourceTableList
(
@RequestParam
Long
sourceDbId
,
@RequestParam
(
value
=
"targetName"
,
required
=
false
)
String
targetName
)
throws
Exception
{
public
JsonResult
getSourceTableList
(
@RequestParam
Long
sourceDbId
,
@RequestParam
(
value
=
"targetName"
,
required
=
false
)
String
targetName
)
throws
Exception
{
JsonResult
list
=
offlineSynchService
.
querygSourceTableList
(
sourceDbId
,
targetName
);
JsonResult
list
=
offlineSynchService
.
querygSourceTableList
(
sourceDbId
,
targetName
);
return
list
;
return
list
;
...
@@ -175,16 +195,23 @@ public class OfflineSynchController {
...
@@ -175,16 +195,23 @@ public class OfflineSynchController {
}
}
/**
/**
* 获取
源表和目标表的
字段
* 获取
数据源表
字段
*
*
* @return
* @return
* @author Bellamy
* @author Bellamy
*/
*/
@ApiOperation
(
value
=
"获取
源表和目标表的字段"
,
notes
=
"获取源表和目标表的
字段"
)
@ApiOperation
(
value
=
"获取
数据源表字段"
,
notes
=
"获取数据源表
字段"
)
@PostMapping
(
value
=
"/getSoureAndTargetColumns"
)
@PostMapping
(
value
=
"/getSoureAndTargetColumns"
)
public
JsonResult
getSoureAndTargetColumns
(
@RequestBody
@Validated
SoureAndTargetColumnsReq
soureAndTargetColumnsReq
)
throws
Exception
{
public
JsonResult
getSoureAndTargetColumns
(
@RequestBody
@Validated
SoureTableColumnsReq
soureAndTargetColumnsReq
)
throws
Exception
{
JsonResult
list
=
offlineSynchService
.
querySoureAndTargetColumnsByParams
(
soureAndTargetColumnsReq
);
JsonResult
jsonResult
=
new
JsonResult
();
return
list
;
try
{
jsonResult
=
offlineSynchService
.
querySoureTableColumns
(
soureAndTargetColumnsReq
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
}
/**
/**
...
...
src/main/java/com/jz/dmp/modules/dao/DmpSyncingDatasourceTypeDao.java
View file @
72413f6c
...
@@ -4,6 +4,7 @@ import com.jz.dmp.modules.model.DmpSyncingDatasourceType;
...
@@ -4,6 +4,7 @@ import com.jz.dmp.modules.model.DmpSyncingDatasourceType;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 数据源类型(DmpSyncingDatasourceType)表数据库访问层
* 数据源类型(DmpSyncingDatasourceType)表数据库访问层
...
@@ -79,4 +80,5 @@ public interface DmpSyncingDatasourceTypeDao {
...
@@ -79,4 +80,5 @@ public interface DmpSyncingDatasourceTypeDao {
*/
*/
int
deleteById
(
Integer
id
);
int
deleteById
(
Integer
id
);
List
<
DmpSyncingDatasourceType
>
queryAllByParams
(
Map
params
)
throws
Exception
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/model/DmpSyncingDatasourceType.java
View file @
72413f6c
package
com
.
jz
.
dmp
.
modules
.
model
;
package
com
.
jz
.
dmp
.
modules
.
model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
...
@@ -8,15 +11,18 @@ import java.io.Serializable;
...
@@ -8,15 +11,18 @@ import java.io.Serializable;
* @author Bellamy
* @author Bellamy
* @since 2020-12-21 18:39:06
* @since 2020-12-21 18:39:06
*/
*/
@ApiModel
(
"数据源类型"
)
public
class
DmpSyncingDatasourceType
implements
Serializable
{
public
class
DmpSyncingDatasourceType
implements
Serializable
{
private
static
final
long
serialVersionUID
=
526021146272437267L
;
private
static
final
long
serialVersionUID
=
526021146272437267L
;
/**
/**
* ID
* ID
*/
*/
@ApiModelProperty
(
value
=
"id"
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 数据源名称
* 数据源名称
*/
*/
@ApiModelProperty
(
value
=
"数据源名称"
)
private
String
datasource
;
private
String
datasource
;
/**
/**
* 数据源分类
* 数据源分类
...
...
src/main/java/com/jz/dmp/modules/service/DmpSyncingDatasourceTypeService.java
View file @
72413f6c
package
com
.
jz
.
dmp
.
modules
.
service
;
package
com
.
jz
.
dmp
.
modules
.
service
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.dmp.modules.model.DmpSyncingDatasourceType
;
import
com.jz.dmp.modules.model.DmpSyncingDatasourceType
;
import
java.util.List
;
import
java.util.List
;
...
@@ -54,4 +55,12 @@ public interface DmpSyncingDatasourceTypeService {
...
@@ -54,4 +55,12 @@ public interface DmpSyncingDatasourceTypeService {
*/
*/
boolean
deleteById
(
Integer
id
);
boolean
deleteById
(
Integer
id
);
/**
* 获取数据源——下拉框
*
* @return
* @since 2021-01-21
* @author Bellamy
*/
JsonResult
queryDatasourceList
()
throws
Exception
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/OfflineSynchService.java
View file @
72413f6c
...
@@ -32,7 +32,7 @@ public interface OfflineSynchService {
...
@@ -32,7 +32,7 @@ public interface OfflineSynchService {
* @return
* @return
* @author Bellamy
* @author Bellamy
*/
*/
JsonResult
querygSourceDbList
(
Integer
projectId
)
throws
Exception
;
JsonResult
querygSourceDbList
(
Integer
projectId
,
String
databaseTypeName
)
throws
Exception
;
/**
/**
* 根据源数据库id,获取源数据表——下拉框
* 根据源数据库id,获取源数据表——下拉框
...
...
src/main/java/com/jz/dmp/modules/service/impl/DmpSyncingDatasourceTypeServiceImpl.java
View file @
72413f6c
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.dmp.modules.dao.DmpSyncingDatasourceTypeDao
;
import
com.jz.dmp.modules.dao.DmpSyncingDatasourceTypeDao
;
import
com.jz.dmp.modules.model.DmpSyncingDatasourceType
;
import
com.jz.dmp.modules.model.DmpSyncingDatasourceType
;
import
com.jz.dmp.modules.service.DmpSyncingDatasourceTypeService
;
import
com.jz.dmp.modules.service.DmpSyncingDatasourceTypeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 数据源类型(DmpSyncingDatasourceType)表服务实现类
* 数据源类型(DmpSyncingDatasourceType)表服务实现类
...
@@ -76,4 +79,18 @@ public class DmpSyncingDatasourceTypeServiceImpl implements DmpSyncingDatasource
...
@@ -76,4 +79,18 @@ public class DmpSyncingDatasourceTypeServiceImpl implements DmpSyncingDatasource
public
boolean
deleteById
(
Integer
id
)
{
public
boolean
deleteById
(
Integer
id
)
{
return
this
.
dmpSyncingDatasourceTypeDao
.
deleteById
(
id
)
>
0
;
return
this
.
dmpSyncingDatasourceTypeDao
.
deleteById
(
id
)
>
0
;
}
}
/**
* 获取数据源——下拉框
*
* @return
* @author Bellamy
* @since 2021-01-21
*/
@Override
public
JsonResult
queryDatasourceList
()
throws
Exception
{
Map
params
=
new
HashMap
<>();
List
<
DmpSyncingDatasourceType
>
list
=
dmpSyncingDatasourceTypeDao
.
queryAllByParams
(
params
);
return
JsonResult
.
ok
(
list
);
}
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
72413f6c
...
@@ -114,10 +114,10 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -114,10 +114,10 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
* 获取源数据库名称——下拉框
* 获取源数据库名称——下拉框
*/
*/
@Override
@Override
public
JsonResult
<
List
<
SourceDbNameListDto
>>
querygSourceDbList
(
Integer
projectId
)
throws
Exception
{
public
JsonResult
<
List
<
SourceDbNameListDto
>>
querygSourceDbList
(
Integer
projectId
,
String
datasourceTypeId
)
throws
Exception
{
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
map
.
put
(
"projectId"
,
projectId
);
//项目id
map
.
put
(
"projectId"
,
projectId
);
//项目id
//map.put("isEnableSource", "1"
);
map
.
put
(
"datasourceTypeId"
,
datasourceTypeId
);
List
<
SourceDbNameListDto
>
list
=
offlineSynchDao
.
querygSourceDbList
(
map
);
List
<
SourceDbNameListDto
>
list
=
offlineSynchDao
.
querygSourceDbList
(
map
);
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
list
);
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
list
);
}
}
...
@@ -728,6 +728,8 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -728,6 +728,8 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
Map
map
=
returnList
.
get
(
i
);
Map
map
=
returnList
.
get
(
i
);
map
.
put
(
"id"
,
i
+
1
);
map
.
put
(
"id"
,
i
+
1
);
}
}
}
else
{
throw
new
RuntimeException
(
"无数据!"
);
}
}
return
JsonResult
.
ok
(
returnList
);
return
JsonResult
.
ok
(
returnList
);
}
}
...
...
src/main/resources/mapper/dmp/DmpSyncingDatasourceTypeMapper.xml
View file @
72413f6c
...
@@ -92,6 +92,15 @@
...
@@ -92,6 +92,15 @@
</where>
</where>
</select>
</select>
<select
id=
"queryAllByParams"
resultType=
"com.jz.dmp.modules.model.DmpSyncingDatasourceType"
>
select
id, datasource, datasource_catecode, datasource_catename, datasource_type, img_url, data_status, is_enabled,
datasource_catetype, driver_class_name, is_enable_test, default_source_script, default_target_script,
is_enable_source, is_enable_target
from dmp_syncing_datasource_type
where 1=1 and DATA_STATUS='1'
</select>
<!--新增所有列-->
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into dmp_syncing_datasource_type(DATASOURCE, DATASOURCE_CATECODE, DATASOURCE_CATENAME, DATASOURCE_TYPE, IMG_URL, DATA_STATUS, IS_ENABLED, DATASOURCE_CATETYPE, DRIVER_CLASS_NAME, IS_ENABLE_TEST, DEFAULT_SOURCE_SCRIPT, DEFAULT_TARGET_SCRIPT, IS_ENABLE_SOURCE, IS_ENABLE_TARGET)
insert into dmp_syncing_datasource_type(DATASOURCE, DATASOURCE_CATECODE, DATASOURCE_CATENAME, DATASOURCE_TYPE, IMG_URL, DATA_STATUS, IS_ENABLED, DATASOURCE_CATETYPE, DRIVER_CLASS_NAME, IS_ENABLE_TEST, DEFAULT_SOURCE_SCRIPT, DEFAULT_TARGET_SCRIPT, IS_ENABLE_SOURCE, IS_ENABLE_TARGET)
...
...
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
View file @
72413f6c
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
<if
test =
"isEnableTarget != null and isEnableTarget=='1'.toString()"
>
and dsdt.is_enable_target = '1'
</if>
<if
test =
"isEnableTarget != null and isEnableTarget=='1'.toString()"
>
and dsdt.is_enable_target = '1'
</if>
where ds.data_status = '1' and ds.project_id = #{projectId}
where ds.data_status = '1' and ds.project_id = #{projectId}
<if
test=
"dbName != null and dbName !='' "
>
and dsdt.datasource = #{dbName}
</if>
<if
test=
"dbName != null and dbName !='' "
>
and dsdt.datasource = #{dbName}
</if>
<if
test=
"datasourceTypeId != null and datasourceTypeId != '' "
>
and dsdt.id=#{datasourceTypeId}
</if>
<if
test =
'datasourceType != null and datasourceType > 0 '
>
and ds.DATASOURCE_TYPE = #{datasourceType}
</if>
<if
test =
'datasourceType != null and datasourceType > 0 '
>
and ds.DATASOURCE_TYPE = #{datasourceType}
</if>
</select>
</select>
...
...
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