Commit af7cc5aa authored by mcb's avatar mcb

no message

parent a433d9c3
...@@ -2,15 +2,12 @@ package com.jz.dmp.modules.controller.DataIntegration; ...@@ -2,15 +2,12 @@ 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.BasePageBean;
import com.jz.common.page.PageInfoResponse; import com.jz.common.page.PageInfoResponse;
import com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListDto; 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.DataSourceListReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.DmpSyncingDatasourceReq; import com.jz.dmp.modules.controller.DataIntegration.bean.DmpSyncingDatasourceReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.DvRuleTDto; import com.jz.dmp.modules.controller.DataIntegration.bean.SyncingDatasourceTypeDto;
import com.jz.dmp.modules.model.DmpSyncingDatasource;
import com.jz.dmp.modules.service.DmpSyncingDatasourceService; import com.jz.dmp.modules.service.DmpSyncingDatasourceService;
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.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -158,4 +155,20 @@ public class DataSourceController { ...@@ -158,4 +155,20 @@ public class DataSourceController {
return result; 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;
}
} }
...@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@RestController @RestController
@RequestMapping("/dmpSyncingDatasourceType") @RequestMapping("/dmpSyncingDatasourceType")
@Api(tags = "数据源类型") //@Api(tags = "数据源类型")
public class DmpSyncingDatasourceTypeController { public class DmpSyncingDatasourceTypeController {
/** /**
* 服务对象 * 服务对象
...@@ -32,7 +32,7 @@ public class DmpSyncingDatasourceTypeController { ...@@ -32,7 +32,7 @@ public class DmpSyncingDatasourceTypeController {
* @return 单条数据 * @return 单条数据
*/ */
@GetMapping("/selectOne") @GetMapping("/selectOne")
@ApiOperation(value = "通过主键查询单条数据", notes = "通过主键查询单条数据") //@ApiOperation(value = "通过主键查询单条数据", notes = "通过主键查询单条数据")
public DmpSyncingDatasourceType selectOne(Integer id) { public DmpSyncingDatasourceType selectOne(Integer id) {
return this.dmpSyncingDatasourceTypeService.queryById(id); return this.dmpSyncingDatasourceTypeService.queryById(id);
} }
......
...@@ -95,7 +95,7 @@ public interface DmpSyncingDatasourceDao { ...@@ -95,7 +95,7 @@ public interface DmpSyncingDatasourceDao {
List<Map> queryDatasourceType() throws Exception; 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; int countDatasourceByName(@Param("datasourceName") String datasourceName, @Param("projectId") String projectId) throws Exception;
......
...@@ -6,6 +6,7 @@ import com.jz.common.page.PageInfoResponse; ...@@ -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.DataSourceListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListReq; 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.DmpSyncingDatasourceReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.SyncingDatasourceTypeDto;
import com.jz.dmp.modules.model.DmpSyncingDatasource; import com.jz.dmp.modules.model.DmpSyncingDatasource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -78,4 +79,6 @@ public interface DmpSyncingDatasourceService { ...@@ -78,4 +79,6 @@ public interface DmpSyncingDatasourceService {
JsonResult updateDatasourceById(DmpSyncingDatasourceReq saveBody) throws Exception; JsonResult updateDatasourceById(DmpSyncingDatasourceReq saveBody) throws Exception;
List<DmpSyncingDatasource> findListByParams(DmpSyncingDatasource ds) throws Exception; List<DmpSyncingDatasource> findListByParams(DmpSyncingDatasource ds) throws Exception;
JsonResult<SyncingDatasourceTypeDto> selectDatasourceTypeAttrById(String datasourceTypeId) throws Exception;
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ import com.jz.dmp.agent.DmpAgentResult; ...@@ -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.DataSourceListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceListReq; 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.DmpSyncingDatasourceReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.SyncingDatasourceTypeDto;
import com.jz.dmp.modules.dao.DmpProjectDao; import com.jz.dmp.modules.dao.DmpProjectDao;
import com.jz.dmp.modules.dao.DmpSyncingDatasourceDao; import com.jz.dmp.modules.dao.DmpSyncingDatasourceDao;
import com.jz.dmp.modules.model.DmpAgentDatasourceInfo; import com.jz.dmp.modules.model.DmpAgentDatasourceInfo;
...@@ -20,6 +21,7 @@ import com.jz.dmp.modules.model.DmpProjectSystemInfo; ...@@ -20,6 +21,7 @@ import com.jz.dmp.modules.model.DmpProjectSystemInfo;
import com.jz.dmp.modules.model.DmpSyncingDatasource; import com.jz.dmp.modules.model.DmpSyncingDatasource;
import com.jz.dmp.modules.model.DmpSyncingDatasourceType; import com.jz.dmp.modules.model.DmpSyncingDatasourceType;
import com.jz.dmp.modules.service.DmpSyncingDatasourceService; import com.jz.dmp.modules.service.DmpSyncingDatasourceService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -157,8 +159,9 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ ...@@ -157,8 +159,9 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
*/ */
@Override @Override
public JsonResult queryGroupDatasourceType() throws Exception { public JsonResult queryGroupDatasourceType() throws Exception {
Map map = new HashMap();
Map<String, ArrayList<Map>> returnMap = 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) { if (list.size() > 0 && list != null) {
for (Map<String, Object> dto : list) { for (Map<String, Object> dto : list) {
String datasourceCatename = (String) dto.get("datasourceCatename"); String datasourceCatename = (String) dto.get("datasourceCatename");
...@@ -244,7 +247,7 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ ...@@ -244,7 +247,7 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
if (StringUtils.isNotEmpty(saveBody.getProjectId())) { if (StringUtils.isNotEmpty(saveBody.getProjectId())) {
dsd.setProjectId(Integer.valueOf(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.setId(Integer.valueOf(saveBody.getDatasourceId()));
} }
dsd.setDataStatus("1"); dsd.setDataStatus("1");
...@@ -262,6 +265,44 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ ...@@ -262,6 +265,44 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
return dmpSyncingDatasourceDao.findListByParams(ds); 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 { private DmpAgentDatasourceInfo dsInfoDTO(DmpSyncingDatasourceReq body) throws Exception {
//数据源类型ID去查询 //数据源类型ID去查询
DmpSyncingDatasourceType type = dmpSyncingDatasourceDao.queryDatasourceTypeById(body.getDatasourceType()); DmpSyncingDatasourceType type = dmpSyncingDatasourceDao.queryDatasourceTypeById(body.getDatasourceType());
......
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
order by datasource_catetype order by datasource_catetype
</select> </select>
<select id="queryGroupDatasourceType" resultType="map"> <select id="queryGroupDatasourceType" resultType="map" parameterType="map">
SELECT SELECT
id as datasourceTypeId, id as datasourceTypeId,
datasource as datasourceTypeName, datasource as datasourceTypeName,
...@@ -305,6 +305,7 @@ ...@@ -305,6 +305,7 @@
IFNULL(is_enable_test, '0') as isEnableTest IFNULL(is_enable_test, '0') as isEnableTest
from dmp_syncing_datasource_type from dmp_syncing_datasource_type
where data_status = '1' where data_status = '1'
<if test="datasourceTypeId !=null and datasourceTypeId !=''">and id=#{datasourceTypeId}</if>
order by datasource_catetype order by datasource_catetype
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment