数据源,添加,修改,删除,测试连接
parent
03eecd791d
commit
1378c3f5e8
|
@ -136,6 +136,11 @@
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>redis.clients</groupId>
|
||||||
|
<artifactId>jedis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.etl.data.source.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.annotation.Excel;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源信息对象 data_source
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("data_source")
|
||||||
|
public class DataSource extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源名称")
|
||||||
|
private String dataSourceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源系统名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源系统名称")
|
||||||
|
private String dataSourceSystemName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源类型")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源ip地址
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源ip地址")
|
||||||
|
private String dataSourceIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口号
|
||||||
|
*/
|
||||||
|
@Excel(name = "端口号")
|
||||||
|
private String dataSourcePort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接数据库名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "连接数据库名称")
|
||||||
|
private String dataSourceDatabaseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String dataSourceUsername;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String dataSourcePassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外配置
|
||||||
|
*/
|
||||||
|
private String additionalConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化连接数量
|
||||||
|
*/
|
||||||
|
private Long initialNumberOfConnections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大连接数量
|
||||||
|
*/
|
||||||
|
private Long maximumNumberOfConnections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大等待时间
|
||||||
|
*/
|
||||||
|
private Long maximumWaitingTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大等待次数
|
||||||
|
*/
|
||||||
|
private Long maximumWaitingTimes;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
package com.etl.data.source.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.annotation.Excel;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源信息对象 data_source
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("data_source")
|
||||||
|
public class DataSourceResp extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源名称")
|
||||||
|
private String dataSourceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源系统名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源系统名称")
|
||||||
|
private String dataSourceSystemName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源类型")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "数据源类型")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源ip地址
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源ip地址")
|
||||||
|
private String dataSourceIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口号
|
||||||
|
*/
|
||||||
|
@Excel(name = "端口号")
|
||||||
|
private String dataSourcePort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接数据库名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "连接数据库名称")
|
||||||
|
private String dataSourceDatabaseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@Excel(name = "用户名")
|
||||||
|
private String dataSourceUsername;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
@Excel(name = "密码")
|
||||||
|
private String dataSourcePassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外配置
|
||||||
|
*/
|
||||||
|
@Excel(name = "额外配置")
|
||||||
|
private String additionalConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化连接数量
|
||||||
|
*/
|
||||||
|
@Excel(name = "初始化连接数量")
|
||||||
|
private Long initialNumberOfConnections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大连接数量
|
||||||
|
*/
|
||||||
|
@Excel(name = "最大连接数量")
|
||||||
|
private Long maximumNumberOfConnections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大等待时间
|
||||||
|
*/
|
||||||
|
@Excel(name = "最大等待时间")
|
||||||
|
private Long maximumWaitingTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大等待次数
|
||||||
|
*/
|
||||||
|
@Excel(name = "最大等待次数")
|
||||||
|
private Long maximumWaitingTimes;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.etl.data.type.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.annotation.Excel;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型对象 data_type
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("data_type")
|
||||||
|
public class DataType extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源类型")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.etl.source;
|
package com.etl;
|
||||||
|
|
||||||
import com.etl.common.security.annotation.EnableCustomConfig;
|
import com.etl.common.security.annotation.EnableCustomConfig;
|
||||||
import com.etl.common.security.annotation.EnableMyFeignClients;
|
import com.etl.common.security.annotation.EnableMyFeignClients;
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.etl.data.source.controller;
|
||||||
|
|
||||||
|
import com.etl.common.core.domain.Result;
|
||||||
|
import com.etl.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.etl.common.core.web.controller.BaseController;
|
||||||
|
import com.etl.common.core.web.page.TableDataInfo;
|
||||||
|
import com.etl.common.log.annotation.Log;
|
||||||
|
import com.etl.common.log.enums.BusinessType;
|
||||||
|
import com.etl.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
import com.etl.data.source.domain.resp.DataSourceResp;
|
||||||
|
import com.etl.data.source.service.IDataSourceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源信息Controller
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/source")
|
||||||
|
public class DataSourceController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IDataSourceService dataSourceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源信息列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:source:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<DataSourceResp>> list(DataSource dataSource) {
|
||||||
|
startPage();
|
||||||
|
List<DataSourceResp> list = dataSourceService.selectDataSourceList(dataSource);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据源信息列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:source:export")
|
||||||
|
@Log(title = "数据源信息", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DataSource dataSource) {
|
||||||
|
List<DataSourceResp> list = dataSourceService.selectDataSourceList(dataSource);
|
||||||
|
ExcelUtil<DataSourceResp> util = new ExcelUtil<DataSourceResp>(DataSourceResp.class);
|
||||||
|
util.exportExcel(response, list, "数据源信息数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据源信息详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:source:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(dataSourceService.selectDataSourceById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:source:add")
|
||||||
|
@Log(title = "数据源信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody DataSource dataSource) {
|
||||||
|
return toAjax(dataSourceService.insertDataSource(dataSource));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:source:edit")
|
||||||
|
@Log(title = "数据源信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody DataSource dataSource) {
|
||||||
|
return toAjax(dataSourceService.updateDataSource(dataSource));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:source:remove")
|
||||||
|
@Log(title = "数据源信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(dataSourceService.deleteDataSourceByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试链接
|
||||||
|
* @param id 数据源id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:source:testConnection")
|
||||||
|
@PostMapping(value = "testConnection/{id}")
|
||||||
|
public Result testConnection(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(dataSourceService.testConnection(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.etl.data.source.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
public interface DataSourceMapper extends BaseMapper<DataSource> {
|
||||||
|
/**
|
||||||
|
* 查询数据源信息
|
||||||
|
*
|
||||||
|
* @param id 数据源信息主键
|
||||||
|
* @return 数据源信息
|
||||||
|
*/
|
||||||
|
public DataSource selectDataSourceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源信息列表
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 数据源信息集合
|
||||||
|
*/
|
||||||
|
public List<DataSource> selectDataSourceList(DataSource dataSource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源信息
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDataSource(DataSource dataSource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源信息
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDataSource(DataSource dataSource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源信息
|
||||||
|
*
|
||||||
|
* @param id 数据源信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataSourceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataSourceByIds(Long[] ids);
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.etl.data.source.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
import com.etl.data.source.domain.resp.DataSourceResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源信息Service接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
public interface IDataSourceService extends IService<DataSource> {
|
||||||
|
/**
|
||||||
|
* 查询数据源信息
|
||||||
|
*
|
||||||
|
* @param id 数据源信息主键
|
||||||
|
* @return 数据源信息
|
||||||
|
*/
|
||||||
|
public DataSource selectDataSourceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源信息列表
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 数据源信息集合
|
||||||
|
*/
|
||||||
|
public List<DataSourceResp> selectDataSourceList(DataSource dataSource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源信息
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDataSource(DataSource dataSource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源信息
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDataSource(DataSource dataSource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据源信息主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataSourceByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源信息信息
|
||||||
|
*
|
||||||
|
* @param id 数据源信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataSourceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试连接
|
||||||
|
* @param id 数据源id
|
||||||
|
*/
|
||||||
|
boolean testConnection(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,211 @@
|
||||||
|
package com.etl.data.source.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.common.core.utils.DateUtils;
|
||||||
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
import com.etl.data.source.domain.resp.DataSourceResp;
|
||||||
|
import com.etl.data.source.mapper.DataSourceMapper;
|
||||||
|
import com.etl.data.source.service.IDataSourceService;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
import com.etl.data.type.service.IDataTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSource> implements IDataSourceService {
|
||||||
|
@Autowired
|
||||||
|
private DataSourceMapper dataSourceMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDataTypeService dataTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源信息
|
||||||
|
*
|
||||||
|
* @param id 数据源信息主键
|
||||||
|
* @return 数据源信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DataSource selectDataSourceById(Long id) {
|
||||||
|
return dataSourceMapper.selectDataSourceById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源信息列表
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 数据源信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DataSourceResp> selectDataSourceList(DataSource dataSource) {
|
||||||
|
List<DataSource> dataSources = dataSourceMapper.selectDataSourceList(dataSource);
|
||||||
|
List<DataType> dataTypeList = dataTypeService.list();
|
||||||
|
List<DataSourceResp> dataSourceResps = new ArrayList<>();
|
||||||
|
dataSources.stream().forEach(
|
||||||
|
source -> {
|
||||||
|
dataTypeList.stream().forEach(
|
||||||
|
dataType -> {
|
||||||
|
if (dataType.getId().equals(source.getTypeId())) {
|
||||||
|
DataSourceResp build = DataSourceResp.builder()
|
||||||
|
.id(source.getId())
|
||||||
|
.dataSourceName(source.getDataSourceName())
|
||||||
|
.dataSourceSystemName(source.getDataSourceSystemName())
|
||||||
|
.typeId(source.getTypeId())
|
||||||
|
.dataType(dataType.getDataType())
|
||||||
|
.dataSourceIp(source.getDataSourceIp())
|
||||||
|
.dataSourcePort(source.getDataSourcePort())
|
||||||
|
.dataSourceDatabaseName(source.getDataSourceDatabaseName())
|
||||||
|
.dataSourceUsername(source.getDataSourceUsername())
|
||||||
|
.dataSourcePassword(source.getDataSourcePassword())
|
||||||
|
.additionalConfiguration(source.getAdditionalConfiguration())
|
||||||
|
.status(source.getStatus())
|
||||||
|
.initialNumberOfConnections(source.getInitialNumberOfConnections())
|
||||||
|
.maximumNumberOfConnections(source.getMaximumNumberOfConnections())
|
||||||
|
.maximumWaitingTime(source.getMaximumWaitingTime())
|
||||||
|
.maximumWaitingTimes(source.getMaximumWaitingTimes())
|
||||||
|
.remark(source.getRemark())
|
||||||
|
.build();
|
||||||
|
dataSourceResps.add(build);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return dataSourceResps;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源信息
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertDataSource(DataSource dataSource) {
|
||||||
|
dataSource.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return dataSourceMapper.insertDataSource(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源信息
|
||||||
|
*
|
||||||
|
* @param dataSource 数据源信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateDataSource(DataSource dataSource) {
|
||||||
|
dataSource.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return dataSourceMapper.updateDataSource(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据源信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDataSourceByIds(Long[] ids) {
|
||||||
|
return dataSourceMapper.deleteDataSourceByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源信息信息
|
||||||
|
*
|
||||||
|
* @param id 数据源信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDataSourceById(Long id) {
|
||||||
|
return dataSourceMapper.deleteDataSourceById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试连接
|
||||||
|
*
|
||||||
|
* @param id 数据源id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean testConnection(Long id) {
|
||||||
|
DataSource dataSource = this.getOne(
|
||||||
|
new LambdaQueryWrapper<DataSource>()
|
||||||
|
.eq(DataSource::getId, id)
|
||||||
|
);
|
||||||
|
String driveClass = "";
|
||||||
|
String jdbcUrl = "";
|
||||||
|
boolean flag = false;
|
||||||
|
try {
|
||||||
|
switch (dataSource.getTypeId().intValue()) {
|
||||||
|
case 1:
|
||||||
|
driveClass = "com.mysql.cj.jdbc.Driver";
|
||||||
|
jdbcUrl = "jdbc:mysql://" + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + "/" + dataSource.getDataSourceDatabaseName() + "?" + dataSource.getAdditionalConfiguration();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// redis
|
||||||
|
//连接指定的redis
|
||||||
|
Jedis jedis = new Jedis(dataSource.getDataSourceIp(), Integer.valueOf(dataSource.getDataSourcePort()));
|
||||||
|
//如果有密码则需要下面这一行
|
||||||
|
if (dataSource.getDataSourcePassword() != null && !dataSource.getDataSourcePassword().equals("")){
|
||||||
|
jedis.auth(dataSource.getDataSourcePassword());
|
||||||
|
}
|
||||||
|
//查看服务是否运行,运行正常的话返回一个PONG,否则返回一个连接错误
|
||||||
|
try {
|
||||||
|
jedis.ping();
|
||||||
|
flag = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// oracle数据库
|
||||||
|
driveClass = "oracle.jdbc.OracleDriver";
|
||||||
|
jdbcUrl = "jdbc:oracle:thin:@" + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + ":" + dataSource.getDataSourceDatabaseName();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
driveClass = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
|
||||||
|
jdbcUrl = "jdbc:sqlserver://"+ dataSource.getDataSourceIp() +":"+dataSource.getDataSourcePort()+";databaseName="+dataSource.getDataSourceDatabaseName();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (dataSource.getTypeId() != 2){
|
||||||
|
flag = testDatasource(driveClass, jdbcUrl, dataSource.getDataSourceUsername(), dataSource.getDataSourcePassword());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试数据源连接是否有效
|
||||||
|
*
|
||||||
|
* @param driveClass 驱动类
|
||||||
|
* @param url 连接
|
||||||
|
* @param username 用户名
|
||||||
|
* @param password 密码
|
||||||
|
* @return 布尔
|
||||||
|
*/
|
||||||
|
public static boolean testDatasource(String driveClass, String url, String username, String password) {
|
||||||
|
try {
|
||||||
|
Class.forName(driveClass);
|
||||||
|
DriverManager.getConnection(url, username, password);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.etl.data.type.controller;
|
||||||
|
|
||||||
|
import com.etl.common.core.domain.Result;
|
||||||
|
import com.etl.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.etl.common.core.web.controller.BaseController;
|
||||||
|
import com.etl.common.core.web.page.TableDataInfo;
|
||||||
|
import com.etl.common.log.annotation.Log;
|
||||||
|
import com.etl.common.log.enums.BusinessType;
|
||||||
|
import com.etl.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
import com.etl.data.type.service.IDataTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型Controller
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/type")
|
||||||
|
public class DataTypeController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IDataTypeService dataTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<DataType>> list(DataType dataType) {
|
||||||
|
startPage();
|
||||||
|
List<DataType> list = dataTypeService.selectDataTypeList(dataType);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据源类型列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:export")
|
||||||
|
@Log(title = "数据源类型", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DataType dataType) {
|
||||||
|
List<DataType> list = dataTypeService.selectDataTypeList(dataType);
|
||||||
|
ExcelUtil<DataType> util = new ExcelUtil<DataType>(DataType.class);
|
||||||
|
util.exportExcel(response, list, "数据源类型数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据源类型详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(dataTypeService.selectDataTypeById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:add")
|
||||||
|
@Log(title = "数据源类型", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody DataType dataType) {
|
||||||
|
return toAjax(dataTypeService.insertDataType(dataType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:edit")
|
||||||
|
@Log(title = "数据源类型", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody DataType dataType) {
|
||||||
|
return toAjax(dataTypeService.updateDataType(dataType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:remove")
|
||||||
|
@Log(title = "数据源类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(dataTypeService.deleteDataTypeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.etl.data.type.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型Mapper接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
public interface DataTypeMapper extends BaseMapper<DataType> {
|
||||||
|
/**
|
||||||
|
* 查询数据源类型
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 数据源类型
|
||||||
|
*/
|
||||||
|
public DataType selectDataTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型列表
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 数据源类型集合
|
||||||
|
*/
|
||||||
|
public List<DataType> selectDataTypeList(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDataType(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDataType(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源类型
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源类型
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataTypeByIds(Long[] ids);
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.etl.data.type.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型Service接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
public interface IDataTypeService extends IService<DataType> {
|
||||||
|
/**
|
||||||
|
* 查询数据源类型
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 数据源类型
|
||||||
|
*/
|
||||||
|
public DataType selectDataTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型列表
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 数据源类型集合
|
||||||
|
*/
|
||||||
|
public List<DataType> selectDataTypeList(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDataType(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDataType(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源类型
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据源类型主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataTypeByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源类型信息
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataTypeById(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.etl.data.type.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.common.core.utils.DateUtils;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
import com.etl.data.type.mapper.DataTypeMapper;
|
||||||
|
import com.etl.data.type.service.IDataTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DataTypeServiceImpl extends ServiceImpl<DataTypeMapper, DataType> implements IDataTypeService {
|
||||||
|
@Autowired
|
||||||
|
private DataTypeMapper dataTypeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 数据源类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DataType selectDataTypeById(Long id) {
|
||||||
|
return dataTypeMapper.selectDataTypeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型列表
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 数据源类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DataType> selectDataTypeList(DataType dataType) {
|
||||||
|
return dataTypeMapper.selectDataTypeList(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertDataType(DataType dataType) {
|
||||||
|
dataType.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return dataTypeMapper.insertDataType(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateDataType(DataType dataType) {
|
||||||
|
dataType.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return dataTypeMapper.updateDataType(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源类型
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据源类型主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDataTypeByIds(Long[] ids) {
|
||||||
|
return dataTypeMapper.deleteDataTypeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源类型信息
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDataTypeById(Long id) {
|
||||||
|
return dataTypeMapper.deleteDataTypeById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.etl.data.source.mapper.DataSourceMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.etl.data.source.domain.DataSource" id="DataSourceResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="dataSourceName" column="data_source_name" />
|
||||||
|
<result property="dataSourceSystemName" column="data_source_system_name" />
|
||||||
|
<result property="typeId" column="type_id" />
|
||||||
|
<result property="dataSourceIp" column="data_source_ip" />
|
||||||
|
<result property="dataSourcePort" column="data_source_port" />
|
||||||
|
<result property="dataSourceDatabaseName" column="data_source_database_name" />
|
||||||
|
<result property="dataSourceUsername" column="data_source_username" />
|
||||||
|
<result property="dataSourcePassword" column="data_source_password" />
|
||||||
|
<result property="additionalConfiguration" column="additional_configuration" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="initialNumberOfConnections" column="initial_number_of_connections" />
|
||||||
|
<result property="maximumNumberOfConnections" column="maximum_number_of_connections" />
|
||||||
|
<result property="maximumWaitingTime" column="maximum_waiting_time" />
|
||||||
|
<result property="maximumWaitingTimes" column="maximum_waiting_times" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectDataSourceVo">
|
||||||
|
select id, data_source_name, data_source_system_name, type_id, data_source_ip, data_source_port, data_source_database_name, data_source_username, data_source_password, additional_configuration, status, remark, initial_number_of_connections, maximum_number_of_connections, maximum_waiting_time, maximum_waiting_times, create_by, create_time, update_by, update_time from data_source
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDataSourceList" parameterType="com.etl.data.source.domain.DataSource" resultMap="DataSourceResult">
|
||||||
|
<include refid="selectDataSourceVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dataSourceName != null and dataSourceName != ''"> and data_source_name like concat('%', #{dataSourceName}, '%')</if>
|
||||||
|
<if test="dataSourceSystemName != null and dataSourceSystemName != ''"> and data_source_system_name like concat('%', #{dataSourceSystemName}, '%')</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDataSourceById" parameterType="Long" resultMap="DataSourceResult">
|
||||||
|
<include refid="selectDataSourceVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertDataSource" parameterType="com.etl.data.source.domain.DataSource" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into data_source
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataSourceName != null">data_source_name,</if>
|
||||||
|
<if test="dataSourceSystemName != null">data_source_system_name,</if>
|
||||||
|
<if test="typeId != null">type_id,</if>
|
||||||
|
<if test="dataSourceIp != null">data_source_ip,</if>
|
||||||
|
<if test="dataSourcePort != null">data_source_port,</if>
|
||||||
|
<if test="dataSourceDatabaseName != null">data_source_database_name,</if>
|
||||||
|
<if test="dataSourceUsername != null">data_source_username,</if>
|
||||||
|
<if test="dataSourcePassword != null">data_source_password,</if>
|
||||||
|
<if test="additionalConfiguration != null">additional_configuration,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="initialNumberOfConnections != null">initial_number_of_connections,</if>
|
||||||
|
<if test="maximumNumberOfConnections != null">maximum_number_of_connections,</if>
|
||||||
|
<if test="maximumWaitingTime != null">maximum_waiting_time,</if>
|
||||||
|
<if test="maximumWaitingTimes != null">maximum_waiting_times,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataSourceName != null">#{dataSourceName},</if>
|
||||||
|
<if test="dataSourceSystemName != null">#{dataSourceSystemName},</if>
|
||||||
|
<if test="typeId != null">#{typeId},</if>
|
||||||
|
<if test="dataSourceIp != null">#{dataSourceIp},</if>
|
||||||
|
<if test="dataSourcePort != null">#{dataSourcePort},</if>
|
||||||
|
<if test="dataSourceDatabaseName != null">#{dataSourceDatabaseName},</if>
|
||||||
|
<if test="dataSourceUsername != null">#{dataSourceUsername},</if>
|
||||||
|
<if test="dataSourcePassword != null">#{dataSourcePassword},</if>
|
||||||
|
<if test="additionalConfiguration != null">#{additionalConfiguration},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="initialNumberOfConnections != null">#{initialNumberOfConnections},</if>
|
||||||
|
<if test="maximumNumberOfConnections != null">#{maximumNumberOfConnections},</if>
|
||||||
|
<if test="maximumWaitingTime != null">#{maximumWaitingTime},</if>
|
||||||
|
<if test="maximumWaitingTimes != null">#{maximumWaitingTimes},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDataSource" parameterType="com.etl.data.source.domain.DataSource">
|
||||||
|
update data_source
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="dataSourceName != null">data_source_name = #{dataSourceName},</if>
|
||||||
|
<if test="dataSourceSystemName != null">data_source_system_name = #{dataSourceSystemName},</if>
|
||||||
|
<if test="typeId != null">type_id = #{typeId},</if>
|
||||||
|
<if test="dataSourceIp != null">data_source_ip = #{dataSourceIp},</if>
|
||||||
|
<if test="dataSourcePort != null">data_source_port = #{dataSourcePort},</if>
|
||||||
|
<if test="dataSourceDatabaseName != null">data_source_database_name = #{dataSourceDatabaseName},</if>
|
||||||
|
<if test="dataSourceUsername != null">data_source_username = #{dataSourceUsername},</if>
|
||||||
|
<if test="dataSourcePassword != null">data_source_password = #{dataSourcePassword},</if>
|
||||||
|
<if test="additionalConfiguration != null">additional_configuration = #{additionalConfiguration},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="initialNumberOfConnections != null">initial_number_of_connections = #{initialNumberOfConnections},</if>
|
||||||
|
<if test="maximumNumberOfConnections != null">maximum_number_of_connections = #{maximumNumberOfConnections},</if>
|
||||||
|
<if test="maximumWaitingTime != null">maximum_waiting_time = #{maximumWaitingTime},</if>
|
||||||
|
<if test="maximumWaitingTimes != null">maximum_waiting_times = #{maximumWaitingTimes},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteDataSourceById" parameterType="Long">
|
||||||
|
delete from data_source where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDataSourceByIds" parameterType="String">
|
||||||
|
delete from data_source where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.etl.data.type.mapper.DataTypeMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.etl.data.type.domain.DataType" id="DataTypeResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="dataType" column="data_type" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectDataTypeVo">
|
||||||
|
select id, data_type, remark, create_by, create_time, update_by, update_time from data_type
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDataTypeList" parameterType="com.etl.data.type.domain.DataType" resultMap="DataTypeResult">
|
||||||
|
<include refid="selectDataTypeVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDataTypeById" parameterType="Long" resultMap="DataTypeResult">
|
||||||
|
<include refid="selectDataTypeVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertDataType" parameterType="com.etl.data.type.domain.DataType" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into data_type
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataType != null">data_type,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataType != null">#{dataType},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDataType" parameterType="com.etl.data.type.domain.DataType">
|
||||||
|
update data_type
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="dataType != null">data_type = #{dataType},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteDataTypeById" parameterType="Long">
|
||||||
|
delete from data_type where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDataTypeByIds" parameterType="String">
|
||||||
|
delete from data_type where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
7
pom.xml
7
pom.xml
|
@ -34,6 +34,7 @@
|
||||||
<jjwt.version>0.9.1</jjwt.version>
|
<jjwt.version>0.9.1</jjwt.version>
|
||||||
<minio.version>8.2.2</minio.version>
|
<minio.version>8.2.2</minio.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
|
<jedis.version>2.9.0</jedis.version>
|
||||||
<transmittable-thread-local.version>2.14.3</transmittable-thread-local.version>
|
<transmittable-thread-local.version>2.14.3</transmittable-thread-local.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
@ -220,6 +221,12 @@
|
||||||
<version>${etl.version}</version>
|
<version>${etl.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>redis.clients</groupId>
|
||||||
|
<artifactId>jedis</artifactId>
|
||||||
|
<version>${jedis.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue