From f68b4026db491ae0b209faf59269f17e9dd88b7f Mon Sep 17 00:00:00 2001 From: GoCoGit Date: Thu, 1 Jun 2023 21:37:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?postgresql=E6=B7=BB=E5=8A=A0maxlength?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gen/log/spring.log | 45 +++++++++++++++++++ .../postgresql/PostgreSqlColumnSelector.java | 3 ++ 2 files changed, 48 insertions(+) create mode 100644 gen/log/spring.log diff --git a/gen/log/spring.log b/gen/log/spring.log new file mode 100644 index 0000000..342677a --- /dev/null +++ b/gen/log/spring.log @@ -0,0 +1,45 @@ +2023-06-01 21:13:36.296 INFO 10728 --- [main] com.gitee.gen.GenApplication : Starting GenApplication on gc with PID 10728 (D:\ProjectsNew2\code-gen\gen\target\classes started by admin in D:\ProjectsNew2\code-gen\gen) +2023-06-01 21:13:36.299 INFO 10728 --- [main] com.gitee.gen.GenApplication : No active profile set, falling back to default profiles: default +2023-06-01 21:13:38.364 INFO 10728 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 6969 (http) +2023-06-01 21:13:38.373 INFO 10728 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2023-06-01 21:13:38.374 INFO 10728 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37] +2023-06-01 21:13:38.481 INFO 10728 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2023-06-01 21:13:38.481 INFO 10728 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2040 ms +2023-06-01 21:13:38.968 INFO 10728 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2023-06-01 21:13:40.061 INFO 10728 --- [main] com.gitee.gen.config.GeneratorConfig : 前端资源目录:D:\ProjectsNew2\code-gen\gen\target/view +2023-06-01 21:13:40.201 WARN 10728 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 6969 is already in use +2023-06-01 21:13:40.202 INFO 10728 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2023-06-01 21:13:40.206 INFO 10728 --- [main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] +2023-06-01 21:13:40.339 INFO 10728 --- [main] ConditionEvaluationReportLoggingListener : + +Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. +2023-06-01 21:13:40.341 ERROR 10728 --- [main] o.s.b.d.LoggingFailureAnalysisReporter : + +*************************** +APPLICATION FAILED TO START +*************************** + +Description: + +Web server failed to start. Port 6969 was already in use. + +Action: + +Identify and stop the process that's listening on port 6969 or configure this application to listen on another port. + +2023-06-01 21:14:11.744 INFO 14240 --- [main] com.gitee.gen.GenApplication : Starting GenApplication on gc with PID 14240 (D:\ProjectsNew2\code-gen\gen\target\classes started by admin in D:\ProjectsNew2\code-gen\gen) +2023-06-01 21:14:11.747 INFO 14240 --- [main] com.gitee.gen.GenApplication : No active profile set, falling back to default profiles: default +2023-06-01 21:14:12.711 INFO 14240 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 6969 (http) +2023-06-01 21:14:12.721 INFO 14240 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2023-06-01 21:14:12.721 INFO 14240 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37] +2023-06-01 21:14:12.808 INFO 14240 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2023-06-01 21:14:12.808 INFO 14240 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1015 ms +2023-06-01 21:14:13.243 INFO 14240 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2023-06-01 21:14:13.330 INFO 14240 --- [main] com.gitee.gen.config.GeneratorConfig : 前端资源目录:D:\ProjectsNew2\code-gen\gen\target/view +2023-06-01 21:14:13.458 INFO 14240 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 6969 (http) with context path '' +2023-06-01 21:14:13.470 INFO 14240 --- [main] com.gitee.gen.GenApplication : Started GenApplication in 2.032 seconds (JVM running for 2.665) +2023-06-01 21:14:13.485 INFO 14240 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2023-06-01 21:14:13.657 INFO 14240 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2023-06-01 21:14:17.172 INFO 14240 --- [http-nio-6969-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' +2023-06-01 21:14:17.172 INFO 14240 --- [http-nio-6969-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2023-06-01 21:14:17.176 INFO 14240 --- [http-nio-6969-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 4 ms diff --git a/gen/src/main/java/com/gitee/gen/gen/postgresql/PostgreSqlColumnSelector.java b/gen/src/main/java/com/gitee/gen/gen/postgresql/PostgreSqlColumnSelector.java index ff7c7dd..974b890 100644 --- a/gen/src/main/java/com/gitee/gen/gen/postgresql/PostgreSqlColumnSelector.java +++ b/gen/src/main/java/com/gitee/gen/gen/postgresql/PostgreSqlColumnSelector.java @@ -90,6 +90,9 @@ public class PostgreSqlColumnSelector extends ColumnSelector { columnDefinition.setType(SQL_TYPE_FORMATTER.format(type)); + String maxLength = FieldUtil.convertString(rowMap.get("MAXLENGTH")); + columnDefinition.setMaxLength(new Integer(StringUtils.isEmpty(maxLength) ? "0" : maxLength)); + columnDefinition.setComment(convertString(rowMap.get("CMT"))); String isNullable = FieldUtil.convertString(rowMap.get("NULLABLE")); -- Gitee From 55a68256f8141231e93a9ece0fb8db5f46f828df Mon Sep 17 00:00:00 2001 From: GoCoGit Date: Sat, 3 Jun 2023 09:39:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feature:=E5=AD=97=E6=AE=B5=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E4=BF=A1=E6=81=AF=E5=A2=9E=E5=8A=A0=E6=94=AF=E6=8C=81?= =?UTF-8?q?pgsql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gen/log/spring.log | 45 ------------------- .../postgresql/PostgreSqlColumnSelector.java | 6 ++- 2 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 gen/log/spring.log diff --git a/gen/log/spring.log b/gen/log/spring.log deleted file mode 100644 index 342677a..0000000 --- a/gen/log/spring.log +++ /dev/null @@ -1,45 +0,0 @@ -2023-06-01 21:13:36.296 INFO 10728 --- [main] com.gitee.gen.GenApplication : Starting GenApplication on gc with PID 10728 (D:\ProjectsNew2\code-gen\gen\target\classes started by admin in D:\ProjectsNew2\code-gen\gen) -2023-06-01 21:13:36.299 INFO 10728 --- [main] com.gitee.gen.GenApplication : No active profile set, falling back to default profiles: default -2023-06-01 21:13:38.364 INFO 10728 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 6969 (http) -2023-06-01 21:13:38.373 INFO 10728 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] -2023-06-01 21:13:38.374 INFO 10728 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37] -2023-06-01 21:13:38.481 INFO 10728 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext -2023-06-01 21:13:38.481 INFO 10728 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2040 ms -2023-06-01 21:13:38.968 INFO 10728 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' -2023-06-01 21:13:40.061 INFO 10728 --- [main] com.gitee.gen.config.GeneratorConfig : 前端资源目录:D:\ProjectsNew2\code-gen\gen\target/view -2023-06-01 21:13:40.201 WARN 10728 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 6969 is already in use -2023-06-01 21:13:40.202 INFO 10728 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' -2023-06-01 21:13:40.206 INFO 10728 --- [main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] -2023-06-01 21:13:40.339 INFO 10728 --- [main] ConditionEvaluationReportLoggingListener : - -Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. -2023-06-01 21:13:40.341 ERROR 10728 --- [main] o.s.b.d.LoggingFailureAnalysisReporter : - -*************************** -APPLICATION FAILED TO START -*************************** - -Description: - -Web server failed to start. Port 6969 was already in use. - -Action: - -Identify and stop the process that's listening on port 6969 or configure this application to listen on another port. - -2023-06-01 21:14:11.744 INFO 14240 --- [main] com.gitee.gen.GenApplication : Starting GenApplication on gc with PID 14240 (D:\ProjectsNew2\code-gen\gen\target\classes started by admin in D:\ProjectsNew2\code-gen\gen) -2023-06-01 21:14:11.747 INFO 14240 --- [main] com.gitee.gen.GenApplication : No active profile set, falling back to default profiles: default -2023-06-01 21:14:12.711 INFO 14240 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 6969 (http) -2023-06-01 21:14:12.721 INFO 14240 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] -2023-06-01 21:14:12.721 INFO 14240 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37] -2023-06-01 21:14:12.808 INFO 14240 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext -2023-06-01 21:14:12.808 INFO 14240 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1015 ms -2023-06-01 21:14:13.243 INFO 14240 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' -2023-06-01 21:14:13.330 INFO 14240 --- [main] com.gitee.gen.config.GeneratorConfig : 前端资源目录:D:\ProjectsNew2\code-gen\gen\target/view -2023-06-01 21:14:13.458 INFO 14240 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 6969 (http) with context path '' -2023-06-01 21:14:13.470 INFO 14240 --- [main] com.gitee.gen.GenApplication : Started GenApplication in 2.032 seconds (JVM running for 2.665) -2023-06-01 21:14:13.485 INFO 14240 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... -2023-06-01 21:14:13.657 INFO 14240 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. -2023-06-01 21:14:17.172 INFO 14240 --- [http-nio-6969-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' -2023-06-01 21:14:17.172 INFO 14240 --- [http-nio-6969-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' -2023-06-01 21:14:17.176 INFO 14240 --- [http-nio-6969-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 4 ms diff --git a/gen/src/main/java/com/gitee/gen/gen/postgresql/PostgreSqlColumnSelector.java b/gen/src/main/java/com/gitee/gen/gen/postgresql/PostgreSqlColumnSelector.java index 974b890..f150ddb 100644 --- a/gen/src/main/java/com/gitee/gen/gen/postgresql/PostgreSqlColumnSelector.java +++ b/gen/src/main/java/com/gitee/gen/gen/postgresql/PostgreSqlColumnSelector.java @@ -25,6 +25,7 @@ public class PostgreSqlColumnSelector extends ColumnSelector { private static final String SHOW_COLUMN_SQL = "SELECT " + " pg_attribute.attname AS colname, " + " atttypid::regtype AS type, " + + " pg_attribute.atttypmod - 4 AS type_length, " + " numeric_scale as SCALE, " + " C.is_nullable as NULLABLE, " + " col_description ( pg_attribute.attrelid, pg_attribute.attnum ) AS cmt, " + @@ -90,8 +91,9 @@ public class PostgreSqlColumnSelector extends ColumnSelector { columnDefinition.setType(SQL_TYPE_FORMATTER.format(type)); - String maxLength = FieldUtil.convertString(rowMap.get("MAXLENGTH")); - columnDefinition.setMaxLength(new Integer(StringUtils.isEmpty(maxLength) ? "0" : maxLength)); + String maxLength = FieldUtil.convertString(rowMap.get("TYPE_LENGTH")); + int length = Integer.parseInt((StringUtils.isEmpty(maxLength) ? "0" : maxLength)); + columnDefinition.setMaxLength(Math.max(length, 0)); columnDefinition.setComment(convertString(rowMap.get("CMT"))); -- Gitee