diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
index 81afe56c..74649704 100644
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
+++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
@@ -139,7 +139,7 @@ public class VelocityUtils {
if (DataBaseHelper.isOracle()) {
templates.add("vm/sql/oracle/sql.vm");
} else if (DataBaseHelper.isPostgerSql()) {
- templates.add("vm/sql/postgers/sql.vm");
+ templates.add("vm/sql/postgres/sql.vm");
} else if (DataBaseHelper.isSqlServer()) {
templates.add("vm/sql/sqlserver/sql.vm");
} else {
diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
index 4614dd41..7b1e9c5f 100644
--- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
+++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
@@ -62,6 +62,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY temp.column_id
+ SELECT column_name, is_required, is_pk, sort, column_comment, is_increment, column_type
+ FROM (
+ SELECT c.relname AS table_name,
+ a.attname AS column_name,
+ d.description AS column_comment,
+ CASE WHEN a.attnotnull AND con.conname IS NULL THEN 1 ELSE 0
+ END AS is_required,
+ CASE WHEN con.conname IS NOT NULL THEN 1 ELSE 0
+ END AS is_pk,
+ a.attnum AS sort,
+ CASE WHEN "position"(pg_get_expr(ad.adbin, ad.adrelid),
+ ((c.relname::text || '_'::text) || a.attname::text) || '_seq'::text) > 0 THEN 1 ELSE 0
+ END AS is_increment,
+ btrim(
+ CASE WHEN t.typelem ]]> 0::oid AND t.typlen = '-1'::integer THEN 'ARRAY'::text ELSE
+ CASE WHEN t.typtype = 'd'::"char" THEN format_type(t.typbasetype, NULL::integer)
+ ELSE format_type(a.atttypid, NULL::integer) END
+ END, '"'::text
+ ) AS column_type
+ FROM pg_attribute a
+ JOIN (pg_class c JOIN pg_namespace n ON c.relnamespace = n.oid) ON a.attrelid = c.oid
+ LEFT JOIN pg_description d ON d.objoid = c.oid AND a.attnum = d.objsubid
+ LEFT JOIN pg_constraint con ON con.conrelid = c.oid AND (a.attnum = ANY (con.conkey))
+ LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum
+ LEFT JOIN pg_type t ON a.atttypid = t.oid
+ WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
+ AND a.attnum > 0
+ AND n.nspname = 'public'::name
+ ORDER BY c.relname, a.attnum
+ ) temp
+ WHERE table_name = (#{tableName})
diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
index c2a39fda..b66b25d8 100644
--- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
+++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
@@ -85,6 +85,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc
+ select table_name, table_comment, create_time, update_time
+ from (
+ SELECT c.relname AS table_name,
+ obj_description(c.oid) AS table_comment,
+ CURRENT_TIMESTAMP AS create_time,
+ CURRENT_TIMESTAMP AS update_time
+ FROM pg_class c
+ LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
+ WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
+ AND c.relname != 'spatial_%'::text
+ AND n.nspname = 'public'::name
+ AND n.nspname ]]> ''::name
+ ) list_table
+ where table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
+ AND table_name NOT IN (select table_name from gen_table)
+
+ AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
+
+
+ AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%'))
+
+ order by create_time desc
@@ -121,6 +143,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc
+ select table_name, table_comment, create_time, update_time
+ from (
+ SELECT c.relname AS table_name,
+ obj_description(c.oid) AS table_comment,
+ CURRENT_TIMESTAMP AS create_time,
+ CURRENT_TIMESTAMP AS update_time
+ FROM pg_class c
+ LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
+ WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
+ AND c.relname != 'spatial_%'::text
+ AND n.nspname = 'public'::name
+ AND n.nspname ]]> ''::name
+ ) list_table
+ where table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
+ AND table_name NOT IN (select table_name from gen_table)
+
+ AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
+
+
+ AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%'))
+
+ order by create_time desc
@@ -149,6 +193,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ select table_name, table_comment, create_time, update_time
+ from (
+ SELECT c.relname AS table_name,
+ obj_description(c.oid) AS table_comment,
+ CURRENT_TIMESTAMP AS create_time,
+ CURRENT_TIMESTAMP AS update_time
+ FROM pg_class c
+ LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
+ WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
+ AND c.relname != 'spatial_%'::text
+ AND n.nspname = 'public'::name
+ AND n.nspname ]]> ''::name
+ ) list_table
+ where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%'
+ and table_name in
+
+ #{name}
+
@@ -171,6 +233,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and lower(dt.table_name) = #{tableName}
+ select table_name, table_comment, create_time, update_time
+ from (
+ SELECT c.relname AS table_name,
+ obj_description(c.oid) AS table_comment,
+ CURRENT_TIMESTAMP AS create_time,
+ CURRENT_TIMESTAMP AS update_time
+ FROM pg_class c
+ LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
+ WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
+ AND c.relname != 'spatial_%'::text
+ AND n.nspname = 'public'::name
+ AND n.nspname ]]> ''::name
+ ) list_table
+ where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%'
+ and table_name = #{tableName}
diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue
index 25db1c4b..47d3c8fb 100644
--- a/ruoyi-ui/src/views/tool/gen/index.vue
+++ b/ruoyi-ui/src/views/tool/gen/index.vue
@@ -229,7 +229,7 @@ export default {
};
},
created() {
- localStorage.setItem("dataName", "master");
+ localStorage.setItem("dataName", "postgres");
this.getList();
},
activated() {
diff --git a/script/sql/postgres/postgres_ry_vue_4.X.sql b/script/sql/postgres/postgres_ry_vue_4.X.sql
index 7a1a60de..5c9c66b8 100644
--- a/script/sql/postgres/postgres_ry_vue_4.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_4.X.sql
@@ -825,7 +825,7 @@ drop table if exists gen_table_column;
create table if not exists gen_table_column
(
column_id int8,
- table_id varchar(64) default null::varchar,
+ table_id int8,
column_name varchar(200) default null::varchar,
column_comment varchar(500) default null::varchar,
column_type varchar(100) default null::varchar,