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
ec2fd30f
Commit
ec2fd30f
authored
Dec 21, 2020
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取源数据库下拉框
parent
cbd215fb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
31 deletions
+107
-31
JsonResult.java
src/main/java/com/jz/common/constant/JsonResult.java
+27
-7
OfflineSynchController.java
...es/controller/DataIntegration/OfflineSynchController.java
+38
-24
OfflineSynchDao.java
src/main/java/com/jz/dmp/modules/dao/OfflineSynchDao.java
+3
-0
OfflineSynchService.java
.../java/com/jz/dmp/modules/service/OfflineSynchService.java
+3
-0
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+11
-0
OfflineSynchMapper.xml
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
+25
-0
No files found.
src/main/java/com/jz/common/constant/JsonResult.java
View file @
ec2fd30f
package
com
.
jz
.
common
.
constant
;
package
com
.
jz
.
common
.
constant
;
public
class
JsonResult
{
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
@ApiModel
(
value
=
"接口返回对象"
,
description
=
"接口返回对象"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
JsonResult
<
T
>
{
/**
* 返回代码
*/
@ApiModelProperty
(
value
=
"返回代码"
)
private
String
code
;
private
String
code
;
/**
* 返回处理消息
*/
@ApiModelProperty
(
value
=
"返回处理消息"
)
private
String
message
;
private
String
message
;
private
Object
data
;
/**
* 返回数据对象 data
*/
@ApiModelProperty
(
value
=
"返回数据对象"
)
private
T
data
;
public
JsonResult
()
{
public
JsonResult
()
{
this
.
setCode
(
ResultCode
.
SUCCESS
);
this
.
setCode
(
ResultCode
.
SUCCESS
);
this
.
setMessage
(
"成功?"
);
this
.
setMessage
(
"成功
�
?"
);
}
}
public
JsonResult
(
ResultCode
code
)
{
public
JsonResult
(
ResultCode
code
)
{
...
@@ -21,13 +41,13 @@ public class JsonResult {
...
@@ -21,13 +41,13 @@ public class JsonResult {
this
.
setMessage
(
message
);
this
.
setMessage
(
message
);
}
}
public
JsonResult
(
ResultCode
code
,
Object
data
)
{
public
JsonResult
(
ResultCode
code
,
T
data
)
{
this
.
setCode
(
code
);
this
.
setCode
(
code
);
this
.
setMessage
(
code
.
msg
());
this
.
setMessage
(
code
.
msg
());
this
.
setData
(
data
);
this
.
setData
(
data
);
}
}
public
JsonResult
(
ResultCode
code
,
String
message
,
Object
data
)
{
public
JsonResult
(
ResultCode
code
,
String
message
,
T
data
)
{
this
.
setCode
(
code
);
this
.
setCode
(
code
);
this
.
setMessage
(
message
);
this
.
setMessage
(
message
);
this
.
setData
(
data
);
this
.
setData
(
data
);
...
@@ -49,11 +69,11 @@ public class JsonResult {
...
@@ -49,11 +69,11 @@ public class JsonResult {
this
.
message
=
message
;
this
.
message
=
message
;
}
}
public
Object
getData
()
{
public
T
getData
()
{
return
data
;
return
data
;
}
}
public
void
setData
(
Object
data
)
{
public
void
setData
(
T
data
)
{
this
.
data
=
data
;
this
.
data
=
data
;
}
}
...
...
src/main/java/com/jz/dmp/modules/controller/DataIntegration/OfflineSynchController.java
View file @
ec2fd30f
...
@@ -3,19 +3,19 @@ package com.jz.dmp.modules.controller.DataIntegration;
...
@@ -3,19 +3,19 @@ package com.jz.dmp.modules.controller.DataIntegration;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
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.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -28,25 +28,39 @@ import java.util.Map;
...
@@ -28,25 +28,39 @@ import java.util.Map;
@RequestMapping
(
"/offlineSynch"
)
@RequestMapping
(
"/offlineSynch"
)
@Api
(
tags
=
"数据集成--离线同步"
)
@Api
(
tags
=
"数据集成--离线同步"
)
public
class
OfflineSynchController
{
public
class
OfflineSynchController
{
@Autowired
private
OfflineSynchService
offlineSynchService
;
/**
@Autowired
* 任务列表分页查询
private
OfflineSynchService
offlineSynchService
;
* @return
*/
/**
@ApiOperation
(
value
=
"任务列表分页查询"
,
notes
=
"任务列表分页查询"
)
* 任务列表分页查询
@PostMapping
(
value
=
"/taskListPage"
)
*
public
PageInfoResponse
<
TaskListPageDto
>
getTaskListPage
(
@RequestBody
@Validated
TaskListPageReq
taskListPageReq
)
{
* @return
PageInfoResponse
<
TaskListPageDto
>
pageInfo
=
new
PageInfoResponse
<
TaskListPageDto
>();
*/
try
{
@ApiOperation
(
value
=
"任务列表分页查询"
,
notes
=
"任务列表分页查询"
)
pageInfo
=
offlineSynchService
.
queryTaskListPage
(
taskListPageReq
);
@PostMapping
(
value
=
"/taskListPage"
)
}
catch
(
Exception
e
)
{
public
PageInfoResponse
<
TaskListPageDto
>
getTaskListPage
(
@RequestBody
@Validated
TaskListPageReq
taskListPageReq
)
{
pageInfo
.
setMessage
(
"查询失败"
);
PageInfoResponse
<
TaskListPageDto
>
pageInfo
=
new
PageInfoResponse
<
TaskListPageDto
>();
pageInfo
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
try
{
e
.
printStackTrace
();
pageInfo
=
offlineSynchService
.
queryTaskListPage
(
taskListPageReq
);
}
}
catch
(
Exception
e
)
{
return
pageInfo
;
pageInfo
.
setMessage
(
"查询失败"
);
}
pageInfo
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
pageInfo
;
}
/**
* 获取源数据库名称——下拉框
*
* @return
*/
@ApiOperation
(
value
=
"获取源数据库名称-下拉框"
,
notes
=
"获取源数据库名称"
)
@GetMapping
(
value
=
"/sourceDbList"
)
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
)
public
JsonResult
<
List
<
SourceDbNameListDto
>>
getSourceDbList
(
@RequestParam
Integer
projectId
)
throws
Exception
{
JsonResult
<
List
<
SourceDbNameListDto
>>
jsonResult
=
offlineSynchService
.
querygSourceDbList
(
projectId
);
return
jsonResult
;
}
}
}
src/main/java/com/jz/dmp/modules/dao/OfflineSynchDao.java
View file @
ec2fd30f
package
com
.
jz
.
dmp
.
modules
.
dao
;
package
com
.
jz
.
dmp
.
modules
.
dao
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
...
@@ -13,4 +14,6 @@ import java.util.Map;
...
@@ -13,4 +14,6 @@ import java.util.Map;
public
interface
OfflineSynchDao
{
public
interface
OfflineSynchDao
{
List
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
List
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
List
<
SourceDbNameListDto
>
querygSourceDbList
(
Map
map
)
throws
Exception
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/OfflineSynchService.java
View file @
ec2fd30f
package
com
.
jz
.
dmp
.
modules
.
service
;
package
com
.
jz
.
dmp
.
modules
.
service
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
...
@@ -14,4 +15,6 @@ import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
...
@@ -14,4 +15,6 @@ import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
public
interface
OfflineSynchService
{
public
interface
OfflineSynchService
{
PageInfoResponse
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
PageInfoResponse
<
TaskListPageDto
>
queryTaskListPage
(
TaskListPageReq
taskListPageReq
)
throws
Exception
;
JsonResult
querygSourceDbList
(
Integer
projectId
)
throws
Exception
;
}
}
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
ec2fd30f
...
@@ -3,8 +3,10 @@ package com.jz.dmp.modules.service.impl;
...
@@ -3,8 +3,10 @@ package com.jz.dmp.modules.service.impl;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.common.constant.Constants
;
import
com.jz.common.constant.Constants
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq
;
import
com.jz.dmp.modules.dao.OfflineSynchDao
;
import
com.jz.dmp.modules.dao.OfflineSynchDao
;
...
@@ -48,4 +50,13 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
...
@@ -48,4 +50,13 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
pageInfoResponse
.
setData
(
pageInfo
);
pageInfoResponse
.
setData
(
pageInfo
);
return
pageInfoResponse
;
return
pageInfoResponse
;
}
}
@Override
public
JsonResult
<
List
<
SourceDbNameListDto
>>
querygSourceDbList
(
Integer
projectId
)
throws
Exception
{
Map
map
=
new
HashMap
();
map
.
put
(
"projectId"
,
projectId
);
//项目id
map
.
put
(
"isEnableSource"
,
"1"
);
List
<
SourceDbNameListDto
>
list
=
offlineSynchDao
.
querygSourceDbList
(
map
);
return
new
JsonResult
(
ResultCode
.
SUCCESS
,
list
);
}
}
}
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
View file @
ec2fd30f
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jz.dmp.modules.dao.OfflineSynchDao"
>
<mapper
namespace=
"com.jz.dmp.modules.dao.OfflineSynchDao"
>
<!--离线任务列表-->
<select
id=
"queryTaskListPage"
resultType=
"com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto"
<select
id=
"queryTaskListPage"
resultType=
"com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto"
parameterType=
"com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq"
>
parameterType=
"com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq"
>
SELECT
SELECT
...
@@ -36,4 +37,28 @@
...
@@ -36,4 +37,28 @@
ORDER BY ddt.create_time DESC
ORDER BY ddt.create_time DESC
</select>
</select>
<!--获取源数据库名称-->
<select
id=
"querygSourceDbList"
parameterType=
"map"
resultType=
"com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto"
>
select
ds.id as id,
ds.datasource_name as datasourceNameOrg,
ds.jdbc_url as jdbcUrl,
dsdt.datasource as datasourceTypeName,
concat(ds.datasource_name, ' (', dsdt.datasource, ')') as datasourceName,
dsdt.datasource_type as datasourceType,
dsdt.datasource_catecode as datasourceCatecode
from dmp_syncing_datasource ds
inner join dmp_syncing_datasource_type dsdt on ds.datasource_type = dsdt.id
<if
test =
'isEnableSource != null and isEnableSource == "1"'
>
and dsdt.is_enable_source = '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}
<if
test =
'datasourceType != null and datasourceType > 0 '
>
and ds.DATASOURCE_TYPE = #{datasourceType}
</if>
</select>
</mapper>
</mapper>
\ No newline at end of file
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