数据库接入
parent
f162408a04
commit
70cb531906
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: etl
|
||||
|
|
|
@ -14,26 +14,27 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: etl
|
||||
sentinel:
|
||||
# 取消控制台懒加载
|
||||
eager: true
|
||||
transport:
|
||||
# 控制台地址
|
||||
dashboard: 139.224.67.14:8718
|
||||
dashboard: 175.24.138.82:8718
|
||||
# nacos配置持久化
|
||||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
dataId: sentinel-muyu-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-etl</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-etl-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,125 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.etl.domain.req.BasicConfigQueryReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
/**
|
||||
*对象 basic_config_info
|
||||
*
|
||||
* @author xiaohuang
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicConfigInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 接入源名称 */
|
||||
@Excel(name = "接入源名称")
|
||||
private String dataResourceName;
|
||||
|
||||
/** 数据来源系统名称 */
|
||||
@Excel(name = "数据来源系统名称")
|
||||
private String dataSourcesSystemName;
|
||||
|
||||
/** 主机ip地址 */
|
||||
@Excel(name = "主机ip地址")
|
||||
private String host;
|
||||
|
||||
/** 端口 */
|
||||
@Excel(name = "端口")
|
||||
private String port;
|
||||
|
||||
/** 数据接入类型 */
|
||||
@Excel(name = "数据接入类型")
|
||||
private String databaseType;
|
||||
|
||||
/** 数据库名称 */
|
||||
@Excel(name = "数据库名称")
|
||||
private String databaseName;
|
||||
|
||||
/** 初始化连接数量 */
|
||||
@Excel(name = "初始化连接数量")
|
||||
private Long initLinkNum;
|
||||
|
||||
/** 最大连接数量 */
|
||||
@Excel(name = "最大连接数量")
|
||||
private Long maxLinkNum;
|
||||
|
||||
/** 最大等待时间 */
|
||||
@Excel(name = "最大等待时间")
|
||||
private Long maxWaitTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
@Excel(name = "最大等待次数")
|
||||
private Long maxWaitTimes;
|
||||
|
||||
@Excel(name = "连接参数")
|
||||
private String connectionParams;
|
||||
|
||||
@Excel(name = "用户名")
|
||||
private String username;
|
||||
|
||||
@Excel(name = "密码")
|
||||
private String password;
|
||||
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建存储对象
|
||||
*/
|
||||
public static BasicConfigInfo saveBuilder(BasicConfigQueryReq configQueryReq, Supplier<String> username) {
|
||||
return BasicConfigInfo.builder()
|
||||
.id(configQueryReq.getId())
|
||||
.databaseName(configQueryReq.getDatabaseName())
|
||||
.databaseType(configQueryReq.getDatabaseType())
|
||||
.dataResourceName(configQueryReq.getDataResourceName())
|
||||
.dataSourcesSystemName(configQueryReq.getDataSourcesSystemName())
|
||||
.host(configQueryReq.getHost())
|
||||
.port(configQueryReq.getPort())
|
||||
.initLinkNum(configQueryReq.getInitLinkNum())
|
||||
.maxLinkNum(configQueryReq.getMaxLinkNum())
|
||||
.maxWaitTime(configQueryReq.getMaxWaitTime())
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改对象
|
||||
*/
|
||||
public static BasicConfigInfo editBuilder(BasicConfigQueryReq configQueryReq, Supplier<String> username) {
|
||||
return BasicConfigInfo.builder()
|
||||
.id(configQueryReq.getId())
|
||||
.databaseName(configQueryReq.getDatabaseName())
|
||||
.databaseType(configQueryReq.getDatabaseType())
|
||||
.dataResourceName(configQueryReq.getDataResourceName())
|
||||
.dataSourcesSystemName(configQueryReq.getDataSourcesSystemName())
|
||||
.host(configQueryReq.getHost())
|
||||
.port(configQueryReq.getPort())
|
||||
.initLinkNum(configQueryReq.getInitLinkNum())
|
||||
.maxLinkNum(configQueryReq.getMaxLinkNum())
|
||||
.maxWaitTime(configQueryReq.getMaxWaitTime())
|
||||
.updateBy(username.get())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package com.muyu.etl.domain.req;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* BasicConfigQueryReq
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/4/21
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicConfigQueryReq {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 接入源名称 */
|
||||
@Excel(name = "接入源名称")
|
||||
private String dataResourceName;
|
||||
|
||||
/** 数据来源系统名称 */
|
||||
@Excel(name = "数据来源系统名称")
|
||||
private String dataSourcesSystemName;
|
||||
|
||||
/** 主机ip地址 */
|
||||
@Excel(name = "主机ip地址")
|
||||
private String host;
|
||||
|
||||
/** 端口 */
|
||||
@Excel(name = "端口")
|
||||
private String port;
|
||||
|
||||
/** 数据接入类型 */
|
||||
@Excel(name = "数据接入类型")
|
||||
private String databaseType;
|
||||
|
||||
/** 数据库名称 */
|
||||
@Excel(name = "数据库名称")
|
||||
private String databaseName;
|
||||
|
||||
/** 初始化连接数量 */
|
||||
@Excel(name = "初始化连接数量")
|
||||
private Long initLinkNum;
|
||||
|
||||
/** 最大连接数量 */
|
||||
@Excel(name = "最大连接数量")
|
||||
private Long maxLinkNum;
|
||||
|
||||
/** 最大等待时间 */
|
||||
@Excel(name = "最大等待时间")
|
||||
private Long maxWaitTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
@Excel(name = "最大等待次数")
|
||||
private Long maxWaitTimes;
|
||||
|
||||
private String connectionParams;
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.muyu.etl.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 响应对象
|
||||
* @ClassName BasicConfigResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/21 10:45
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicConfigResp {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 接入源名称 */
|
||||
private String dataResourceName;
|
||||
|
||||
/** 数据来源系统名称 */
|
||||
private String dataSourcesSystemName;
|
||||
|
||||
/** 主机ip地址 */
|
||||
private String host;
|
||||
|
||||
/** 端口 */
|
||||
private String port;
|
||||
|
||||
/** 数据接入类型 */
|
||||
private String databaseType;
|
||||
|
||||
/** 数据库名称 */
|
||||
private String databaseName;
|
||||
|
||||
/** 初始化连接数量 */
|
||||
private Long initLinkNum;
|
||||
|
||||
/** 最大连接数量 */
|
||||
private Long maxLinkNum;
|
||||
|
||||
/** 最大等待时间 */
|
||||
private Long maxWaitTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
private Long maxWaitTimes;
|
||||
|
||||
/** 拼接链接 */
|
||||
private String connectionParams;
|
||||
private String remark;
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-etl</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-etl-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package muyu;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-etl</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-etl-service</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-etl-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuEtlApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuYuEtlApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package com.muyu.etl.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.service.BasicConfigInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 基础信息Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/info")
|
||||
public class BasicConfigInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private BasicConfigInfoService basicConfigInfoService;
|
||||
|
||||
/**
|
||||
* 查询基础信息列表
|
||||
*/
|
||||
@RequiresPermissions("etl:info:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo)
|
||||
{
|
||||
startPage();
|
||||
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出基础信息列表
|
||||
*/
|
||||
@RequiresPermissions("etl:info:export")
|
||||
@Log(title = "基础信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BasicConfigInfo basicConfigInfo)
|
||||
{
|
||||
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
ExcelUtil<BasicConfigInfo> util = new ExcelUtil<BasicConfigInfo>(BasicConfigInfo.class);
|
||||
util.exportExcel(response, list, "基础信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取基础信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(basicConfigInfoService.selectBasicConfigInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增基础信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:add")
|
||||
@Log(title = "基础信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody BasicConfigInfo configQueryReq)
|
||||
{
|
||||
return toAjax(basicConfigInfoService.insertBasicConfigInfo(configQueryReq));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改基础信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:edit")
|
||||
@Log(title = "基础信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody BasicConfigInfo basicConfigInfo)
|
||||
{
|
||||
return toAjax(basicConfigInfoService.updateBasicConfigInfo(basicConfigInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除基础信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:remove")
|
||||
@Log(title = "基础信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(basicConfigInfoService.deleteBasicConfigInfoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
*/
|
||||
@RequiresPermissions("etl:info:test")
|
||||
@Log(title = "测试连接")
|
||||
@PostMapping("/connectionTest")
|
||||
public Result connectionTest(@RequestBody BasicConfigInfo basicConfigInfo) throws ServletException {
|
||||
return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 接口 BasicConfigInfoMapper
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/4/21
|
||||
*/
|
||||
public interface BasicConfigInfoMapper extends BaseMapper<BasicConfigInfo> {
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
public BasicConfigInfo selectBasicConfigInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
*/
|
||||
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
*/
|
||||
public int insertBasicConfigInfo(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
*/
|
||||
public int updateBasicConfigInfo(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public int deleteBasicConfigInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public int deleteBasicConfigInfoByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.rmi.server.ServerCloneException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 接口 BasicConfigInfoService
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/4/21
|
||||
*/
|
||||
public interface BasicConfigInfoService extends IService<BasicConfigInfo> {
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
public BasicConfigInfo selectBasicConfigInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return 集合
|
||||
*/
|
||||
public List<BasicConfigInfo>
|
||||
selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param configQueryReq
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasicConfigInfo(BasicConfigInfo configQueryReq);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasicConfigInfo(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids 需要删除的主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicConfigInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicConfigInfoById(Long id);
|
||||
|
||||
boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException;
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
||||
import com.muyu.etl.service.BasicConfigInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 业务层 BasicConfigInfoServiceImpl
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/4/21
|
||||
*/
|
||||
@Service
|
||||
public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapper, BasicConfigInfo> implements BasicConfigInfoService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BasicConfigInfoMapper basicConfigInfoMapper;
|
||||
|
||||
@Override
|
||||
public BasicConfigInfo selectBasicConfigInfoById(Long id) {
|
||||
return basicConfigInfoMapper.selectBasicConfigInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo) {
|
||||
|
||||
return basicConfigInfoMapper.selectBasicConfigInfoList(basicConfigInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertBasicConfigInfo(BasicConfigInfo configQueryReq) {
|
||||
return basicConfigInfoMapper.insertBasicConfigInfo(configQueryReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBasicConfigInfo(BasicConfigInfo configQueryReq) {
|
||||
return basicConfigInfoMapper.updateBasicConfigInfo(configQueryReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBasicConfigInfoByIds(Long[] ids) {
|
||||
return basicConfigInfoMapper.deleteBasicConfigInfoByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteBasicConfigInfoById(Long id)
|
||||
{
|
||||
return basicConfigInfoMapper.deleteBasicConfigInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException {
|
||||
//定义下面需要的对象
|
||||
String host = basicConfigInfo.getHost();
|
||||
String port = basicConfigInfo.getPort();
|
||||
String databaseName = basicConfigInfo.getDatabaseName();
|
||||
String databaseType = basicConfigInfo.getDatabaseType();
|
||||
|
||||
String url = "jdbc:"+databaseType+"://"+host+":"+port+"/"+databaseName+"";
|
||||
String user = "root";
|
||||
String password = "123456";
|
||||
Connection conn= null;
|
||||
try {
|
||||
conn = DriverManager.getConnection(url, user, password);
|
||||
System.out.println("Connected to the MySQL server successfully.");
|
||||
} catch (SQLException e) {
|
||||
throw new ServletException("连接失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9205
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-etl
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 175.24.138.82:8848
|
||||
namespace: etl
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
|
@ -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.muyu.etl.mapper.BasicConfigInfoMapper">
|
||||
|
||||
<resultMap type="com.muyu.etl.domain.BasicConfigInfo"
|
||||
id="BasicConfigInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="dataResourceName" column="data_resource_name" />
|
||||
<result property="dataSourcesSystemName" column="data_sources_system_name" />
|
||||
<result property="host" column="host" />
|
||||
<result property="port" column="port" />
|
||||
<result property="databaseType" column="database_type" />
|
||||
<result property="databaseName" column="database_name" />
|
||||
<result property="initLinkNum" column="init_link_num" />
|
||||
<result property="maxLinkNum" column="max_link_num" />
|
||||
<result property="maxWaitTime" column="max_wait_time" />
|
||||
<result property="maxWaitTimes" column="max_wait_times" />
|
||||
<result property="connectionParams" column="connection_params" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasicConfigInfoVo">
|
||||
select id, data_resource_name,username,password,
|
||||
data_sources_system_name,
|
||||
host, port, database_type,
|
||||
database_name,
|
||||
init_link_num,
|
||||
max_link_num, max_wait_time,
|
||||
max_wait_times,connection_params,
|
||||
remark from basic_config_info
|
||||
</sql>
|
||||
|
||||
<select id="selectBasicConfigInfoList"
|
||||
parameterType="com.muyu.etl.domain.BasicConfigInfo"
|
||||
resultMap="BasicConfigInfoResult">
|
||||
<include refid="selectBasicConfigInfoVo"/>
|
||||
<where>
|
||||
<if test="dataResourceName != null and dataResourceName != ''"> and data_resource_name like concat('%', #{dataResourceName}, '%')</if>
|
||||
<if test="dataSourcesSystemName != null and dataSourcesSystemName != ''"> and data_sources_system_name like concat('%', #{dataSourcesSystemName}, '%')</if>
|
||||
<if test="host != null and host != ''"> and host = #{host}</if>
|
||||
<if test="port != null and port != ''"> and port = #{port}</if>
|
||||
<if test="databaseType != null and databaseType != ''"> and database_type = #{databaseType}</if>
|
||||
<if test="databaseName != null and databaseName != ''"> and database_name like concat('%', #{databaseName}, '%')</if>
|
||||
<if test="username != null "> and username = #{username}</if>
|
||||
<if test="password != null "> and password = #{password}</if>
|
||||
<if test="initLinkNum != null "> and init_link_num = #{initLinkNum}</if>
|
||||
<if test="maxLinkNum != null "> and max_link_num = #{maxLinkNum}</if>
|
||||
<if test="maxWaitTime != null "> and max_wait_time = #{maxWaitTime}</if>
|
||||
<if test="maxWaitTimes != null "> and max_wait_times = #{maxWaitTimes}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasicConfigInfoById" parameterType="Long" resultMap="BasicConfigInfoResult">
|
||||
<include refid="selectBasicConfigInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBasicConfigInfo" parameterType="com.muyu.etl.domain.BasicConfigInfo">
|
||||
insert into basic_config_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="dataResourceName != null">data_resource_name,</if>
|
||||
<if test="dataSourcesSystemName != null">data_sources_system_name,</if>
|
||||
<if test="host != null">host,</if>
|
||||
<if test="port != null">port,</if>
|
||||
<if test="databaseType != null">database_type,</if>
|
||||
<if test="databaseName != null">database_name,</if>
|
||||
<if test="username != null">username,</if>
|
||||
<if test="password != null">password,</if>
|
||||
<if test="initLinkNum != null">init_link_num,</if>
|
||||
<if test="maxLinkNum != null">max_link_num,</if>
|
||||
<if test="maxWaitTime != null">max_wait_time,</if>
|
||||
<if test="maxWaitTimes != null">max_wait_times,</if>
|
||||
<if test="connectionParams != null">connection_params,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="dataResourceName != null">#{dataResourceName},</if>
|
||||
<if test="dataSourcesSystemName != null">#{dataSourcesSystemName},</if>
|
||||
<if test="host != null">#{host},</if>
|
||||
<if test="port != null">#{port},</if>
|
||||
<if test="username != null">#{username},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="databaseType != null">#{databaseType},</if>
|
||||
<if test="databaseName != null">#{databaseName},</if>
|
||||
<if test="initLinkNum != null">#{initLinkNum},</if>
|
||||
<if test="maxLinkNum != null">#{maxLinkNum},</if>
|
||||
<if test="maxWaitTime != null">#{maxWaitTime},</if>
|
||||
<if test="maxWaitTimes != null">#{maxWaitTimes},</if>
|
||||
<if test="connectionParams != null">#{connectionParams},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasicConfigInfo" parameterType="com.muyu.etl.domain.BasicConfigInfo">
|
||||
update basic_config_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dataResourceName != null">data_resource_name = #{dataResourceName},</if>
|
||||
<if test="dataSourcesSystemName != null">data_sources_system_name = #{dataSourcesSystemName},</if>
|
||||
<if test="host != null">host = #{host},</if>
|
||||
<if test="port != null">port = #{port},</if>
|
||||
<if test="databaseType != null">database_type = #{databaseType},</if>
|
||||
<if test="databaseName != null">database_name = #{databaseName},</if>
|
||||
<if test="username != null">username = #{username},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="initLinkNum != null">init_link_num = #{initLinkNum},</if>
|
||||
<if test="maxLinkNum != null">max_link_num = #{maxLinkNum},</if>
|
||||
<if test="maxWaitTime != null">max_wait_time = #{maxWaitTime},</if>
|
||||
<if test="maxWaitTimes != null">max_wait_times = #{maxWaitTimes},</if>
|
||||
<if test="connectionParams != null">connection_params = #{connectionParams},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasicConfigInfoById" parameterType="Long">
|
||||
delete from basic_config_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasicConfigInfoByIds" parameterType="String">
|
||||
delete from basic_config_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-etl</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>muyu-etl-common</module>
|
||||
<module>muyu-etl-remote</module>
|
||||
<module>muyu-etl-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: etl
|
||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: etl
|
||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: etl
|
||||
|
|
|
@ -14,15 +14,16 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: etl
|
||||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
<module>muyu-gen</module>
|
||||
<module>muyu-job</module>
|
||||
<module>muyu-file</module>
|
||||
<module>muyu-etl</module>
|
||||
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 139.224.67.14:8848
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue