✨ Introducing new features. #2151 【代码生成】 支持ORACEL / SQL SERVER /PG/DB2 等其他数据源类型代码生成
This commit is contained in:
1 parent
afe07e9d56
commit
fc6fefd224
6 files changed
+91
-4
No files matched your search
+6
-1
@@ -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;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
<properties>
|
||||
<sqlserver.version>4.0</sqlserver.version>
|
||||
<db2.version>11.5.0.0</db2.version>
|
||||
<oracle.version>12.1.0.1-atlassian-hosted</oracle.version>
|
||||
</properties>
|
||||
|
||||
@@ -66,6 +67,12 @@
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>${sqlserver.version}</version>
|
||||
</dependency>
|
||||
<!-- db2 驱动-->
|
||||
<dependency>
|
||||
<groupId>com.ibm.db2</groupId>
|
||||
<artifactId>jcc</artifactId>
|
||||
<version>${db2.version}</version>
|
||||
</dependency>
|
||||
<!-- druid 连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
|
||||
+2
-2
@@ -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 {
|
||||
|
||||
}
|
||||
Executable
+31
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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.pig4cloud.pigx.codegen.mapper.GeneratorDB2Mapper">
|
||||
|
||||
<select id="queryTable" resultType="map">
|
||||
SELECT
|
||||
'db2' AS "dbType",
|
||||
TABNAME AS "tableName",
|
||||
REMARKS AS "tableComment",
|
||||
CREATE_TIME AS "createTime"
|
||||
FROM syscat.TABLES
|
||||
WHERE TABSCHEMA = (SELECT CURRENT_SCHEMA
|
||||
FROM SYSIBM.SYSDUMMY1
|
||||
)
|
||||
<if test="tableName != null and tableName.trim() != ''">
|
||||
and TABNAME = #{tableName}
|
||||
</if>
|
||||
ORDER BY CREATE_TIME DESC
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="queryColumn">
|
||||
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}
|
||||
</sql>
|
||||
|
||||
<select id="selectTableColumn" resultType="com.pig4cloud.pigx.codegen.entity.ColumnEntity">
|
||||
<include refid="queryColumn"/>
|
||||
</select>
|
||||
|
||||
<select id="selectMapTableColumn" resultType="map">
|
||||
<include refid="queryColumn"/>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.pig4cloud.pigx.codegen.mapper.GeneratorMySqlMapper">
|
||||
<mapper namespace="com.pig4cloud.pigx.codegen.mapper.GeneratorMysqlMapper">
|
||||
|
||||
<select id="queryTable" resultType="map">
|
||||
SELECT
|
||||
|
||||
Reference in new issue
Block a user