✨ Introducing new features. #2151 【代码生成】 支持ORACEL / SQL SERVER /PG/DB2 等其他数据源类型代码生成

This commit is contained in:
lengleng committed 2020-12-15 16:41:58 +08:00
1 parent afe07e9d56
commit fc6fefd224
6 files changed
+91 -4

No files matched your search

@@ -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 {
}
@@ -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