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
af7cc5aa
Commit
af7cc5aa
authored
Dec 30, 2020
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
a433d9c3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
10 deletions
+68
-10
DataSourceController.java
...ules/controller/DataIntegration/DataSourceController.java
+17
-4
DmpSyncingDatasourceTypeController.java
...odules/controller/DmpSyncingDatasourceTypeController.java
+2
-2
DmpSyncingDatasourceDao.java
.../java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
+1
-1
DmpSyncingDatasourceService.java
...m/jz/dmp/modules/service/DmpSyncingDatasourceService.java
+3
-0
DmpSyncingDatasourceServiceImpl.java
...modules/service/impl/DmpSyncingDatasourceServiceImpl.java
+43
-2
DmpSyncingDatasourceMapper.xml
src/main/resources/mapper/dmp/DmpSyncingDatasourceMapper.xml
+2
-1
No files found.
src/main/java/com/jz/dmp/modules/controller/DataIntegration/DataSourceController.java
View file @
af7cc5aa
...
...
@@ -2,15 +2,12 @@ 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.DmpSyncingDatasourceReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.DvRuleTDto
;
import
com.jz.dmp.modules.model.DmpSyncingDatasource
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SyncingDatasourceTypeDto
;
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
;
...
...
@@ -158,4 +155,20 @@ public class DataSourceController {
return
result
;
}
/**
* 获取数据源类型输入框属性
*
* @return
*/
@ApiImplicitParam
(
name
=
"datasourceTypeId"
,
value
=
"数据源类型id"
)
@ApiOperation
(
value
=
"获取数据源类型输入框属性"
,
notes
=
"获取数据源类型输入框属性"
)
@GetMapping
(
value
=
"/getDatasourceTypeAttr"
)
public
JsonResult
<
SyncingDatasourceTypeDto
>
getDatasourceTypeAttr
(
@RequestParam
String
datasourceTypeId
,
HttpServletRequest
httpRequest
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
datasourceTypeId
))
{
return
new
JsonResult
(
ResultCode
.
PARAMS_ERROR
);
}
JsonResult
<
SyncingDatasourceTypeDto
>
result
=
dmpSyncingDatasourceService
.
selectDatasourceTypeAttrById
(
datasourceTypeId
);
return
result
;
}
}
src/main/java/com/jz/dmp/modules/controller/DmpSyncingDatasourceTypeController.java
View file @
af7cc5aa
...
...
@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping
(
"/dmpSyncingDatasourceType"
)
@Api
(
tags
=
"数据源类型"
)
//
@Api(tags = "数据源类型")
public
class
DmpSyncingDatasourceTypeController
{
/**
* 服务对象
...
...
@@ -32,7 +32,7 @@ public class DmpSyncingDatasourceTypeController {
* @return 单条数据
*/
@GetMapping
(
"/selectOne"
)
@ApiOperation
(
value
=
"通过主键查询单条数据"
,
notes
=
"通过主键查询单条数据"
)
//
@ApiOperation(value = "通过主键查询单条数据", notes = "通过主键查询单条数据")
public
DmpSyncingDatasourceType
selectOne
(
Integer
id
)
{
return
this
.
dmpSyncingDatasourceTypeService
.
queryById
(
id
);
}
...
...
src/main/java/com/jz/dmp/modules/dao/DmpSyncingDatasourceDao.java
View file @
af7cc5aa
...
...
@@ -95,7 +95,7 @@ public interface DmpSyncingDatasourceDao {
List
<
Map
>
queryDatasourceType
()
throws
Exception
;
List
<
Map
>
queryGroupDatasourceType
()
throws
Exception
;
List
<
Map
>
queryGroupDatasourceType
(
Map
map
)
throws
Exception
;
int
countDatasourceByName
(
@Param
(
"datasourceName"
)
String
datasourceName
,
@Param
(
"projectId"
)
String
projectId
)
throws
Exception
;
...
...
src/main/java/com/jz/dmp/modules/service/DmpSyncingDatasourceService.java
View file @
af7cc5aa
...
...
@@ -6,6 +6,7 @@ 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.DmpSyncingDatasourceReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SyncingDatasourceTypeDto
;
import
com.jz.dmp.modules.model.DmpSyncingDatasource
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -78,4 +79,6 @@ public interface DmpSyncingDatasourceService {
JsonResult
updateDatasourceById
(
DmpSyncingDatasourceReq
saveBody
)
throws
Exception
;
List
<
DmpSyncingDatasource
>
findListByParams
(
DmpSyncingDatasource
ds
)
throws
Exception
;
JsonResult
<
SyncingDatasourceTypeDto
>
selectDatasourceTypeAttrById
(
String
datasourceTypeId
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpSyncingDatasourceServiceImpl.java
View file @
af7cc5aa
...
...
@@ -13,6 +13,7 @@ import com.jz.dmp.agent.DmpAgentResult;
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.DmpSyncingDatasourceReq
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SyncingDatasourceTypeDto
;
import
com.jz.dmp.modules.dao.DmpProjectDao
;
import
com.jz.dmp.modules.dao.DmpSyncingDatasourceDao
;
import
com.jz.dmp.modules.model.DmpAgentDatasourceInfo
;
...
...
@@ -20,6 +21,7 @@ import com.jz.dmp.modules.model.DmpProjectSystemInfo;
import
com.jz.dmp.modules.model.DmpSyncingDatasource
;
import
com.jz.dmp.modules.model.DmpSyncingDatasourceType
;
import
com.jz.dmp.modules.service.DmpSyncingDatasourceService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -157,8 +159,9 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
*/
@Override
public
JsonResult
queryGroupDatasourceType
()
throws
Exception
{
Map
map
=
new
HashMap
();
Map
<
String
,
ArrayList
<
Map
>>
returnMap
=
new
HashMap
();
List
<
Map
>
list
=
dmpSyncingDatasourceDao
.
queryGroupDatasourceType
();
List
<
Map
>
list
=
dmpSyncingDatasourceDao
.
queryGroupDatasourceType
(
map
);
if
(
list
.
size
()
>
0
&&
list
!=
null
)
{
for
(
Map
<
String
,
Object
>
dto
:
list
)
{
String
datasourceCatename
=
(
String
)
dto
.
get
(
"datasourceCatename"
);
...
...
@@ -244,7 +247,7 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
if
(
StringUtils
.
isNotEmpty
(
saveBody
.
getProjectId
()))
{
dsd
.
setProjectId
(
Integer
.
valueOf
(
saveBody
.
getProjectId
()));
}
if
(
StringUtils
.
isNotEmpty
(
saveBody
.
getDatasourceId
()))
{
//数据源id
if
(
StringUtils
.
isNotEmpty
(
saveBody
.
getDatasourceId
()))
{
//数据源id
dsd
.
setId
(
Integer
.
valueOf
(
saveBody
.
getDatasourceId
()));
}
dsd
.
setDataStatus
(
"1"
);
...
...
@@ -262,6 +265,44 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
return
dmpSyncingDatasourceDao
.
findListByParams
(
ds
);
}
/**
* 获取数据源类型输入框属性
*
* @return
*/
@Override
public
JsonResult
<
SyncingDatasourceTypeDto
>
selectDatasourceTypeAttrById
(
String
datasourceTypeId
)
throws
Exception
{
Map
map
=
new
HashMap
();
map
.
put
(
"datasourceTypeId"
,
datasourceTypeId
);
SyncingDatasourceTypeDto
dto
=
new
SyncingDatasourceTypeDto
();
List
<
Map
>
list
=
dmpSyncingDatasourceDao
.
queryGroupDatasourceType
(
map
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
Map
str
=
list
.
get
(
0
);
if
(
StringUtils
.
isNotEmpty
(
str
.
get
(
"datasourceTypeId"
).
toString
()))
{
dto
.
setDatasourceTypeId
(
str
.
get
(
"datasourceTypeId"
).
toString
());
}
if
(
StringUtils
.
isNotEmpty
(
str
.
get
(
"datasourceCatecode"
).
toString
()))
{
dto
.
setDatasourceCatecode
(
str
.
get
(
"datasourceCatecode"
).
toString
());
}
if
(
StringUtils
.
isNotEmpty
(
str
.
get
(
"datasourceCatename"
).
toString
()))
{
dto
.
setDatasourceCatename
(
str
.
get
(
"datasourceCatename"
).
toString
());
}
if
(
StringUtils
.
isNotEmpty
(
str
.
get
(
"datasourceTypeName"
).
toString
()))
{
dto
.
setDatasourceTypeName
(
str
.
get
(
"datasourceTypeName"
).
toString
());
}
if
(
StringUtils
.
isNotEmpty
(
str
.
get
(
"imgUrl"
).
toString
()))
{
dto
.
setImgUrl
(
str
.
get
(
"imgUrl"
).
toString
());
}
if
(
StringUtils
.
isNotEmpty
(
str
.
get
(
"dbAttrs"
).
toString
()))
{
dto
.
setDbAttrs
(
JSONObject
.
parseObject
(
str
.
get
(
"dbAttrs"
).
toString
()));
}
}
return
new
JsonResult
(
dto
);
}
/*
* 查询数据源 对应的 数据库信息
* */
private
DmpAgentDatasourceInfo
dsInfoDTO
(
DmpSyncingDatasourceReq
body
)
throws
Exception
{
//数据源类型ID去查询
DmpSyncingDatasourceType
type
=
dmpSyncingDatasourceDao
.
queryDatasourceTypeById
(
body
.
getDatasourceType
());
...
...
src/main/resources/mapper/dmp/DmpSyncingDatasourceMapper.xml
View file @
af7cc5aa
...
...
@@ -293,7 +293,7 @@
order by datasource_catetype
</select>
<select
id=
"queryGroupDatasourceType"
resultType=
"map"
>
<select
id=
"queryGroupDatasourceType"
resultType=
"map"
parameterType=
"map"
>
SELECT
id as datasourceTypeId,
datasource as datasourceTypeName,
...
...
@@ -305,6 +305,7 @@
IFNULL(is_enable_test, '0') as isEnableTest
from dmp_syncing_datasource_type
where data_status = '1'
<if
test=
"datasourceTypeId !=null and datasourceTypeId !=''"
>
and id=#{datasourceTypeId}
</if>
order by datasource_catetype
</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