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
fef4fdb3
Commit
fef4fdb3
authored
Dec 24, 2020
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据源 批量删除
parent
58d6a611
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
12 deletions
+55
-12
DataSourceController.java
...ules/controller/DataIntegration/DataSourceController.java
+18
-4
DmpSyncingDatasourceDao.java
.../java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
+2
-0
DmpSyncingDatasourceService.java
...m/jz/dmp/modules/service/DmpSyncingDatasourceService.java
+3
-0
DmpSyncingDatasourceServiceImpl.java
...modules/service/impl/DmpSyncingDatasourceServiceImpl.java
+15
-0
DmpSyncingDatasourceDao.xml
src/main/resources/mapper/dmp/DmpSyncingDatasourceDao.xml
+17
-8
No files found.
src/main/java/com/jz/dmp/modules/controller/DataIntegration/DataSourceController.java
View file @
fef4fdb3
...
...
@@ -10,13 +10,11 @@ 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.ApiImplicitParam
;
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
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -57,4 +55,20 @@ public class DataSourceController {
}
return
pageInfo
;
}
/**
* 批量删除数据源
*
* @return
*/
@ApiImplicitParam
(
name
=
"datasourceId"
,
value
=
"数据源id"
)
@ApiOperation
(
value
=
"批量删除数据源"
,
notes
=
"批量删除数据源"
)
@GetMapping
(
value
=
"/delDataSource"
)
public
JsonResult
delDataSource
(
@RequestParam
String
datasourceId
,
HttpServletRequest
httpRequest
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
datasourceId
)){
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
}
JsonResult
result
=
dmpSyncingDatasourceService
.
delDataSourceById
(
datasourceId
);
return
result
;
}
}
src/main/java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
View file @
fef4fdb3
...
...
@@ -87,4 +87,6 @@ public interface DmpSyncingDatasourceDao {
* @param req
*/
List
<
DataSourceListDto
>
queryDataSourceListPage
(
DataSourceListReq
req
)
throws
Exception
;
void
delDataSourceById
(
@Param
(
"ids"
)
String
[]
ids
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/DmpSyncingDatasourceService.java
View file @
fef4fdb3
package
com
.
jz
.
dmp
.
modules
.
service
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListDto
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListReq
;
...
...
@@ -59,4 +60,6 @@ public interface DmpSyncingDatasourceService {
boolean
deleteById
(
Integer
id
);
PageInfoResponse
<
DataSourceListDto
>
queryDataSourceListPage
(
DataSourceListReq
req
,
HttpServletRequest
httpRequest
)
throws
Exception
;
JsonResult
delDataSourceById
(
String
datasourceId
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpSyncingDatasourceServiceImpl.java
View file @
fef4fdb3
...
...
@@ -2,6 +2,7 @@ package com.jz.dmp.modules.service.impl;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.page.PageInfoResponse
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListDto
;
...
...
@@ -14,6 +15,7 @@ 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.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
...
...
@@ -114,4 +116,17 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
pageInfoResponse
.
setData
(
pageInfo
);
return
pageInfoResponse
;
}
/**
* 批量删除数据源
*
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JsonResult
delDataSourceById
(
String
datasourceId
)
throws
Exception
{
String
[]
ids
=
datasourceId
.
split
(
","
);
dmpSyncingDatasourceDao
.
delDataSourceById
(
ids
);
return
new
JsonResult
();
}
}
\ No newline at end of file
src/main/resources/mapper/dmp/DmpSyncingDatasourceDao.xml
View file @
fef4fdb3
...
...
@@ -32,7 +32,7 @@
<select
id=
"queryById"
resultMap=
"DmpSyncingDatasourceMap"
>
select
ID, DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME, USER_NAME, PASSWORD, ENDPOINT, BUCKET, ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA, DATA_STATUS, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID
from dmp_
web.dmp_
syncing_datasource
from dmp_syncing_datasource
where ID = #{id}
</select>
...
...
@@ -40,7 +40,7 @@
<select
id=
"queryAllByLimit"
resultMap=
"DmpSyncingDatasourceMap"
>
select
ID, DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME, USER_NAME, PASSWORD, ENDPOINT, BUCKET, ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA, DATA_STATUS, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID
from dmp_
web.dmp_
syncing_datasource
from dmp_syncing_datasource
limit #{offset}, #{limit}
</select>
...
...
@@ -50,7 +50,7 @@
ID, DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME, USER_NAME, PASSWORD, ENDPOINT, BUCKET,
ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA, DATA_STATUS, CREATE_USER_ID, CREATE_TIME,
UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID
from dmp_
web.dmp_
syncing_datasource
from dmp_syncing_datasource
<where>
<if
test=
"id != null"
>
and ID = #{id}
...
...
@@ -126,12 +126,12 @@
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into dmp_
web.dmp_
syncing_datasource(DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME, USER_NAME, PASSWORD, ENDPOINT, BUCKET, ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA, DATA_STATUS, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID)
insert into dmp_syncing_datasource(DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME, USER_NAME, PASSWORD, ENDPOINT, BUCKET, ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA, DATA_STATUS, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID)
values (#{datasourceType}, #{datasourceName}, #{datasourceDesc}, #{jdbcUrl}, #{dbName}, #{userName}, #{password}, #{endpoint}, #{bucket}, #{accessId}, #{accessKey}, #{protocol}, #{host}, #{port}, #{defaultFs}, #{tableSchema}, #{dataStatus}, #{createUserId}, #{createTime}, #{updateUserId}, #{updateTime}, #{projectId})
</insert>
<insert
id=
"insertBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into dmp_
web.dmp_
syncing_datasource(DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME,
insert into dmp_syncing_datasource(DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME,
USER_NAME, PASSWORD, ENDPOINT, BUCKET, ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA,
DATA_STATUS, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID)
values
...
...
@@ -145,7 +145,7 @@
</insert>
<insert
id=
"insertOrUpdateBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into dmp_
web.dmp_
syncing_datasource(DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME,
insert into dmp_syncing_datasource(DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME,
USER_NAME, PASSWORD, ENDPOINT, BUCKET, ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA,
DATA_STATUS, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID)
values
...
...
@@ -168,7 +168,7 @@
<!--通过主键修改数据-->
<update
id=
"update"
>
update dmp_
web.dmp_
syncing_datasource
update dmp_syncing_datasource
<set>
<if
test=
"datasourceType != null"
>
DATASOURCE_TYPE = #{datasourceType},
...
...
@@ -242,7 +242,7 @@
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from dmp_
web.dmp_
syncing_datasource where ID = #{id}
delete from dmp_syncing_datasource where ID = #{id}
</delete>
<!--数据源列表查询-->
...
...
@@ -269,4 +269,13 @@
<if
test=
"datasourceName != null and datasourceName !=''"
>
and a.datasource_name like CONCAT('%',#{datasourceName},'%')
</if>
</select>
<!--批量删除-->
<delete
id=
"delDataSourceById"
parameterType=
"map"
>
delete from dmp_syncing_datasource
where ID in
<foreach
collection=
"ids"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</delete>
</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