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 @@ - +