✨ Introducing new features. support 瀚高数据库

This commit is contained in:
lbw committed 2023-04-27 21:14:26 +08:00
1 parent 344a30b47b
commit 04d5010f78
7 files changed
+145 -1

No files matched your search

+1
View File
@@ -237,6 +237,7 @@ INSERT INTO `sys_dict_item` VALUES (88, 27, 'oracle', 'oracle', 'ds_type', 'orac
INSERT INTO `sys_dict_item` VALUES (89, 27, 'mssql', 'mssql', 'ds_type', 'mssql', 3, 'admin', ' ', '2023-03-12 09:58:42', NULL, NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (90, 27, 'db2', 'db2', 'ds_type', 'db2', 4, 'admin', ' ', '2023-03-12 09:58:53', NULL, NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (91, 27, 'dm', '达梦', 'ds_type', '达梦', 5, 'admin', ' ', '2023-03-12 09:59:07', NULL, NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (92, 27, 'highgo', '瀚高', 'ds_type', '瀚高数据库', 5, 'admin', ' ', '2023-03-12 09:59:07', NULL, NULL, '0', 1);
COMMIT;
-- ----------------------------
+6
View File
@@ -26,6 +26,7 @@
<oracle.version>21.3.0.0</oracle.version>
<sqlserver.version>8.4.1.jre8</sqlserver.version>
<dm.version>8.1.2.79</dm.version>
<highgo.version>6.2.0</highgo.version>
<knife4j.version>3.0.3</knife4j.version>
<swagger.core.version>2.2.0</swagger.core.version>
<springdoc.version>1.6.9</springdoc.version>
@@ -225,6 +226,11 @@
<artifactId>DmJdbcDriver18</artifactId>
<version>${dm.version}</version>
</dependency>
<dependency>
<groupId>com.highgo</groupId>
<artifactId>HgdbJdbc</artifactId>
<version>${highgo.version}</version>
</dependency>
<!--fastjson-->
<dependency>
<groupId>com.alibaba</groupId>
@@ -47,7 +47,12 @@ public enum DsJdbcUrlEnum {
/**
* 达梦
*/
DM("dm", "jdbc:dm://%s:%s/%s", "select 1 from dual", "达梦连接");
DM("dm", "jdbc:dm://%s:%s/%s", "select 1 from dual", "达梦连接"),
/**
* pg 数据库
*/
HIGHGO("highgo", "jdbc:highgo://%s:%s/%s", "select 1", "highgo 链接");
private final String dbName;
@@ -0,0 +1,31 @@
package com.pig4cloud.pigx.common.sequence.range.impl.db.provider;
import com.baomidou.mybatisplus.annotation.DbType;
import org.springframework.stereotype.Component;
/**
* 瀚高数据源
*
* @author lengleng
* @date 2023-04-26
*/
@Component
public class HighGoSqlProvider implements SqlProvider {
/**
* 获取建表语句
* @return
*/
@Override
public String getCreateTableSql() {
return "CREATE TABLE IF NOT EXISTS #tableName (ID int8 PRIMARY KEY NOT NULL"
+ ",VALUE int8 NOT NULL,NAME VARCHAR (266) NOT NULL,gmt_create TIMESTAMP (6) NOT NULL"
+ ",gmt_modified TIMESTAMP (6) NOT NULL)";
}
@Override
public Boolean support(DbType dbType) {
return DbType.HIGH_GO.equals(dbType);
}
}
+5
View File
@@ -72,6 +72,11 @@
<artifactId>jcc</artifactId>
<version>${db2.version}</version>
</dependency>
<!-- 瀚高 -->
<dependency>
<groupId>com.highgo</groupId>
<artifactId>HgdbJdbc</artifactId>
</dependency>
<!--DM-->
<dependency>
<groupId>com.dameng</groupId>
@@ -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;
/**
* 支持 瀚高数据库 代码生成器
*
* @author lengleng
* @date 2023-04-26
*/
@Mapper
public interface GeneratorHighGoMapper extends GeneratorMapper {
}
@@ -0,0 +1,65 @@
<?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.GeneratorHighGoMapper">
<select id="queryTable" resultType="map">
SELECT
relname AS "tableName",
obj_description ( oid ) AS "tableComment"
FROM
pg_class
WHERE
relkind = 'r'
<if test="tableName != null and tableName.trim() != ''">
and relname = #{tableName}
</if>
AND relname NOT LIKE'pg_%'
AND relname NOT LIKE'sql_%'
AND relchecks = 0
AND relnamespace = (
SELECT
oid
FROM
pg_namespace
WHERE
nspname = ( SELECT CURRENT_SCHEMA ( ) )
)
ORDER BY relname
</select>
<sql id="queryColumn">
SELECT
'highgo' AS "dbType",
pa.attname AS "columnName",
pg_type.typname AS "columnType",
pg_type.typname AS "dataType",
col_description ( pa.attrelid, pa.attnum ) AS "comments",
(
CASE
pcon.contype
WHEN 'p' THEN
'PRI' ELSE''
END
) AS "columnKey"
FROM
pg_class AS pc,
pg_attribute AS pa
INNER JOIN pg_type ON pg_type.oid = pa.atttypid
LEFT JOIN pg_constraint pcon ON pa.attnum = pcon.conkey[1]
AND pa.attrelid = pcon.conrelid
WHERE
pc.relname = #{ tableName }
AND pa.attrelid = pc.oid
AND pa.attnum > 0
</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>