From 747aa9ddf914396d4134d210c50166416b036d9b Mon Sep 17 00:00:00 2001 From: Yunfei Du <278774021@qq.com> Date: Mon, 29 Apr 2024 22:27:36 +0800 Subject: [PATCH] =?UTF-8?q?ETL=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etl-common/etl-common-core/pom.xml | 5 + .../security/aspect/InnerAuthAspect.java | 1 + .../etl/data/source/domain/DataSource.java | 210 ------------------ .../etl-data-source-server/pom.xml | 7 + .../data/source/ETLDataSourceApplication.java | 22 -- .../controller/DataSourceController.java | 105 --------- .../data/source/mapper/DataSourceMapper.java | 62 ------ .../source/service/IDataSourceService.java | 63 ------ .../service/impl/DataSourceServiceImpl.java | 96 -------- .../src/main/resources/bootstrap.yml | 2 +- .../mapper/dataSource/DataSourceMapper.xml | 138 ------------ .../java/com/etl/gen/util/VelocityUtils.java | 2 +- 12 files changed, 15 insertions(+), 698 deletions(-) delete mode 100644 etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/source/domain/DataSource.java delete mode 100644 etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/ETLDataSourceApplication.java delete mode 100644 etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/controller/DataSourceController.java delete mode 100644 etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/mapper/DataSourceMapper.java delete mode 100644 etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/service/IDataSourceService.java delete mode 100644 etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/service/impl/DataSourceServiceImpl.java delete mode 100644 etl-modules/etl-data-source/etl-data-source-server/src/main/resources/mapper/dataSource/DataSourceMapper.xml diff --git a/etl-common/etl-common-core/pom.xml b/etl-common/etl-common-core/pom.xml index ea09bc5..f641aa9 100644 --- a/etl-common/etl-common-core/pom.xml +++ b/etl-common/etl-common-core/pom.xml @@ -136,6 +136,11 @@ lombok + + redis.clients + jedis + + diff --git a/etl-common/etl-common-security/src/main/java/com/etl/common/security/aspect/InnerAuthAspect.java b/etl-common/etl-common-security/src/main/java/com/etl/common/security/aspect/InnerAuthAspect.java index cf239d2..5627703 100644 --- a/etl-common/etl-common-security/src/main/java/com/etl/common/security/aspect/InnerAuthAspect.java +++ b/etl-common/etl-common-security/src/main/java/com/etl/common/security/aspect/InnerAuthAspect.java @@ -27,6 +27,7 @@ public class InnerAuthAspect implements Ordered { throw new InnerAuthException("没有内部访问权限,不允许访问"); } + String userid = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USER_ID); String username = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USERNAME); // 用户信息验证 diff --git a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/source/domain/DataSource.java b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/source/domain/DataSource.java deleted file mode 100644 index 5721ec8..0000000 --- a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/source/domain/DataSource.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.etl.data.source.domain; - - -import com.etl.common.core.annotation.Excel; -import com.etl.common.core.web.domain.BaseEntity; - -/** - * 【请填写功能名称】对象 data_source - * - * @author fei - * @date 2024-04-21 - */ -public class DataSource extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - - /** 接入源名称 */ - @Excel(name = "接入源名称") - private String name; - - /** 数据来源系统名称 */ - @Excel(name = "数据来源系统名称") - private String systemName; - - /** 主机ip地址 */ - @Excel(name = "主机ip地址") - private String host; - - /** 端口 */ - @Excel(name = "端口") - private String port; - - /** 用户名 */ - @Excel(name = "用户名") - private String username; - - /** 密码 */ - @Excel(name = "密码") - private String password; - - /** 数据接入类型 */ - @Excel(name = "数据接入类型") - private String type; - - /** 数据库名称 */ - @Excel(name = "数据库名称") - private String databaseName; - - /** 数据连接参数 */ - @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; - - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSystemName() { - return systemName; - } - - public void setSystemName(String systemName) { - this.systemName = systemName; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public String getPort() { - return port; - } - - public void setPort(String port) { - this.port = port; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDatabaseName() { - return databaseName; - } - - public void setDatabaseName(String databaseName) { - this.databaseName = databaseName; - } - - public String getConnectionParam() { - return connectionParam; - } - - public void setConnectionParam(String connectionParam) { - this.connectionParam = connectionParam; - } - - public Long getInitNum() { - return initNum; - } - - public void setInitNum(Long initNum) { - this.initNum = initNum; - } - - public Long getMaxNum() { - return maxNum; - } - - public void setMaxNum(Long maxNum) { - this.maxNum = maxNum; - } - - public Long getMaxWaitTime() { - return maxWaitTime; - } - - public void setMaxWaitTime(Long maxWaitTime) { - this.maxWaitTime = maxWaitTime; - } - - public Long getMaxWaitSize() { - return maxWaitSize; - } - - public void setMaxWaitSize(Long maxWaitSize) { - this.maxWaitSize = maxWaitSize; - } - - - - @Override - public String toString() { - return "DataSource{" + - "id=" + id + - ", name='" + name + '\'' + - ", systemName='" + systemName + '\'' + - ", host='" + host + '\'' + - ", port='" + port + '\'' + - ", username='" + username + '\'' + - ", password='" + password + '\'' + - ", type='" + type + '\'' + - ", databaseName='" + databaseName + '\'' + - ", connectionParam='" + connectionParam + '\'' + - ", initNum=" + initNum + - ", maxNum=" + maxNum + - ", maxWaitTime=" + maxWaitTime + - ", maxWaitSize=" + maxWaitSize + - "} " + super.toString ( ); - } - - -} diff --git a/etl-modules/etl-data-source/etl-data-source-server/pom.xml b/etl-modules/etl-data-source/etl-data-source-server/pom.xml index 186eaf7..0e1e747 100644 --- a/etl-modules/etl-data-source/etl-data-source-server/pom.xml +++ b/etl-modules/etl-data-source/etl-data-source-server/pom.xml @@ -92,6 +92,13 @@ etl-data-source-remote + + + org.postgresql + postgresql + 42.5.0 + + diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/ETLDataSourceApplication.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/ETLDataSourceApplication.java deleted file mode 100644 index 16d18b3..0000000 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/ETLDataSourceApplication.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.etl.data.source; - -import com.etl.common.security.annotation.EnableCustomConfig; -import com.etl.common.security.annotation.EnableMyFeignClients; -import com.etl.common.swagger.annotation.EnableCustomSwagger2; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * 系统模块 - * - * @author etl - */ -@EnableCustomConfig -@EnableCustomSwagger2 -@EnableMyFeignClients -@SpringBootApplication -public class ETLDataSourceApplication { - public static void main (String[] args) { - SpringApplication.run(ETLDataSourceApplication.class, args); - } -} diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/controller/DataSourceController.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/controller/DataSourceController.java deleted file mode 100644 index 7faca32..0000000 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/controller/DataSourceController.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.etl.data.source.controller; - -import java.util.List; -import javax.servlet.http.HttpServletResponse; - -import com.etl.data.source.domain.DataSource; -import com.etl.data.source.service.IDataSourceService; -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.etl.common.log.annotation.Log; -import com.etl.common.log.enums.BusinessType; -import com.etl.common.security.annotation.RequiresPermissions; -import com.etl.common.core.web.controller.BaseController; -import com.etl.common.core.domain.Result; -import com.etl.common.core.utils.poi.ExcelUtil; -import com.etl.common.core.web.page.TableDataInfo; - -/** - * 【请填写功能名称】Controller - * - * @author fei - * @date 2024-04-21 - */ -@RestController -@RequestMapping("/source") -public class DataSourceController extends BaseController -{ - @Autowired - private IDataSourceService dataSourceService; - - /** - * 查询【请填写功能名称】列表 - */ - @RequiresPermissions("data_source:source:list") - @GetMapping("/list") - public Result< TableDataInfo< DataSource > > list(DataSource dataSource) - { - startPage(); - List list = dataSourceService.selectDataSourceList(dataSource); - return getDataTable(list); - } - - /** - * 导出【请填写功能名称】列表 - */ - @RequiresPermissions("data_source:source:export") - @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, DataSource dataSource) - { - List list = dataSourceService.selectDataSourceList(dataSource); - ExcelUtil util = new ExcelUtil(DataSource.class); - util.exportExcel(response, list, "【请填写功能名称】数据"); - } - - /** - * 获取【请填写功能名称】详细信息 - */ - @RequiresPermissions("data_source:source:query") - @GetMapping(value = "/{id}") - public Result getInfo(@PathVariable("id") Long id) - { - return success(dataSourceService.selectDataSourceById(id)); - } - - /** - * 新增【请填写功能名称】 - */ - @RequiresPermissions("data_source:source:add") - @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) - @PostMapping - public Result add(@RequestBody DataSource dataSource) - { - return toAjax(dataSourceService.insertDataSource(dataSource)); - } - - /** - * 修改【请填写功能名称】 - */ - @RequiresPermissions("data_source:source:edit") - @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) - @PutMapping - public Result edit(@RequestBody DataSource dataSource) - { - return toAjax(dataSourceService.updateDataSource(dataSource)); - } - - /** - * 删除【请填写功能名称】 - */ - @RequiresPermissions("data_source:source:remove") - @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public Result remove(@PathVariable Long[] ids) - { - return toAjax(dataSourceService.deleteDataSourceByIds(ids)); - } -} diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/mapper/DataSourceMapper.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/mapper/DataSourceMapper.java deleted file mode 100644 index 94102af..0000000 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/mapper/DataSourceMapper.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.etl.data.source.mapper; - -import com.etl.data.source.domain.DataSource; - -import java.util.List; - -/** - * 【请填写功能名称】Mapper接口 - * - * @author fei - * @date 2024-04-21 - */ -public interface DataSourceMapper -{ - /** - * 查询【请填写功能名称】 - * - * @param id 【请填写功能名称】主键 - * @return 【请填写功能名称】 - */ - public DataSource selectDataSourceById(Long id); - - /** - * 查询【请填写功能名称】列表 - * - * @param dataSource 【请填写功能名称】 - * @return 【请填写功能名称】集合 - */ - public List 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); -} diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/service/IDataSourceService.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/service/IDataSourceService.java deleted file mode 100644 index 4380372..0000000 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/service/IDataSourceService.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.etl.data.source.service; - -import com.etl.data.source.domain.DataSource; - -import java.util.List; - - -/** - * 【请填写功能名称】Service接口 - * - * @author fei - * @date 2024-04-21 - */ -public interface IDataSourceService -{ - /** - * 查询【请填写功能名称】 - * - * @param id 【请填写功能名称】主键 - * @return 【请填写功能名称】 - */ - public DataSource selectDataSourceById(Long id); - - /** - * 查询【请填写功能名称】列表 - * - * @param dataSource 【请填写功能名称】 - * @return 【请填写功能名称】集合 - */ - public List 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); -} diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/service/impl/DataSourceServiceImpl.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/service/impl/DataSourceServiceImpl.java deleted file mode 100644 index 99f9674..0000000 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/source/service/impl/DataSourceServiceImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.etl.data.source.service.impl; - -import java.util.List; -import com.etl.common.core.utils.DateUtils; -import com.etl.data.source.domain.DataSource; -import com.etl.data.source.mapper.DataSourceMapper; -import com.etl.data.source.service.IDataSourceService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * 【请填写功能名称】Service业务层处理 - * - * @author fei - * @date 2024-04-21 - */ -@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 selectDataSourceList(DataSource dataSource) - { - return dataSourceMapper.selectDataSourceList(dataSource); - } - - /** - * 新增【请填写功能名称】 - * - * @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); - } -} diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/resources/bootstrap.yml b/etl-modules/etl-data-source/etl-data-source-server/src/main/resources/bootstrap.yml index bdd3d41..4160fb2 100644 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/resources/bootstrap.yml +++ b/etl-modules/etl-data-source/etl-data-source-server/src/main/resources/bootstrap.yml @@ -31,4 +31,4 @@ spring: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} logging: level: - com.etl.shop.cart.mapper: DEBUG + com.etl.data.mapper: DEBUG diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/resources/mapper/dataSource/DataSourceMapper.xml b/etl-modules/etl-data-source/etl-data-source-server/src/main/resources/mapper/dataSource/DataSourceMapper.xml deleted file mode 100644 index d7f8de3..0000000 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/resources/mapper/dataSource/DataSourceMapper.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, name, systemName, host, port, username, password, type, database_name, connection_param, init_num, max_num, max_wait_time, max_wait_size, create_by, create_time, update_by, update_time, remark from data_source - - - - - - - - insert into data_source - - id, - name, - systemName, - host, - port, - username, - password, - type, - database_name, - connection_param, - init_num, - max_num, - max_wait_time, - max_wait_size, - create_by, - create_time, - update_by, - update_time, - remark, - - - #{id}, - #{name}, - #{systemName}, - #{host}, - #{port}, - #{username}, - #{password}, - #{type}, - #{databaseName}, - #{connectionParam}, - #{initNum}, - #{maxNum}, - #{maxWaitTime}, - #{maxWaitSize}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{remark}, - - - - - update data_source - - name = #{name}, - systemName = #{systemName}, - host = #{host}, - port = #{port}, - username = #{username}, - password = #{password}, - type = #{type}, - database_name = #{databaseName}, - connection_param = #{connectionParam}, - init_num = #{initNum}, - max_num = #{maxNum}, - max_wait_time = #{maxWaitTime}, - max_wait_size = #{maxWaitSize}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - remark = #{remark}, - - where id = #{id} - - - - delete from data_source where id = #{id} - - - - delete from data_source where id in - - #{id} - - - diff --git a/etl-modules/etl-gen/src/main/java/com/etl/gen/util/VelocityUtils.java b/etl-modules/etl-gen/src/main/java/com/etl/gen/util/VelocityUtils.java index f6d307c..0f72ed7 100644 --- a/etl-modules/etl-gen/src/main/java/com/etl/gen/util/VelocityUtils.java +++ b/etl-modules/etl-gen/src/main/java/com/etl/gen/util/VelocityUtils.java @@ -50,7 +50,7 @@ public class VelocityUtils { VelocityContext velocityContext = new VelocityContext(); velocityContext.put("tplCategory", genTable.getTplCategory()); velocityContext.put("tableName", genTable.getTableName()); - velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); + velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "数据源"); velocityContext.put("ClassName", genTable.getClassName()); velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); velocityContext.put("moduleName", genTable.getModuleName());