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
58d6a611
Commit
58d6a611
authored
Dec 24, 2020
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据源列表查询
parent
9f6b65bf
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
825 additions
and
13 deletions
+825
-13
DataSourceController.java
...ules/controller/DataIntegration/DataSourceController.java
+38
-13
DataSourceListDto.java
...es/controller/DataIntegration/bean/DataSourceListDto.java
+184
-0
DataSourceListReq.java
...es/controller/DataIntegration/bean/DataSourceListReq.java
+62
-0
DmpSyncingDatasourceDao.java
.../java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
+90
-0
DmpSyncingDatasourceService.java
...m/jz/dmp/modules/service/DmpSyncingDatasourceService.java
+62
-0
DmpSyncingDatasourceServiceImpl.java
...modules/service/impl/DmpSyncingDatasourceServiceImpl.java
+117
-0
DmpSyncingDatasourceDao.xml
src/main/resources/mapper/dmp/DmpSyncingDatasourceDao.xml
+272
-0
No files found.
src/main/java/com/jz/dmp/modules/controller/DataIntegration/DataSourceController.java
View file @
58d6a611
package
com
.
jz
.
dmp
.
modules
.
controller
.
DataIntegration
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.page.BasePageBean
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DvRuleTDto
;
import
com.jz.dmp.modules.service.DmpSyncingDatasourceService
;
import
com.jz.dmp.modules.service.OfflineSynchService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @Description:数据源
* @ClassName: DataSourceController
...
...
@@ -16,20 +27,34 @@ import org.springframework.web.bind.annotation.RestController;
* @Date 2020/12/20
*/
@RestController
@RequestMapping
(
"/dataSource"
)
@RequestMapping
(
"/dataSource
Mange
"
)
@Api
(
tags
=
"数据集成--数据源"
)
public
class
DataSourceController
{
@Autowired
private
OfflineSynchService
offlineSynchService
;
/**
* 数据源列表分页查询
* @return
*/
@ApiOperation
(
value
=
"数据源列表分页查询"
,
notes
=
"数据源列表分页查询"
)
@PostMapping
(
value
=
"/delRedisKeys"
)
public
JsonResult
delRedisKeys
(
String
key
)
{
return
new
JsonResult
();
}
@Autowired
private
DmpSyncingDatasourceService
dmpSyncingDatasourceService
;
/**
* 数据源列表分页查询
*
* @return
*/
@ApiOperation
(
value
=
"数据源列表分页查询"
,
notes
=
"数据源列表分页查询"
)
@PostMapping
(
value
=
"/dataSourceListPage"
)
public
PageInfoResponse
<
DataSourceListDto
>
getDataSourceListPage
(
@RequestBody
DataSourceListReq
req
,
HttpServletRequest
httpRequest
)
throws
Exception
{
PageInfoResponse
<
DataSourceListDto
>
pageInfo
=
new
PageInfoResponse
<
DataSourceListDto
>();
if
(
StringUtils
.
isEmpty
(
req
.
getProjectId
()))
{
pageInfo
.
setMessage
(
"项目id不能为空!"
);
pageInfo
.
setCode
(
ResultCode
.
PARAMS_ERROR
);
return
pageInfo
;
}
try
{
pageInfo
=
dmpSyncingDatasourceService
.
queryDataSourceListPage
(
req
,
httpRequest
);
}
catch
(
Exception
e
)
{
pageInfo
.
setMessage
(
"查询失败"
);
pageInfo
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
pageInfo
;
}
}
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/DataSourceListDto.java
0 → 100644
View file @
58d6a611
package
com
.
jz
.
dmp
.
modules
.
controller
.
DataIntegration
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.math.BigDecimal
;
/**
* @ClassName: DataSourceListDto
* @Description: 数据源列表返回参数对象
* @Author:Bellamy
* @Date 2020/12/24
* @Version 1.0
*/
@ApiModel
(
value
=
"数据源列表返回参数对象"
,
description
=
"数据源列表返回参数对象"
)
public
class
DataSourceListDto
{
/**
* 数据源id
*/
@ApiModelProperty
(
value
=
"数据源id"
)
private
Long
id
;
/**
* 数据源名称
*/
@ApiModelProperty
(
value
=
"数据源名称"
)
private
String
datasourceName
;
/**
* 数据源类型名称
*/
@ApiModelProperty
(
value
=
"数据源类型名称"
)
private
String
datasourceTypeName
;
/**
* 数据源类型id
*/
@ApiModelProperty
(
value
=
"数据源类型id"
)
private
String
datasourceTypeId
;
/**
* 数据源分类
*/
@ApiModelProperty
(
value
=
"数据源分类"
)
private
String
datasourceCatecode
;
/**
* 数据源描述
*/
@ApiModelProperty
(
value
=
"数据源描述"
)
private
String
datasourceDesc
;
/**
* 连接信息
*/
@ApiModelProperty
(
value
=
"连接信息"
)
private
String
jdbcUrl
;
/**
* 用户名
*/
@ApiModelProperty
(
value
=
"用户名"
)
private
String
userName
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
)
private
String
createTime
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
)
private
String
uptdateTime
;
/**
* 数据库名称
*/
@ApiModelProperty
(
value
=
"数据库名称"
)
private
String
dbName
;
/**
* 项目id
*/
@ApiModelProperty
(
value
=
"项目id"
)
private
String
projectId
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getDatasourceName
()
{
return
datasourceName
;
}
public
void
setDatasourceName
(
String
datasourceName
)
{
this
.
datasourceName
=
datasourceName
;
}
public
String
getDatasourceTypeName
()
{
return
datasourceTypeName
;
}
public
void
setDatasourceTypeName
(
String
datasourceTypeName
)
{
this
.
datasourceTypeName
=
datasourceTypeName
;
}
public
String
getDatasourceTypeId
()
{
return
datasourceTypeId
;
}
public
void
setDatasourceTypeId
(
String
datasourceTypeId
)
{
this
.
datasourceTypeId
=
datasourceTypeId
;
}
public
String
getDatasourceCatecode
()
{
return
datasourceCatecode
;
}
public
void
setDatasourceCatecode
(
String
datasourceCatecode
)
{
this
.
datasourceCatecode
=
datasourceCatecode
;
}
public
String
getDatasourceDesc
()
{
return
datasourceDesc
;
}
public
void
setDatasourceDesc
(
String
datasourceDesc
)
{
this
.
datasourceDesc
=
datasourceDesc
;
}
public
String
getJdbcUrl
()
{
return
jdbcUrl
;
}
public
void
setJdbcUrl
(
String
jdbcUrl
)
{
this
.
jdbcUrl
=
jdbcUrl
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getUptdateTime
()
{
return
uptdateTime
;
}
public
void
setUptdateTime
(
String
uptdateTime
)
{
this
.
uptdateTime
=
uptdateTime
;
}
public
String
getDbName
()
{
return
dbName
;
}
public
void
setDbName
(
String
dbName
)
{
this
.
dbName
=
dbName
;
}
public
String
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
String
projectId
)
{
this
.
projectId
=
projectId
;
}
}
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/DataSourceListReq.java
0 → 100644
View file @
58d6a611
package
com
.
jz
.
dmp
.
modules
.
controller
.
DataIntegration
.
bean
;
import
com.jz.common.page.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
/**
* @ClassName: DataSourceListReq
* @Description: 数据源列表请求参数
* @Author:Bellamy
* @Date 2020/12/24
* @Version 1.0
*/
@ApiModel
(
value
=
"数据源列表请求参数"
,
description
=
"数据源列表请求参数"
)
public
class
DataSourceListReq
extends
BasePageBean
{
/*
* 数据源类型
* */
@ApiModelProperty
(
value
=
"数据源类型"
)
private
String
datasourceTypeId
;
/*
* 数据源名称
* */
@ApiModelProperty
(
value
=
"数据源名称"
)
private
String
datasourceName
;
/*
* 项目id
* */
@ApiModelProperty
(
value
=
"项目id"
)
@NotNull
(
message
=
"项目id不能为空"
)
private
String
projectId
;
public
String
getDatasourceName
()
{
return
datasourceName
;
}
public
void
setDatasourceName
(
String
datasourceName
)
{
this
.
datasourceName
=
datasourceName
;
}
public
String
getDatasourceTypeId
()
{
return
datasourceTypeId
;
}
public
void
setDatasourceTypeId
(
String
datasourceTypeId
)
{
this
.
datasourceTypeId
=
datasourceTypeId
;
}
public
String
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
String
projectId
)
{
this
.
projectId
=
projectId
;
}
}
src/main/java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
0 → 100644
View file @
58d6a611
package
com
.
jz
.
dmp
.
modules
.
dao
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListReq
;
import
com.jz.dmp.modules.model.DmpSyncingDatasource
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 数据源配置(DmpSyncingDatasource)表数据库访问层
*
* @author Bellamy
* @since 2020-12-24 14:09:59
*/
public
interface
DmpSyncingDatasourceDao
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
DmpSyncingDatasource
queryById
(
Integer
id
);
/**
* 查询指定行数据
*
* @param offset 查询起始位置
* @param limit 查询条数
* @return 对象列表
*/
List
<
DmpSyncingDatasource
>
queryAllByLimit
(
@Param
(
"offset"
)
int
offset
,
@Param
(
"limit"
)
int
limit
);
/**
* 通过实体作为筛选条件查询
*
* @param dmpSyncingDatasource 实例对象
* @return 对象列表
*/
List
<
DmpSyncingDatasource
>
queryAll
(
DmpSyncingDatasource
dmpSyncingDatasource
);
/**
* 新增数据
*
* @param dmpSyncingDatasource 实例对象
* @return 影响行数
*/
int
insert
(
DmpSyncingDatasource
dmpSyncingDatasource
);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<DmpSyncingDatasource> 实例对象列表
* @return 影响行数
*/
int
insertBatch
(
@Param
(
"entities"
)
List
<
DmpSyncingDatasource
>
entities
);
/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<DmpSyncingDatasource> 实例对象列表
* @return 影响行数
*/
int
insertOrUpdateBatch
(
@Param
(
"entities"
)
List
<
DmpSyncingDatasource
>
entities
);
/**
* 修改数据
*
* @param dmpSyncingDatasource 实例对象
* @return 影响行数
*/
int
update
(
DmpSyncingDatasource
dmpSyncingDatasource
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int
deleteById
(
Integer
id
);
/**
* 数据源列表查询
*
* @param req
*/
List
<
DataSourceListDto
>
queryDataSourceListPage
(
DataSourceListReq
req
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/DmpSyncingDatasourceService.java
0 → 100644
View file @
58d6a611
package
com
.
jz
.
dmp
.
modules
.
service
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListReq
;
import
com.jz.dmp.modules.model.DmpSyncingDatasource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
/**
* 数据源配置(DmpSyncingDatasource)表服务接口
*
* @author Bellamy
* @since 2020-12-24 14:09:59
*/
public
interface
DmpSyncingDatasourceService
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
DmpSyncingDatasource
queryById
(
Integer
id
);
/**
* 查询多条数据
*
* @param offset 查询起始位置
* @param limit 查询条数
* @return 对象列表
*/
List
<
DmpSyncingDatasource
>
queryAllByLimit
(
int
offset
,
int
limit
);
/**
* 新增数据
*
* @param dmpSyncingDatasource 实例对象
* @return 实例对象
*/
DmpSyncingDatasource
insert
(
DmpSyncingDatasource
dmpSyncingDatasource
);
/**
* 修改数据
*
* @param dmpSyncingDatasource 实例对象
* @return 实例对象
*/
DmpSyncingDatasource
update
(
DmpSyncingDatasource
dmpSyncingDatasource
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean
deleteById
(
Integer
id
);
PageInfoResponse
<
DataSourceListDto
>
queryDataSourceListPage
(
DataSourceListReq
req
,
HttpServletRequest
httpRequest
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpSyncingDatasourceServiceImpl.java
0 → 100644
View file @
58d6a611
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto
;
import
com.jz.dmp.modules.dao.DmpSyncingDatasourceDao
;
import
com.jz.dmp.modules.model.DmpSyncingDatasource
;
import
com.jz.dmp.modules.service.DmpSyncingDatasourceService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 数据源配置(DmpSyncingDatasource)表服务实现类
*
* @author Bellamy
* @since 2020-12-24 14:09:59
*/
@Service
(
"dmpSyncingDatasourceService"
)
@Transactional
public
class
DmpSyncingDatasourceServiceImpl
implements
DmpSyncingDatasourceService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpSyncingDatasourceServiceImpl
.
class
);
@Autowired
private
DmpSyncingDatasourceDao
dmpSyncingDatasourceDao
;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public
DmpSyncingDatasource
queryById
(
Integer
id
)
{
return
this
.
dmpSyncingDatasourceDao
.
queryById
(
id
);
}
/**
* 查询多条数据
*
* @param offset 查询起始位置
* @param limit 查询条数
* @return 对象列表
*/
@Override
public
List
<
DmpSyncingDatasource
>
queryAllByLimit
(
int
offset
,
int
limit
)
{
return
this
.
dmpSyncingDatasourceDao
.
queryAllByLimit
(
offset
,
limit
);
}
/**
* 新增数据
*
* @param dmpSyncingDatasource 实例对象
* @return 实例对象
*/
@Override
public
DmpSyncingDatasource
insert
(
DmpSyncingDatasource
dmpSyncingDatasource
)
{
this
.
dmpSyncingDatasourceDao
.
insert
(
dmpSyncingDatasource
);
return
dmpSyncingDatasource
;
}
/**
* 修改数据
*
* @param dmpSyncingDatasource 实例对象
* @return 实例对象
*/
@Override
public
DmpSyncingDatasource
update
(
DmpSyncingDatasource
dmpSyncingDatasource
)
{
this
.
dmpSyncingDatasourceDao
.
update
(
dmpSyncingDatasource
);
return
this
.
queryById
(
dmpSyncingDatasource
.
getId
());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public
boolean
deleteById
(
Integer
id
)
{
return
this
.
dmpSyncingDatasourceDao
.
deleteById
(
id
)
>
0
;
}
/**
* 数据源列表查询
*
* @param req
*/
@Override
public
PageInfoResponse
<
DataSourceListDto
>
queryDataSourceListPage
(
DataSourceListReq
req
,
HttpServletRequest
httpRequest
)
throws
Exception
{
PageInfoResponse
<
DataSourceListDto
>
pageInfoResponse
=
new
PageInfoResponse
<>();
PageHelper
.
startPage
(
req
.
getPageNum
(),
req
.
getPageSize
());
req
.
setDatasourceName
(
req
.
getDatasourceName
().
trim
());
List
<
DataSourceListDto
>
list
=
dmpSyncingDatasourceDao
.
queryDataSourceListPage
(
req
);
PageInfo
<
DataSourceListDto
>
pageInfo
=
new
PageInfo
<>(
list
);
pageInfoResponse
.
setCode
(
ResultCode
.
SUCCESS
);
pageInfoResponse
.
setMessage
(
"查询成功"
);
pageInfoResponse
.
setData
(
pageInfo
);
return
pageInfoResponse
;
}
}
\ No newline at end of file
src/main/resources/mapper/dmp/DmpSyncingDatasourceDao.xml
0 → 100644
View file @
58d6a611
This diff is collapsed.
Click to expand it.
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