Commit ec2fd30f authored by mcb's avatar mcb

获取源数据库下拉框

parent cbd215fb
package com.jz.common.constant;
public class JsonResult {
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "接口返回对象", description = "接口返回对象")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class JsonResult<T> {
/**
* 返回代码
*/
@ApiModelProperty(value = "返回代码")
private String code;
/**
* 返回处理消息
*/
@ApiModelProperty(value = "返回处理消息")
private String message;
private Object data;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private T data;
public JsonResult() {
this.setCode(ResultCode.SUCCESS);
this.setMessage("成功?");
this.setMessage("成功?");
}
public JsonResult(ResultCode code) {
......@@ -21,13 +41,13 @@ public class JsonResult {
this.setMessage(message);
}
public JsonResult(ResultCode code, Object data) {
public JsonResult(ResultCode code, T data) {
this.setCode(code);
this.setMessage(code.msg());
this.setData(data);
}
public JsonResult(ResultCode code, String message, Object data) {
public JsonResult(ResultCode code, String message, T data) {
this.setCode(code);
this.setMessage(message);
this.setData(data);
......@@ -49,11 +69,11 @@ public class JsonResult {
this.message = message;
}
public Object getData() {
public T getData() {
return data;
}
public void setData(Object data) {
public void setData(T data) {
this.data = data;
}
......
......@@ -3,19 +3,19 @@ package com.jz.dmp.modules.controller.DataIntegration;
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.SourceDbNameListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
import com.jz.dmp.modules.service.OfflineSynchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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 java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -34,6 +34,7 @@ public class OfflineSynchController {
/**
* 任务列表分页查询
*
* @return
*/
@ApiOperation(value = "任务列表分页查询", notes = "任务列表分页查询")
......@@ -49,4 +50,17 @@ public class OfflineSynchController {
}
return pageInfo;
}
/**
* 获取源数据库名称——下拉框
*
* @return
*/
@ApiOperation(value = "获取源数据库名称-下拉框", notes = "获取源数据库名称")
@GetMapping(value = "/sourceDbList")
@ApiImplicitParam(name = "projectId",value = "项目id")
public JsonResult<List<SourceDbNameListDto>> getSourceDbList(@RequestParam Integer projectId) throws Exception {
JsonResult<List<SourceDbNameListDto>> jsonResult = offlineSynchService.querygSourceDbList(projectId);
return jsonResult;
}
}
package com.jz.dmp.modules.dao;
import com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
......@@ -13,4 +14,6 @@ import java.util.Map;
public interface OfflineSynchDao {
List<TaskListPageDto> queryTaskListPage(TaskListPageReq taskListPageReq) throws Exception;
List<SourceDbNameListDto> querygSourceDbList(Map map) throws Exception;
}
\ No newline at end of file
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.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
......@@ -14,4 +15,6 @@ import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
public interface OfflineSynchService {
PageInfoResponse<TaskListPageDto> queryTaskListPage(TaskListPageReq taskListPageReq) throws Exception;
JsonResult querygSourceDbList(Integer projectId) throws Exception;
}
......@@ -3,8 +3,10 @@ package com.jz.dmp.modules.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.constant.Constants;
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.SourceDbNameListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
import com.jz.dmp.modules.dao.OfflineSynchDao;
......@@ -48,4 +50,13 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
@Override
public JsonResult<List<SourceDbNameListDto>> querygSourceDbList(Integer projectId) throws Exception {
Map map = new HashMap();
map.put("projectId", projectId); //项目id
map.put("isEnableSource", "1");
List<SourceDbNameListDto> list = offlineSynchDao.querygSourceDbList(map);
return new JsonResult(ResultCode.SUCCESS, list);
}
}
......@@ -2,6 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.dmp.modules.dao.OfflineSynchDao">
<!--离线任务列表-->
<select id="queryTaskListPage" resultType="com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto"
parameterType="com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq">
SELECT
......@@ -36,4 +37,28 @@
ORDER BY ddt.create_time DESC
</select>
<!--获取源数据库名称-->
<select id="querygSourceDbList" parameterType="map" resultType="com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto">
select
ds.id as id,
ds.datasource_name as datasourceNameOrg,
ds.jdbc_url as jdbcUrl,
dsdt.datasource as datasourceTypeName,
concat(ds.datasource_name, ' (', dsdt.datasource, ')') as datasourceName,
dsdt.datasource_type as datasourceType,
dsdt.datasource_catecode as datasourceCatecode
from dmp_syncing_datasource ds
inner join dmp_syncing_datasource_type dsdt on ds.datasource_type = dsdt.id
<if test = 'isEnableSource != null and isEnableSource == "1"'>
and dsdt.is_enable_source = '1'
</if>
<if test = "isEnableTarget != null and isEnableTarget=='1'.toString()">
and dsdt.is_enable_target = '1'
</if>
where ds.data_status = '1'
and ds.project_id = #{projectId}
<if test = 'datasourceType != null and datasourceType > 0 '>
and ds.DATASOURCE_TYPE = #{datasourceType}
</if>
</select>
</mapper>
\ No newline at end of file
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