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
43c219ba
Commit
43c219ba
authored
Dec 25, 2020
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据源编辑
parent
1418cbfc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
13 deletions
+120
-13
DataSourceController.java
...ules/controller/DataIntegration/DataSourceController.java
+37
-1
DmpSyncingDatasourceReq.java
...troller/DataIntegration/bean/DmpSyncingDatasourceReq.java
+11
-9
DmpSyncingDatasourceDao.java
.../java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
+5
-2
DmpSyncingDatasourceService.java
...m/jz/dmp/modules/service/DmpSyncingDatasourceService.java
+5
-0
DmpSyncingDatasourceServiceImpl.java
...modules/service/impl/DmpSyncingDatasourceServiceImpl.java
+38
-1
DmpSyncingDatasourceDao.xml
src/main/resources/mapper/dmp/DmpSyncingDatasourceDao.xml
+24
-0
No files found.
src/main/java/com/jz/dmp/modules/controller/DataIntegration/DataSourceController.java
View file @
43c219ba
...
@@ -20,6 +20,8 @@ import org.springframework.validation.annotation.Validated;
...
@@ -20,6 +20,8 @@ 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.Map
;
/**
/**
* @Description:数据源
* @Description:数据源
...
@@ -68,7 +70,7 @@ public class DataSourceController {
...
@@ -68,7 +70,7 @@ public class DataSourceController {
@ApiOperation
(
value
=
"批量删除数据源"
,
notes
=
"批量删除数据源"
)
@ApiOperation
(
value
=
"批量删除数据源"
,
notes
=
"批量删除数据源"
)
@GetMapping
(
value
=
"/delDataSource"
)
@GetMapping
(
value
=
"/delDataSource"
)
public
JsonResult
delDataSource
(
@RequestParam
String
datasourceId
,
HttpServletRequest
httpRequest
)
throws
Exception
{
public
JsonResult
delDataSource
(
@RequestParam
String
datasourceId
,
HttpServletRequest
httpRequest
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
datasourceId
))
{
if
(
StringUtils
.
isEmpty
(
datasourceId
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
}
}
JsonResult
result
=
dmpSyncingDatasourceService
.
delDataSourceById
(
datasourceId
);
JsonResult
result
=
dmpSyncingDatasourceService
.
delDataSourceById
(
datasourceId
);
...
@@ -122,4 +124,38 @@ public class DataSourceController {
...
@@ -122,4 +124,38 @@ public class DataSourceController {
JsonResult
result
=
dmpSyncingDatasourceService
.
testConnection
(
saveBody
);
JsonResult
result
=
dmpSyncingDatasourceService
.
testConnection
(
saveBody
);
return
result
;
return
result
;
}
}
/**
* 编辑数据源,根据id查询数据回显
*
* @return
*/
@ApiOperation
(
value
=
"编辑数据源--根据id查询数据回显"
,
notes
=
"编辑数据源--根据id查询数据回显"
)
@GetMapping
(
value
=
"/selectDataSourceInfoById"
)
public
JsonResult
getDataSourceInfoById
(
@RequestParam
String
datasourceId
,
@RequestParam
(
value
=
"projectId"
,
required
=
false
)
String
projectId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
datasourceId
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
}
Map
map
=
new
HashMap
();
map
.
put
(
"datasourceId"
,
datasourceId
);
map
.
put
(
"projectId"
,
projectId
);
JsonResult
result
=
dmpSyncingDatasourceService
.
selectDataSourceInfoById
(
map
);
return
result
;
}
/**
* 编辑数据源
*
* @return
*/
@ApiOperation
(
value
=
"编辑数据源"
,
notes
=
"编辑数据源"
)
@PostMapping
(
value
=
"/updateDatasourceInfo"
)
public
JsonResult
updateDatasourceInfo
(
@RequestBody
@Validated
DmpSyncingDatasourceReq
saveBody
,
HttpServletRequest
httpRequest
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
saveBody
.
getDatasourceId
()))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
}
JsonResult
result
=
dmpSyncingDatasourceService
.
updateDatasourceById
(
saveBody
);
return
result
;
}
}
}
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/DmpSyncingDatasourceReq.java
View file @
43c219ba
...
@@ -20,12 +20,10 @@ public class DmpSyncingDatasourceReq implements Serializable {
...
@@ -20,12 +20,10 @@ public class DmpSyncingDatasourceReq implements Serializable {
* 数据源ID
* 数据源ID
*/
*/
@ApiModelProperty
(
value
=
"数据源ID"
)
@ApiModelProperty
(
value
=
"数据源ID"
)
private
String
i
d
;
private
String
datasourceI
d
;
/**
/**
* 数据源类型ID
* 数据源类型ID
*/
*/
@NotNull
(
message
=
"数据源类型ID不能为空"
)
@NotEmpty
(
message
=
"数据源类型ID不能为空"
)
@ApiModelProperty
(
value
=
"数据源类型ID"
)
@ApiModelProperty
(
value
=
"数据源类型ID"
)
private
String
datasourceType
;
private
String
datasourceType
;
/**
/**
...
@@ -43,6 +41,8 @@ public class DmpSyncingDatasourceReq implements Serializable {
...
@@ -43,6 +41,8 @@ public class DmpSyncingDatasourceReq implements Serializable {
/**
/**
* JDBC URL
* JDBC URL
*/
*/
@NotNull
(
message
=
"JDBC URL不能为空"
)
@NotEmpty
(
message
=
"JDBC URL不能为空"
)
@ApiModelProperty
(
value
=
"JDBC URL"
)
@ApiModelProperty
(
value
=
"JDBC URL"
)
private
String
jdbcUrl
;
private
String
jdbcUrl
;
/**
/**
...
@@ -53,11 +53,15 @@ public class DmpSyncingDatasourceReq implements Serializable {
...
@@ -53,11 +53,15 @@ public class DmpSyncingDatasourceReq implements Serializable {
/**
/**
* 账号
* 账号
*/
*/
@NotNull
(
message
=
"账号不能为空"
)
@NotEmpty
(
message
=
"账号不能为空"
)
@ApiModelProperty
(
value
=
"账号"
)
@ApiModelProperty
(
value
=
"账号"
)
private
String
userName
;
private
String
userName
;
/**
/**
* 密码
* 密码
*/
*/
@NotNull
(
message
=
"密码不能为空"
)
@NotEmpty
(
message
=
"密码不能为空"
)
@ApiModelProperty
(
value
=
"密码"
)
@ApiModelProperty
(
value
=
"密码"
)
private
String
password
;
private
String
password
;
/**
/**
...
@@ -109,8 +113,6 @@ public class DmpSyncingDatasourceReq implements Serializable {
...
@@ -109,8 +113,6 @@ public class DmpSyncingDatasourceReq implements Serializable {
/**
/**
* 项目ID
* 项目ID
*/
*/
@NotNull
(
message
=
"项目ID不能为空"
)
@NotEmpty
(
message
=
"项目ID不能为空"
)
@ApiModelProperty
(
value
=
"项目ID"
)
@ApiModelProperty
(
value
=
"项目ID"
)
private
String
projectId
;
private
String
projectId
;
...
@@ -121,12 +123,12 @@ public class DmpSyncingDatasourceReq implements Serializable {
...
@@ -121,12 +123,12 @@ public class DmpSyncingDatasourceReq implements Serializable {
@ApiModelProperty
(
value
=
"网络连接类型"
)
@ApiModelProperty
(
value
=
"网络连接类型"
)
private
String
networkConnectionType
;
private
String
networkConnectionType
;
public
String
getId
()
{
public
String
get
Datasource
Id
()
{
return
i
d
;
return
datasourceI
d
;
}
}
public
void
set
Id
(
String
i
d
)
{
public
void
set
DatasourceId
(
String
datasourceI
d
)
{
this
.
id
=
i
d
;
this
.
datasourceId
=
datasourceI
d
;
}
}
public
String
getDatasourceType
()
{
public
String
getDatasourceType
()
{
...
...
src/main/java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
View file @
43c219ba
...
@@ -97,7 +97,10 @@ public interface DmpSyncingDatasourceDao {
...
@@ -97,7 +97,10 @@ public interface DmpSyncingDatasourceDao {
List
<
Map
>
queryGroupDatasourceType
()
throws
Exception
;
List
<
Map
>
queryGroupDatasourceType
()
throws
Exception
;
int
countDatasourceByName
(
@Param
(
"datasourceName"
)
String
datasourceName
,
@Param
(
"projectId"
)
String
projectId
);
int
countDatasourceByName
(
@Param
(
"datasourceName"
)
String
datasourceName
,
@Param
(
"projectId"
)
String
projectId
)
throws
Exception
;
DmpSyncingDatasourceType
queryDatasourceTypeById
(
@Param
(
"datasourceTypeId"
)
String
datasourceTypeId
)
throws
Exception
;
DataSourceListDto
selectDataSourceInfoById
(
Map
map
)
throws
Exception
;
DmpSyncingDatasourceType
queryDatasourceTypeById
(
@Param
(
"datasourceTypeId"
)
String
datasourceTypeId
);
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/DmpSyncingDatasourceService.java
View file @
43c219ba
...
@@ -10,6 +10,7 @@ import com.jz.dmp.modules.model.DmpSyncingDatasource;
...
@@ -10,6 +10,7 @@ import com.jz.dmp.modules.model.DmpSyncingDatasource;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 数据源配置(DmpSyncingDatasource)表服务接口
* 数据源配置(DmpSyncingDatasource)表服务接口
...
@@ -71,4 +72,8 @@ public interface DmpSyncingDatasourceService {
...
@@ -71,4 +72,8 @@ public interface DmpSyncingDatasourceService {
JsonResult
addDatasourceInfo
(
DmpSyncingDatasourceReq
saveBody
)
throws
Exception
;
JsonResult
addDatasourceInfo
(
DmpSyncingDatasourceReq
saveBody
)
throws
Exception
;
JsonResult
testConnection
(
DmpSyncingDatasourceReq
saveBody
)
throws
Exception
;
JsonResult
testConnection
(
DmpSyncingDatasourceReq
saveBody
)
throws
Exception
;
JsonResult
selectDataSourceInfoById
(
Map
map
)
throws
Exception
;
JsonResult
updateDatasourceById
(
DmpSyncingDatasourceReq
saveBody
)
throws
Exception
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpSyncingDatasourceServiceImpl.java
View file @
43c219ba
...
@@ -220,7 +220,44 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
...
@@ -220,7 +220,44 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
}
}
}
}
private
DmpAgentDatasourceInfo
dsInfoDTO
(
DmpSyncingDatasourceReq
body
)
{
@Override
public
JsonResult
selectDataSourceInfoById
(
Map
map
)
throws
Exception
{
DataSourceListDto
asd
=
dmpSyncingDatasourceDao
.
selectDataSourceInfoById
(
map
);
return
new
JsonResult
(
asd
);
}
/**
* 编辑数据源
*
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
JsonResult
updateDatasourceById
(
DmpSyncingDatasourceReq
saveBody
)
throws
Exception
{
DmpSyncingDatasource
dsd
=
new
DmpSyncingDatasource
();
BeanUtils
.
copyProperties
(
saveBody
,
dsd
);
dsd
.
setUpdateTime
(
new
Date
());
if
(
StringUtils
.
isNotEmpty
(
saveBody
.
getDatasourceType
()))
{
dsd
.
setDatasourceType
(
Integer
.
valueOf
(
saveBody
.
getDatasourceType
()));
//数据源类型ID
}
if
(
StringUtils
.
isNotEmpty
(
saveBody
.
getProjectId
()))
{
dsd
.
setProjectId
(
Integer
.
valueOf
(
saveBody
.
getProjectId
()));
}
if
(
StringUtils
.
isNotEmpty
(
saveBody
.
getDatasourceId
())){
//数据源id
dsd
.
setId
(
Integer
.
valueOf
(
saveBody
.
getDatasourceId
()));
}
dsd
.
setDataStatus
(
"1"
);
int
len
=
dmpSyncingDatasourceDao
.
update
(
dsd
);
if
(
len
>
0
)
{
return
new
JsonResult
();
}
else
{
return
new
JsonResult
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
}
private
DmpAgentDatasourceInfo
dsInfoDTO
(
DmpSyncingDatasourceReq
body
)
throws
Exception
{
//数据源类型ID去查询
//数据源类型ID去查询
DmpSyncingDatasourceType
type
=
dmpSyncingDatasourceDao
.
queryDatasourceTypeById
(
body
.
getDatasourceType
());
DmpSyncingDatasourceType
type
=
dmpSyncingDatasourceDao
.
queryDatasourceTypeById
(
body
.
getDatasourceType
());
DmpAgentDatasourceInfo
ds
=
new
DmpAgentDatasourceInfo
();
DmpAgentDatasourceInfo
ds
=
new
DmpAgentDatasourceInfo
();
...
...
src/main/resources/mapper/dmp/DmpSyncingDatasourceDao.xml
View file @
43c219ba
...
@@ -238,6 +238,9 @@
...
@@ -238,6 +238,9 @@
<if
test=
"projectId != null"
>
<if
test=
"projectId != null"
>
PROJECT_ID = #{projectId},
PROJECT_ID = #{projectId},
</if>
</if>
<if
test=
"networkConnectionType != null"
>
NETWORK_CONNECTION_TYPE = #{networkConnectionType},
</if>
</set>
</set>
where ID = #{id}
where ID = #{id}
</update>
</update>
...
@@ -325,4 +328,25 @@
...
@@ -325,4 +328,25 @@
where id=#{datasourceTypeId}
where id=#{datasourceTypeId}
</select>
</select>
<!--数据源列表查询-->
<select
id=
"selectDataSourceInfoById"
parameterType=
"map"
resultType=
"com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListDto"
>
select
b.datasource_catecode as datasourceCatecode,
b.datasource_type as datasourceTypeName,
a.datasource_name as datasourceName,
a.datasource_desc as datasourceDesc,
a.id as id,
a.datasource_type as datasourceTypeId,
a.jdbc_url as jdbcUrl,
a.db_name as dbName,
a.user_name as userName,
a.project_id as projectId
from dmp_syncing_datasource a
left join dmp_syncing_datasource_type b on a.datasource_type = b.id
where a.data_status = '1'
and a.id =#{datasourceId}
<if
test=
"projectId != null and projectId !=''"
>
and a.project_id = #{projectId}
</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