数据接入

master
yaoxin 2024-04-20 13:35:10 +08:00
parent c2131247a4
commit aa166b808d
13 changed files with 943 additions and 0 deletions

View File

@ -0,0 +1,85 @@
<?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>
<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>
<!-- 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>
</dependencies>
</project>

View File

@ -0,0 +1,7 @@
package com.muyu;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

View File

@ -0,0 +1,22 @@
package com.muyu.etl;
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;
/**
*
*
* @author muyu
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication
public class MuYuETLApplication {
public static void main (String[] args) {
SpringApplication.run(MuYuETLApplication.class, args);
}
}

View File

@ -0,0 +1,114 @@
package com.muyu.etl.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.DataSource;
import com.muyu.etl.service.IDataSourceService;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2024-04-20
*/
@RestController
@RequestMapping("/source")
public class DataSourceController extends BaseController
{
@Autowired
private IDataSourceService dataSourceService;
/**
*
*/
@RequiresPermissions("system:source:list")
@GetMapping("/list")
public Result<TableDataInfo<DataSource>> list(DataSource dataSource)
{
startPage();
List<DataSource> list = dataSourceService.selectDataSourceList(dataSource);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:source:export")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DataSource dataSource)
{
List<DataSource> list = dataSourceService.selectDataSourceList(dataSource);
ExcelUtil<DataSource> util = new ExcelUtil<DataSource>(DataSource.class);
util.exportExcel(response, list, "【请填写功能名称】数据");
}
/**
*
*/
@RequiresPermissions("system:source:query")
@GetMapping(value = "/{id}")
public Result getInfo(@PathVariable("id") Long id)
{
return success(dataSourceService.selectDataSourceById(id));
}
/**
*
*/
@RequiresPermissions("system:source:add")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody DataSource dataSource)
{
return toAjax(dataSourceService.insertDataSource(dataSource));
}
/**
*
*/
@Log(title = "测试连接", businessType = BusinessType.INSERT)
@PostMapping("/TestConnection")
public Result testConnection(@RequestBody DataSource dataSource)
{
return dataSourceService.testConnection(dataSource);
}
/**
*
*/
@RequiresPermissions("system:source:edit")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody DataSource dataSource)
{
return toAjax(dataSourceService.updateDataSource(dataSource));
}
/**
*
*/
@RequiresPermissions("system:source:remove")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids)
{
return toAjax(dataSourceService.deleteDataSourceByIds(ids));
}
}

View File

@ -0,0 +1,224 @@
package com.muyu.etl.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
/**
* data_source
*
* @author ruoyi
* @date 2024-04-20
*/
public class DataSource extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String dataSourceName;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String linkAddress;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String port;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String databaseName;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String username;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String password;
/** 数据连接参数 */
@Excel(name = "数据连接参数")
private String connectionParam;
/** 初始连接数量 */
@Excel(name = "初始连接数量")
private Long initNum;
/** 最大连接数量 */
@Excel(name = "最大连接数量")
private Long maxNum;
/** 最大等待时间 */
@Excel(name = "最大等待时间")
private Long maxWaitTime;
/** 最大等待次数 */
@Excel(name = "最大等待次数")
private Long maxWaitSize;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String type;
/** 数据来源名称 */
@Excel(name = "数据来源名称")
private String systemName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDataSourceName(String dataSourceName)
{
this.dataSourceName = dataSourceName;
}
public String getDataSourceName()
{
return dataSourceName;
}
public void setLinkAddress(String linkAddress)
{
this.linkAddress = linkAddress;
}
public String getLinkAddress()
{
return linkAddress;
}
public void setPort(String port)
{
this.port = port;
}
public String getPort()
{
return port;
}
public void setDatabaseName(String databaseName)
{
this.databaseName = databaseName;
}
public String getDatabaseName()
{
return databaseName;
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return username;
}
public void setPassword(String password)
{
this.password = password;
}
public String getPassword()
{
return password;
}
public void setConnectionParam(String connectionParam)
{
this.connectionParam = connectionParam;
}
public String getConnectionParam()
{
return connectionParam;
}
public void setInitNum(Long initNum)
{
this.initNum = initNum;
}
public Long getInitNum()
{
return initNum;
}
public void setMaxNum(Long maxNum)
{
this.maxNum = maxNum;
}
public Long getMaxNum()
{
return maxNum;
}
public void setMaxWaitTime(Long maxWaitTime)
{
this.maxWaitTime = maxWaitTime;
}
public Long getMaxWaitTime()
{
return maxWaitTime;
}
public void setMaxWaitSize(Long maxWaitSize)
{
this.maxWaitSize = maxWaitSize;
}
public Long getMaxWaitSize()
{
return maxWaitSize;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setSystemName(String systemName)
{
this.systemName = systemName;
}
public String getSystemName()
{
return systemName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("dataSourceName", getDataSourceName())
.append("linkAddress", getLinkAddress())
.append("port", getPort())
.append("databaseName", getDatabaseName())
.append("username", getUsername())
.append("password", getPassword())
.append("connectionParam", getConnectionParam())
.append("initNum", getInitNum())
.append("maxNum", getMaxNum())
.append("maxWaitTime", getMaxWaitTime())
.append("maxWaitSize", getMaxWaitSize())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("type", getType())
.append("systemName", getSystemName())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.muyu.etl.mapper;
import java.util.List;
import com.muyu.etl.domain.DataSource;
/**
* Mapper
*
* @author ruoyi
* @date 2024-04-20
*/
public interface DataSourceMapper
{
/**
*
*
* @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);
}

View File

@ -0,0 +1,65 @@
package com.muyu.etl.service;
import java.util.List;
import com.muyu.common.core.domain.Result;
import com.muyu.etl.domain.DataSource;
/**
* Service
*
* @author ruoyi
* @date 2024-04-20
*/
public interface IDataSourceService
{
/**
*
*
* @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 ids
* @return
*/
public int deleteDataSourceByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteDataSourceById(Long id);
Result testConnection(DataSource dataSource);
}

View File

@ -0,0 +1,124 @@
package com.muyu.etl.service.impl;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.List;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.muyu.etl.mapper.DataSourceMapper;
import com.muyu.etl.domain.DataSource;
import com.muyu.etl.service.IDataSourceService;
/**
* Service
*
* @author ruoyi
* @date 2024-04-20
*/
@Service
public class DataSourceServiceImpl implements IDataSourceService
{
@Autowired
private DataSourceMapper dataSourceMapper;
/**
*
*
* @param id
* @return
*/
@Override
public DataSource selectDataSourceById(Long id)
{
return dataSourceMapper.selectDataSourceById(id);
}
/**
*
*
* @param dataSource
* @return
*/
@Override
public List<DataSource> selectDataSourceList(DataSource dataSource)
{
return dataSourceMapper.selectDataSourceList(dataSource);
}
/**
*
*
* @param dataSource
* @return
*/
@Override
public int insertDataSource(DataSource dataSource)
{
dataSource.setCreateTime(DateUtils.getNowDate());
dataSource.setCreateBy(SecurityUtils.getUsername());
return dataSourceMapper.insertDataSource(dataSource);
}
/**
*
*
* @param dataSource
* @return
*/
@Override
public int updateDataSource(DataSource dataSource)
{
dataSource.setUpdateTime(DateUtils.getNowDate());
dataSource.setUpdateBy(SecurityUtils.getUsername());
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);
}
@Override
public Result testConnection(DataSource dataSource) {
String user = dataSource.getUsername();
String password = dataSource.getPassword();
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
String jdbcUrl = "jdbc:mysql://"+dataSource.getLinkAddress()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
Connection conn = null;
try {
Class.forName(jdbcDriver);
} catch (ClassNotFoundException e) {
return Result.error("连接失败");
}
try {
conn = DriverManager.getConnection(jdbcUrl, user, password);
conn.close();
}catch (Exception e){
return Result.error("连接失败");
}
return Result.success("连接成功");
}
}

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -0,0 +1,28 @@
# Tomcat
server:
port: 9204
# Spring
spring:
application:
# 应用名称
name: muyu-etl
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 43.142.44.217:8848
config:
# 配置中心地址
server-addr: 43.142.44.217:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.muyu.system.mapper: DEBUG

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/muyu-system"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,136 @@
<?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.DataSourceMapper">
<resultMap type="com.muyu.etl.domain.DataSource" id="DataSourceResult">
<result property="id" column="id" />
<result property="dataSourceName" column="data_source_name" />
<result property="linkAddress" column="link_address" />
<result property="port" column="port" />
<result property="databaseName" column="database_name" />
<result property="username" column="username" />
<result property="password" column="password" />
<result property="connectionParam" column="connection_param" />
<result property="initNum" column="init_num" />
<result property="maxNum" column="max_num" />
<result property="maxWaitTime" column="max_wait_time" />
<result property="maxWaitSize" column="max_wait_size" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="type" column="type" />
<result property="systemName" column="system_name" />
</resultMap>
<sql id="selectDataSourceVo">
select id, data_source_name, link_address, port, database_name, username, password, connection_param, init_num, max_num, max_wait_time, max_wait_size, create_by, create_time, update_by, update_time, remark, type, system_name from data_source
</sql>
<select id="selectDataSourceList" parameterType="com.muyu.etl.domain.DataSource" resultMap="DataSourceResult">
<include refid="selectDataSourceVo"/>
<where>
<if test="dataSourceName != null and dataSourceName != ''"> and data_source_name like concat('%', #{dataSourceName}, '%')</if>
<if test="linkAddress != null and linkAddress != ''"> and link_address = #{linkAddress}</if>
<if test="port != null and port != ''"> and port = #{port}</if>
<if test="databaseName != null and databaseName != ''"> and database_name like concat('%', #{databaseName}, '%')</if>
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="connectionParam != null and connectionParam != ''"> and connection_param = #{connectionParam}</if>
<if test="initNum != null "> and init_num = #{initNum}</if>
<if test="maxNum != null "> and max_num = #{maxNum}</if>
<if test="maxWaitTime != null "> and max_wait_time = #{maxWaitTime}</if>
<if test="maxWaitSize != null "> and max_wait_size = #{maxWaitSize}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="systemName != null and systemName != ''"> and system_name like concat('%', #{systemName}, '%')</if>
</where>
</select>
<select id="selectDataSourceById" parameterType="Long" resultMap="DataSourceResult">
<include refid="selectDataSourceVo"/>
where id = #{id}
</select>
<insert id="insertDataSource" parameterType="com.muyu.etl.domain.DataSource" useGeneratedKeys="true" keyProperty="id">
insert into data_source
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dataSourceName != null">data_source_name,</if>
<if test="linkAddress != null">link_address,</if>
<if test="port != null">port,</if>
<if test="databaseName != null">database_name,</if>
<if test="username != null">username,</if>
<if test="password != null">password,</if>
<if test="connectionParam != null">connection_param,</if>
<if test="initNum != null">init_num,</if>
<if test="maxNum != null">max_num,</if>
<if test="maxWaitTime != null">max_wait_time,</if>
<if test="maxWaitSize != null">max_wait_size,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="type != null">type,</if>
<if test="systemName != null">system_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataSourceName != null">#{dataSourceName},</if>
<if test="linkAddress != null">#{linkAddress},</if>
<if test="port != null">#{port},</if>
<if test="databaseName != null">#{databaseName},</if>
<if test="username != null">#{username},</if>
<if test="password != null">#{password},</if>
<if test="connectionParam != null">#{connectionParam},</if>
<if test="initNum != null">#{initNum},</if>
<if test="maxNum != null">#{maxNum},</if>
<if test="maxWaitTime != null">#{maxWaitTime},</if>
<if test="maxWaitSize != null">#{maxWaitSize},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="type != null">#{type},</if>
<if test="systemName != null">#{systemName},</if>
</trim>
</insert>
<update id="updateDataSource" parameterType="com.muyu.etl.domain.DataSource">
update data_source
<trim prefix="SET" suffixOverrides=",">
<if test="dataSourceName != null">data_source_name = #{dataSourceName},</if>
<if test="linkAddress != null">link_address = #{linkAddress},</if>
<if test="port != null">port = #{port},</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="connectionParam != null">connection_param = #{connectionParam},</if>
<if test="initNum != null">init_num = #{initNum},</if>
<if test="maxNum != null">max_num = #{maxNum},</if>
<if test="maxWaitTime != null">max_wait_time = #{maxWaitTime},</if>
<if test="maxWaitSize != null">max_wait_size = #{maxWaitSize},</if>
<if test="createBy != null and createBy != ''">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>
<if test="remark != null">remark = #{remark},</if>
<if test="type != null">type = #{type},</if>
<if test="systemName != null">system_name = #{systemName},</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>

View File

@ -13,6 +13,7 @@
<module>muyu-gen</module>
<module>muyu-job</module>
<module>muyu-file</module>
<module>muyu-etl</module>
</modules>
<artifactId>muyu-modules</artifactId>