diff --git a/db/pig.sql b/db/pig.sql index 62415248..9d5a4672 100644 --- a/db/pig.sql +++ b/db/pig.sql @@ -96,6 +96,7 @@ CREATE TABLE `sys_dict` ( BEGIN; INSERT INTO `sys_dict` VALUES (1, 'dict_type', '字典类型', '系统类不能修改', '1', '0', '2019-05-16 14:16:20', NULL, NULL, '2019-05-16 14:20:16'); INSERT INTO `sys_dict` VALUES (2, 'log_type', '日志类型', '0-正常 1 异常', '1', '0', '2020-03-13 14:21:01', NULL, NULL, '2020-03-13 14:21:01'); +INSERT INTO `sys_dict` VALUES (3, 'ds_type', '驱动类型', '数据库驱动类型', '1', '0', '2021-10-15 16:24:35', NULL, NULL, '2021-10-15 16:24:38'); COMMIT; -- ---------------------------- @@ -130,6 +131,14 @@ INSERT INTO `sys_dict_item` VALUES (1, 1, '1', '系统类', 'dict_type', '系统 INSERT INTO `sys_dict_item` VALUES (2, 1, '0', '业务类', 'dict_type', '业务类字典', 0, '可以修改', '0', '2019-05-16 14:20:59', NULL, NULL, '2019-05-16 14:20:59'); INSERT INTO `sys_dict_item` VALUES (3, 2, '0', '正常', 'log_type', '正常', 0, '正常', '0', '2020-03-13 14:23:22', NULL, NULL, '2020-03-13 14:23:22'); INSERT INTO `sys_dict_item` VALUES (4, 2, '9', '异常', 'log_type', '异常', 1, '异常', '0', '2020-03-13 14:23:35', NULL, NULL, '2020-03-13 14:23:35'); +INSERT INTO `sys_dict_item` VALUES (5, 3, 'com.mysql.cj.jdbc.Driver', 'MYSQL8', 'ds_type', 'MYSQL8', 0, NULL, '0', NULL, NULL, NULL, NULL); +INSERT INTO `sys_dict_item` VALUES (6, 3, 'com.mysql.jdbc.Driver', 'MYSQL5', 'ds_type', 'MYSQL5', 0, NULL, '0', NULL, NULL, NULL, NULL); +INSERT INTO `sys_dict_item` VALUES (7, 3, 'oracle.jdbc.OracleDriver', 'Oracle', 'ds_type', 'Oracle', 0, NULL, '0', NULL, NULL, NULL, NULL); +INSERT INTO `sys_dict_item` VALUES (8, 3, 'org.mariadb.jdbc.Driver', 'mariadb', 'ds_type', 'mariadb', 0, NULL, '0', NULL, NULL, NULL, NULL); +INSERT INTO `sys_dict_item` VALUES (9, 3, 'com.microsoft.sqlserver.jdbc.SQLServerDriver', 'sqlserver2005+', 'ds_type', 'sqlserver2005+', 0, NULL, '0', NULL, NULL, NULL, NULL); +INSERT INTO `sys_dict_item` VALUES (10, 3, 'com.microsoft.jdbc.sqlserver.SQLServerDriver', 'sqlserver2000', 'ds_type', 'sqlserver2000', 0, NULL, '0', NULL, NULL, NULL, NULL); +INSERT INTO `sys_dict_item` VALUES (11, 3, 'com.ibm.db2.jcc.DB2Driver', 'db2', 'ds_type', 'db2', 0, NULL, '0', NULL, NULL, NULL, NULL); +INSERT INTO `sys_dict_item` VALUES (12, 3, 'org.postgresql.Driver', 'postgresql', 'ds_type', 'postgresql', 0, NULL, '0', NULL, NULL, NULL, NULL); COMMIT; -- ---------------------------- diff --git a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java index ebb96a63..7724cd91 100644 --- a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java +++ b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java @@ -47,7 +47,6 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide /** * 执行语句获得数据源参数 - * * @param statement 语句 * @return 数据源参数 * @throws SQLException sql异常 diff --git a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/support/DriverClassNameConstants.java b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/support/DriverClassNameConstants.java deleted file mode 100644 index 7e818636..00000000 --- a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/support/DriverClassNameConstants.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.pig4cloud.pig.common.datasource.support; - -/** - * 数据库驱动ClassName - * - * @author huyuanxin - * @date 2021-10-08 - */ -public enum DriverClassNameConstants { - - /** - * MySQL Driver - * After mysql-connector-java 6 - */ - MYSQL_DRIVER("com.mysql.cj.jdbc.Driver"), - - /** - * Old MySQL Driver - * Before mysql-connector-java 5 - */ - OLD_MYSQL_DRIVER("com.mysql.jdbc.Driver"), - - /** - * Oracle Driver - */ - ORACLE_DRIVER("oracle.jdbc.OracleDriver"), - - /** - * Mariadb Driver - */ - MARIADB("org.mariadb.jdbc.Driver"), - - /** - * SqlServer Driver - * SqlServer 2005+ - */ - SQLSERVER_DRIVER("com.microsoft.sqlserver.jdbc.SQLServerDriver"), - - /** - * Old SqlServer Driver - * SqlServer 2000 - */ - OLD_SQLSERVER_DRIVER(" com.microsoft.jdbc.sqlserver.SQLServerDriver"), - - /** - * DB2 Driver - */ - DB2("com.ibm.db2.jcc.DB2Driver"), - - /** - * PostgreSQL Driver - */ - POSTGRE_SQL("org.postgresql.Driver"), - - /** - * Neo4j Bolt Driver - */ - NEO4J_BOLT("org.neo4j.jdbc.bolt.BoltDriver"), - - /** - * Neo4j Http Driver - */ - NEO4J_HTTP("org.neo4j.jdbc.http.HttpDriver"); - - private final String driverClassName; - - - DriverClassNameConstants(String driverClassName) { - this.driverClassName = driverClassName; - } - - public String getDriverClassName() { - return driverClassName; - } - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenDsConfController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenDsConfController.java index a68fcd00..bf301fe7 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenDsConfController.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenDsConfController.java @@ -20,16 +20,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.codegen.entity.GenDatasourceConf; import com.pig4cloud.pig.codegen.service.GenDatasourceConfService; import com.pig4cloud.pig.common.core.util.R; -import com.pig4cloud.pig.common.datasource.support.DriverClassNameConstants; import com.pig4cloud.pig.common.log.annotation.SysLog; import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - /** * 数据源管理 * @@ -42,14 +37,11 @@ import java.util.Optional; @Api(value = "dsconf", tags = "数据源管理模块") public class GenDsConfController { - private static List driverList = null; - private final GenDatasourceConfService datasourceConfService; /** * 分页查询 - * - * @param page 分页对象 + * @param page 分页对象 * @param datasourceConf 数据源表 * @return */ @@ -60,7 +52,6 @@ public class GenDsConfController { /** * 查询全部数据源 - * * @return */ @GetMapping("/list") @@ -70,7 +61,6 @@ public class GenDsConfController { /** * 通过id查询数据源表 - * * @param id id * @return R */ @@ -81,7 +71,6 @@ public class GenDsConfController { /** * 新增数据源表 - * * @param datasourceConf 数据源表 * @return R */ @@ -93,7 +82,6 @@ public class GenDsConfController { /** * 修改数据源表 - * * @param conf 数据源表 * @return R */ @@ -105,7 +93,6 @@ public class GenDsConfController { /** * 通过id删除数据源表 - * * @param id id * @return R */ @@ -115,21 +102,4 @@ public class GenDsConfController { return R.ok(datasourceConfService.removeByDsId(id)); } - /** - * 获得支持的数据库驱动 - * - * @return 数据库驱动列表 - */ - @SysLog("获得支持的数据库驱动") - @GetMapping("/driver") - public R> driverList() { - return Optional.ofNullable(driverList).map(R::ok).orElseGet(() -> { - driverList = new ArrayList<>(); - for (DriverClassNameConstants driverClassNameConstant : DriverClassNameConstants.values()) { - driverList.add(driverClassNameConstant.getDriverClassName()); - } - return R.ok(driverList); - }); - } - } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java index 4a31a228..2886cb05 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java @@ -51,7 +51,6 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl