From fc6fefd2246308f5225a9d2f3c87d020dcfeca82 Mon Sep 17 00:00:00 2001 From: lengleng Date: Tue, 15 Dec 2020 16:41:58 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Introducing=20new=20features.=20#2?= =?UTF-8?q?151=20=E3=80=90=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E3=80=91=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81ORACEL=20/=20SQL=20SERVER=20/PG/DB2=20?= =?UTF-8?q?=E7=AD=89=E5=85=B6=E4=BB=96=E6=95=B0=E6=8D=AE=E6=BA=90=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/datasource/util/DsJdbcUrlEnum.java | 7 ++- pigx-visual/pigx-codegen/pom.xml | 7 +++ ...SqlMapper.java => GeneratorDB2Mapper.java} | 4 +- .../codegen/mapper/GeneratorMysqlMapper.java | 31 +++++++++++++ .../resources/mapper/GeneratorDB2Mapper.xml | 44 +++++++++++++++++++ .../resources/mapper/GeneratorMySqlMapper.xml | 2 +- 6 files changed, 91 insertions(+), 4 deletions(-) rename pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/{GeneratorMySqlMapper.java => GeneratorDB2Mapper.java} (90%) create mode 100755 pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorMysqlMapper.java create mode 100755 pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDB2Mapper.xml diff --git a/pigx-common/pigx-common-datasource/src/main/java/com/pig4cloud/pigx/common/datasource/util/DsJdbcUrlEnum.java b/pigx-common/pigx-common-datasource/src/main/java/com/pig4cloud/pigx/common/datasource/util/DsJdbcUrlEnum.java index 0987fcfaf..44b064f7b 100644 --- a/pigx-common/pigx-common-datasource/src/main/java/com/pig4cloud/pigx/common/datasource/util/DsJdbcUrlEnum.java +++ b/pigx-common/pigx-common-datasource/src/main/java/com/pig4cloud/pigx/common/datasource/util/DsJdbcUrlEnum.java @@ -37,7 +37,12 @@ public enum DsJdbcUrlEnum { /** * oracle */ - ORACLE("oracle", "jdbc:oracle:thin:@%s:%s:%s", "oracle 链接"); + ORACLE("oracle", "jdbc:oracle:thin:@%s:%s:%s", "oracle 链接"), + + /** + * db2 + */ + DB2("db2", "jdbc:db2://%s:%s/%s", "DB2 TYPE4 连接"); private final String dbName; diff --git a/pigx-visual/pigx-codegen/pom.xml b/pigx-visual/pigx-codegen/pom.xml index 055488dd2..7c035b0fc 100755 --- a/pigx-visual/pigx-codegen/pom.xml +++ b/pigx-visual/pigx-codegen/pom.xml @@ -16,6 +16,7 @@ 4.0 + 11.5.0.0 12.1.0.1-atlassian-hosted @@ -66,6 +67,12 @@ sqljdbc4 ${sqlserver.version} + + + com.ibm.db2 + jcc + ${db2.version} + com.alibaba diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorMySqlMapper.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorDB2Mapper.java similarity index 90% rename from pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorMySqlMapper.java rename to pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorDB2Mapper.java index a490d67f6..3fb3473a7 100755 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorMySqlMapper.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorDB2Mapper.java @@ -20,12 +20,12 @@ package com.pig4cloud.pigx.codegen.mapper; import org.apache.ibatis.annotations.Mapper; /** - * 支持 MySql 代码生成器 + * 支持 db2 代码生成器 * * @author lengleng * @date 2020-12-11 */ @Mapper -public interface GeneratorMySqlMapper extends GeneratorMapper { +public interface GeneratorDB2Mapper extends GeneratorMapper { } diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorMysqlMapper.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorMysqlMapper.java new file mode 100755 index 000000000..512c5b612 --- /dev/null +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GeneratorMysqlMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.codegen.mapper; + +import org.apache.ibatis.annotations.Mapper; + +/** + * 支持 mysql 代码生成器 + * + * @author lengleng + * @date 2020-12-11 + */ +@Mapper +public interface GeneratorMysqlMapper extends GeneratorMapper { + +} diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDB2Mapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDB2Mapper.xml new file mode 100755 index 000000000..51d54cab8 --- /dev/null +++ b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDB2Mapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + SELECT 'db2' AS "dbType", + COLNAME AS "columnName", + TYPENAME AS "dataType", + REMARKS AS "comments", + TYPENAME AS "columnType" + FROM SYSCAT.COLUMNS + WHERE TABSCHEMA = (SELECT CURRENT_SCHEMA + FROM SYSIBM.SYSDUMMY1 + ) + and TABNAME = #{tableName} + + + + + + + diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml index e372b1a6c..aaf0a711e 100755 --- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml +++ b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml @@ -1,7 +1,7 @@ - +