etl
parent
85d618c40b
commit
3cf6d5a4a4
|
@ -2,12 +2,14 @@ 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;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -67,8 +69,57 @@ public class BasicConfigInfo extends BaseEntity
|
|||
@Excel(name = "最大等待次数")
|
||||
private Long maxWaitTimes;
|
||||
|
||||
@Excel(name ="连接参数")
|
||||
private String connectionParams;
|
||||
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建存储对象
|
||||
* @param configQueryReq
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改对象
|
||||
* @param configQueryReq
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package com.muyu.etl.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 对象 basic_params
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-20
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicParams extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 基础配置信息主键 */
|
||||
@Excel(name = "基础配置信息主键")
|
||||
private Long basicConfigInfoId;
|
||||
|
||||
/** 参数名 */
|
||||
@Excel(name = "参数名")
|
||||
private String paramsName;
|
||||
|
||||
/** 参数值 */
|
||||
@Excel(name = "参数值")
|
||||
private String paramsValue;
|
||||
|
||||
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @ClassName BasicQueryReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/21 10:42
|
||||
*/
|
||||
@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;
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package com.muyu.etl.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @ClassName BasicQueryReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/4/21 10:42
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class BasicQueryReq {
|
||||
private Long id;
|
||||
|
||||
}
|
|
@ -55,7 +55,7 @@ public class BasicConfigResp {
|
|||
private Long maxWaitTimes;
|
||||
|
||||
/** 拼接链接 */
|
||||
private String connectionParam;
|
||||
private String connectionParams;
|
||||
private String remark;
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
|
|
|
@ -8,7 +8,6 @@ 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.domain.resp.BasicConfigResp;
|
||||
import com.muyu.etl.service.BasicConfigInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -34,10 +33,10 @@ public class BasicConfigInfoController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("etl:info:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<BasicConfigResp>> list(BasicConfigInfo basicConfigInfo)
|
||||
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo)
|
||||
{
|
||||
startPage();
|
||||
List<BasicConfigResp> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -49,8 +48,8 @@ public class BasicConfigInfoController extends BaseController
|
|||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BasicConfigInfo basicConfigInfo)
|
||||
{
|
||||
List<BasicConfigResp> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
ExcelUtil<BasicConfigResp> util = new ExcelUtil<BasicConfigResp>(BasicConfigResp.class);
|
||||
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
ExcelUtil<BasicConfigInfo> util = new ExcelUtil<BasicConfigInfo>(BasicConfigInfo.class);
|
||||
util.exportExcel(response, list, "基础信息数据");
|
||||
}
|
||||
|
||||
|
@ -70,9 +69,9 @@ public class BasicConfigInfoController extends BaseController
|
|||
@RequiresPermissions("etl:info:add")
|
||||
@Log(title = "基础信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody BasicConfigInfo basicConfigInfo)
|
||||
public Result add(@RequestBody BasicConfigInfo configQueryReq)
|
||||
{
|
||||
return toAjax(basicConfigInfoService.insertBasicConfigInfo(basicConfigInfo));
|
||||
return toAjax(basicConfigInfoService.insertBasicConfigInfo(configQueryReq));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,4 +95,14 @@ public class BasicConfigInfoController extends BaseController
|
|||
{
|
||||
return toAjax(basicConfigInfoService.deleteBasicConfigInfoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
*/
|
||||
@RequiresPermissions("etl:info:remove")
|
||||
@Log(title = "基础信息", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/connectionTest")
|
||||
public Result connectionTest(BasicConfigInfo basicConfigInfo){
|
||||
return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
package com.muyu.etl.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.etl.domain.BasicParams;
|
||||
|
||||
/**
|
||||
* Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-20
|
||||
*/
|
||||
public interface BasicParamsMapper extends BaseMapper<BasicParams>
|
||||
{
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
public BasicParams selectBasicParamsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param basicParams
|
||||
* @return 集合
|
||||
*/
|
||||
public List<BasicParams> selectBasicParamsList(BasicParams basicParams);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param basicParams
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasicParams(BasicParams basicParams);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param basicParams
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasicParams(BasicParams basicParams);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicParamsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicParamsByIds(Long[] ids);
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.domain.resp.BasicConfigResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service接口
|
||||
|
@ -28,15 +27,15 @@ public interface BasicConfigInfoService extends IService<BasicConfigInfo>
|
|||
* @param basicConfigInfo
|
||||
* @return 集合
|
||||
*/
|
||||
public List<BasicConfigResp> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
|
||||
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @param configQueryReq
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasicConfigInfo(BasicConfigInfo basicConfigInfo);
|
||||
public int insertBasicConfigInfo(BasicConfigInfo configQueryReq);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
|
@ -61,4 +60,6 @@ public interface BasicConfigInfoService extends IService<BasicConfigInfo>
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicConfigInfoById(Long id);
|
||||
|
||||
boolean connectionTest(BasicConfigInfo basicConfigInfo);
|
||||
}
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
package com.muyu.etl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.etl.domain.BasicParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-20
|
||||
*/
|
||||
public interface BasicParamsService extends IService<BasicParams>
|
||||
{
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
public BasicParams selectBasicParamsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param basicParams
|
||||
* @return 集合
|
||||
*/
|
||||
public List<BasicParams> selectBasicParamsList(BasicParams basicParams);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param basicParams
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasicParams(BasicParams basicParams);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param basicParams
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasicParams(BasicParams basicParams);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids 需要删除的主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicParamsByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasicParamsById(Long id);
|
||||
}
|
|
@ -1,21 +1,17 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.domain.BasicParams;
|
||||
import com.muyu.etl.domain.resp.BasicConfigResp;
|
||||
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
||||
import com.muyu.etl.service.BasicConfigInfoService;
|
||||
import com.muyu.etl.service.BasicParamsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Service业务层处理
|
||||
|
@ -28,8 +24,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
|||
{
|
||||
@Autowired
|
||||
private BasicConfigInfoMapper basicConfigInfoMapper;
|
||||
@Autowired
|
||||
private BasicParamsService basicParamsService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
|
@ -50,56 +45,33 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BasicConfigResp> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo)
|
||||
public List<BasicConfigInfo> selectBasicConfigInfoList(BasicConfigInfo basicConfigInfo)
|
||||
{
|
||||
List<BasicConfigResp> basicConfigRespList = basicConfigInfoMapper.selectBasicConfigInfoList(basicConfigInfo).stream().map(
|
||||
info -> {
|
||||
List<BasicParams> list = basicParamsService.list(new LambdaQueryWrapper<BasicParams>().eq(BasicParams::getBasicConfigInfoId, info.getId()));
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
list.forEach(basicParam -> buffer.append("&"+basicParam.getParamsName()+"="+basicParam.getParamsValue()));
|
||||
return BasicConfigResp.builder()
|
||||
.id(info.getId())
|
||||
.host(info.getHost())
|
||||
.port(info.getPort())
|
||||
.databaseName(info.getDatabaseName())
|
||||
.databaseType(info.getDatabaseType())
|
||||
.initLinkNum(info.getInitLinkNum())
|
||||
.maxLinkNum(info.getMaxLinkNum())
|
||||
.dataResourceName(info.getDataSourcesSystemName())
|
||||
.dataSourcesSystemName(info.getDataSourcesSystemName())
|
||||
.maxWaitTime(info.getMaxWaitTime())
|
||||
.maxWaitTimes(info.getMaxWaitTimes())
|
||||
.connectionParam(String.valueOf(buffer).substring(1))
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new Date())
|
||||
.remark(info.getRemark())
|
||||
.build();
|
||||
}).collect(Collectors.toList());
|
||||
return basicConfigRespList;
|
||||
return basicConfigInfoMapper.selectBasicConfigInfoList(basicConfigInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @param configQueryReq
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBasicConfigInfo(BasicConfigInfo basicConfigInfo)
|
||||
public int insertBasicConfigInfo(BasicConfigInfo configQueryReq)
|
||||
{
|
||||
return basicConfigInfoMapper.insertBasicConfigInfo(basicConfigInfo);
|
||||
return basicConfigInfoMapper.insertBasicConfigInfo(configQueryReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param basicConfigInfo
|
||||
* @param configQueryReq
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBasicConfigInfo(BasicConfigInfo basicConfigInfo)
|
||||
public int updateBasicConfigInfo(BasicConfigInfo configQueryReq)
|
||||
{
|
||||
return basicConfigInfoMapper.updateBasicConfigInfo(basicConfigInfo);
|
||||
return basicConfigInfoMapper.updateBasicConfigInfo(configQueryReq);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,4 +97,25 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
|||
{
|
||||
return basicConfigInfoMapper.deleteBasicConfigInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connectionTest(BasicConfigInfo basicConfigInfo) {
|
||||
//定义下面需要的对象
|
||||
String host = basicConfigInfo.getHost();
|
||||
String port = basicConfigInfo.getPort();
|
||||
String databaseName = basicConfigInfo.getDatabaseName();
|
||||
|
||||
String url = "jdbc:mysql://localhost:3306/yourDatabase";
|
||||
String user = "yourUsername";
|
||||
String password = "yourPassword";
|
||||
|
||||
try {
|
||||
Connection conn = DriverManager.getConnection(url, user, password);
|
||||
System.out.println("Connected to the MySQL server successfully.");
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Connection to MySQL failed: " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
package com.muyu.etl.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.system.domain.SysDictData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.etl.mapper.BasicParamsMapper;
|
||||
import com.muyu.etl.domain.BasicParams;
|
||||
import com.muyu.etl.service.BasicParamsService;
|
||||
|
||||
/**
|
||||
* Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-20
|
||||
*/
|
||||
@Service
|
||||
public class BasicParamsServiceImpl extends ServiceImpl<BasicParamsMapper, BasicParams> implements BasicParamsService
|
||||
{
|
||||
@Autowired
|
||||
private BasicParamsMapper basicParamsMapper;
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BasicParams selectBasicParamsById(Long id)
|
||||
{
|
||||
return basicParamsMapper.selectBasicParamsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param basicParams
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BasicParams> selectBasicParamsList(BasicParams basicParams)
|
||||
{
|
||||
return basicParamsMapper.selectBasicParamsList(basicParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param basicParams
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBasicParams(BasicParams basicParams)
|
||||
{
|
||||
return basicParamsMapper.insertBasicParams(basicParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param basicParams
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBasicParams(BasicParams basicParams)
|
||||
{
|
||||
return basicParamsMapper.updateBasicParams(basicParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids 需要删除的主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasicParamsByIds(Long[] ids)
|
||||
{
|
||||
return basicParamsMapper.deleteBasicParamsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasicParamsById(Long id)
|
||||
{
|
||||
return basicParamsMapper.deleteBasicParamsById(id);
|
||||
}
|
||||
}
|
|
@ -16,11 +16,12 @@
|
|||
<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, data_sources_system_name, host, port, database_type, database_name, init_link_num, max_link_num, max_wait_time, max_wait_times, remark from basic_config_info
|
||||
select id, data_resource_name, 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">
|
||||
|
@ -58,6 +59,7 @@
|
|||
<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=",">
|
||||
|
@ -72,6 +74,7 @@
|
|||
<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>
|
||||
|
@ -89,6 +92,7 @@
|
|||
<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}
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
<?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.BasicParamsMapper">
|
||||
|
||||
<resultMap type="com.muyu.etl.domain.BasicParams" id="BasicParamsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="basicConfigInfoId" column="basic_config_info_id" />
|
||||
<result property="paramsName" column="params_name" />
|
||||
<result property="paramsValue" column="params_value" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasicParamsVo">
|
||||
select id, basic_config_info_id, params_name, params_value from basic_params
|
||||
</sql>
|
||||
|
||||
<select id="selectBasicParamsList" parameterType="com.muyu.etl.domain.BasicParams" resultMap="BasicParamsResult">
|
||||
<include refid="selectBasicParamsVo"/>
|
||||
<where>
|
||||
<if test="basicConfigInfoId != null "> and basic_config_info_id = #{basicConfigInfoId}</if>
|
||||
<if test="paramsName != null and paramsName != ''"> and params_name like concat('%', #{paramsName}, '%')</if>
|
||||
<if test="paramsValue != null and paramsValue != ''"> and params_value = #{paramsValue}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasicParamsById" parameterType="Long" resultMap="BasicParamsResult">
|
||||
<include refid="selectBasicParamsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBasicParams" parameterType="com.muyu.etl.domain.BasicParams">
|
||||
insert into basic_params
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="basicConfigInfoId != null">basic_config_info_id,</if>
|
||||
<if test="paramsName != null">params_name,</if>
|
||||
<if test="paramsValue != null">params_value,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="basicConfigInfoId != null">#{basicConfigInfoId},</if>
|
||||
<if test="paramsName != null">#{paramsName},</if>
|
||||
<if test="paramsValue != null">#{paramsValue},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasicParams" parameterType="com.muyu.etl.domain.BasicParams">
|
||||
update basic_params
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="basicConfigInfoId != null">basic_config_info_id = #{basicConfigInfoId},</if>
|
||||
<if test="paramsName != null">params_name = #{paramsName},</if>
|
||||
<if test="paramsValue != null">params_value = #{paramsValue},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasicParamsById" parameterType="Long">
|
||||
delete from basic_params where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasicParamsByIds" parameterType="String">
|
||||
delete from basic_params where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue