valueList = new ArrayList<>();
- //add values as comment
- Arrays.stream(valueStr.split(",")).forEach(column -> {
- valueList.add(column);
- });
- AtomicInteger n = new AtomicInteger(0);
- //add column to fleldList
- Arrays.stream(columnsSQL.replaceAll(" ", "").split(",")).forEach(column -> {
- FieldInfo fieldInfo2 = new FieldInfo();
- fieldInfo2.setFieldName(column);
- fieldInfo2.setColumnName(column);
- fieldInfo2.setFieldClass(String.class.getSimpleName());
- if (n.get() < valueList.size()) {
- fieldInfo2.setFieldComment(column + " , eg." + valueList.get(n.get()));
- }
- fieldList.add(fieldInfo2);
- n.getAndIncrement();
- });
-
- }
- if (fieldList.size() < 1) {
- throw new CodeGenerateException("INSERT SQL解析失败");
- }
- codeJavaInfo.setFieldList(fieldList);
- return codeJavaInfo;
- }
}
diff --git a/generator-web/src/main/resources/application-bejson.yml b/generator-web/src/main/resources/application-bejson.yml
index 04cfe67..5590268 100644
--- a/generator-web/src/main/resources/application-bejson.yml
+++ b/generator-web/src/main/resources/application-bejson.yml
@@ -1,5 +1,7 @@
server:
port: 1234
+ http2:
+ enabled: true
servlet:
context-path: /generator
#tomcat:
@@ -8,7 +10,7 @@ server:
# max-threads: 10
# background-processor-delay: 30
# basedir: ${user.home}/tomcat/
- undertow:
+undertow:
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
# 不要设置过大,如果过大,启动项目会报错:打开文件数过多
io-threads: 4
@@ -23,7 +25,7 @@ server:
spring:
banner:
charset: UTF-8
- http:
+ web:
encoding:
force: true
charset: UTF-8
@@ -47,12 +49,12 @@ spring:
#mvc:
# static-path-pattern: /statics/**
OEM:
- version: 2024.4
+ version: 2024.12
header: SQL转Java JPA、MYBATIS实现类代码生成平台
keywords: sql转实体类,sql转DAO,SQL转service,SQL转JPA实现,SQL转MYBATIS实现
title: JAVA在线代码生成
- slogan: For reducing the repetitive CRUD work
- description: SpringBootCodeGenerator(JAVA代码生成平台),
又名`大狼狗代码生成器`、`SQL转JAVA`、`SQL转JPA`、`SQL转Mybatis`、`Mybatis在线生成器`、`SQL转Java JPA、MYBATIS实现类代码生成平台`。
——以解放双手为目的,减少大量的重复CRUD工作,可通过建表SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper等相关模板代码。
+ slogan: Release your hands from tedious and repetitive CRUD tasks.
+ description: SpringBootCodeGenerator(JAVA代码生成平台),
又名`大狼狗代码生成器`、`SQL转JAVA`、`SQL转JPA`、`SQL转Mybatis`、`Mybatis在线生成器`、`SQL转Java JPA、MYBATIS实现类代码生成平台`。
——从繁琐重复的`CRUD工作`中释放你的双手,可通过DDL SQL语句或Select SQL语句或简单Json->生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper等相关模板代码。
author: BEJSON
packageName: www.bejson.com
copyright: Powered by Moshow郑锴 , Might the holy light be with you !
diff --git a/generator-web/src/main/resources/application-dev.yml b/generator-web/src/main/resources/application-dev.yml
index 2b06145..6b05721 100644
--- a/generator-web/src/main/resources/application-dev.yml
+++ b/generator-web/src/main/resources/application-dev.yml
@@ -47,12 +47,12 @@ spring:
#mvc:
# static-path-pattern: /statics/**
OEM:
- version: 2024.4
+ version: 2024.12
header: SQL转Java JPA、MYBATIS实现类代码生成平台
keywords: sql转实体类,sql转DAO,SQL转service,SQL转JPA实现,SQL转MYBATIS实现
title: JAVA代码生成平台
- slogan: For reducing the repetitive CRUD work
- description: SpringBootCodeGenerator(JAVA代码生成平台),
又名`大狼狗代码生成器`、`SQL转JAVA`、`SQL转JPA`、`SQL转Mybatis`、`Mybatis在线生成器`、`SQL转Java JPA、MYBATIS实现类代码生成平台`。
——以解放双手为目的,减少大量的重复CRUD工作,可通过建表SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper等相关模板代码。
+ slogan: Release your hands from tedious and repetitive CRUD tasks.
+ description: SpringBootCodeGenerator(JAVA代码生成平台),
又名`大狼狗代码生成器`、`SQL转JAVA`、`SQL转JPA`、`SQL转Mybatis`、`Mybatis在线生成器`、`SQL转Java JPA、MYBATIS实现类代码生成平台`。
——从繁琐重复的`CRUD工作`中释放你的双手,可通过DDL SQL语句或Select SQL语句或简单Json->生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper等相关模板代码。
author: Zhengkai.blog.csdn.net
packageName: com.software.system
copyright: Powered by Moshow郑锴 , Might the holy light be with you !
diff --git a/generator-web/src/main/resources/statics/js/main.js b/generator-web/src/main/resources/statics/js/main.js
index 3cd412d..8fd3d08 100644
--- a/generator-web/src/main/resources/statics/js/main.js
+++ b/generator-web/src/main/resources/statics/js/main.js
@@ -123,7 +123,7 @@ const vm = new Vue({
vm.formData.tableSql=$.inputArea.getValue();
axios.post(basePath+"/code/generate",vm.formData).then(function(res){
if(res.code===500){
- error("生成失败");
+ error("生成失败,请检查SQL语句!!!");
return;
}
setAllCookie();
diff --git a/generator-web/src/main/resources/statics/version.json b/generator-web/src/main/resources/statics/version.json
deleted file mode 100644
index deefb3d..0000000
--- a/generator-web/src/main/resources/statics/version.json
+++ /dev/null
@@ -1 +0,0 @@
-{"version": "20231022"}
\ No newline at end of file
diff --git a/generator-web/src/main/resources/templates/header-CDN-v2.html b/generator-web/src/main/resources/templates/header-CDN-v2.html
index cb1b80d..fe77ab7 100644
--- a/generator-web/src/main/resources/templates/header-CDN-v2.html
+++ b/generator-web/src/main/resources/templates/header-CDN-v2.html
@@ -3,43 +3,43 @@
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/generator-web/src/main/resources/templates/index.html b/generator-web/src/main/resources/templates/index.html
index efd12cb..8701ce7 100644
--- a/generator-web/src/main/resources/templates/index.html
+++ b/generator-web/src/main/resources/templates/index.html
@@ -6,8 +6,8 @@ by https://zhengkai.blog.csdn.net
- JAVA代码生成平台
<#include "/header.html">
+ ${(value.title)!!}
@@ -17,7 +17,7 @@ by https://zhengkai.blog.csdn.net
- JAVA代码生成平台
+ ${(value.title)!!}
diff --git a/generator-web/src/main/resources/templates/main-v2.html b/generator-web/src/main/resources/templates/main-v2.html
index 2423e8a..12cf120 100644
--- a/generator-web/src/main/resources/templates/main-v2.html
+++ b/generator-web/src/main/resources/templates/main-v2.html
@@ -80,6 +80,7 @@
+
diff --git a/generator-web/src/test/java/FooTest.java b/generator-web/src/test/java/FooTest.java
deleted file mode 100644
index bbdff21..0000000
--- a/generator-web/src/test/java/FooTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-import com.softdev.system.generator.util.StringUtils;
-
-public class FooTest {
-
- public static void main(String[] args) {
- // String updateTime = StringUtils.underlineToCamelCase("updateTime");
- // System.out.println(updateTime);
-
-
- // System.out.println(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "userName"));
- // System.out.println(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, "userNAme-UUU"));
-
- System.out.println(StringUtils.toUnderline("userName",false));
- System.out.println(StringUtils.toUnderline("UserName",false));
- System.out.println(StringUtils.toUnderline("user_NameGgg_x-UUU",false));
- System.out.println(StringUtils.toUnderline("username",false));
-
- System.out.println(StringUtils.toUnderline("userName",true));
- System.out.println(StringUtils.toUnderline("UserName",true));
- System.out.println(StringUtils.toUnderline("user_NameGgg_x-UUU",true));
- System.out.println(StringUtils.toUnderline("username",true));
-
- System.out.println(StringUtils.underlineToCamelCase("CREATE_TIME"));
- }
-
-
-}
diff --git a/generator-web/src/test/java/com/softdev/system/generator/util/StringUtilsPlusTest.java b/generator-web/src/test/java/com/softdev/system/generator/util/StringUtilsPlusTest.java
new file mode 100644
index 0000000..1df912a
--- /dev/null
+++ b/generator-web/src/test/java/com/softdev/system/generator/util/StringUtilsPlusTest.java
@@ -0,0 +1,104 @@
+package com.softdev.system.generator.util;
+
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+public class StringUtilsPlusTest {
+
+ @Test
+ public void toLowerCamel() {
+ System.out.println(StringUtilsPlus.toLowerCamel("hello_world"));
+ System.out.println(StringUtilsPlus.toLowerCamel("HELLO_WO-RLD-IK"));
+ System.out.println(StringUtilsPlus.toLowerCamel("HELLO_WORLD-IKabc"));
+ System.out.println(StringUtilsPlus.toLowerCamel("HELLO-WORLD-IKabc"));
+ System.out.println(StringUtilsPlus.toLowerCamel("HELLO-123WORLD-IKabc"));
+ System.out.println(StringUtilsPlus.toLowerCamel("helloWorldOKla"));
+ assertEquals("helloWorldChina", StringUtilsPlus.toLowerCamel("hello_-_world-cHina"));
+ }
+
+ @Test
+ public void upperCaseFirstShouldReturnStringWithFirstLetterCapitalized() {
+ assertEquals("Hello", StringUtilsPlus.upperCaseFirst("hello"));
+ }
+
+ @Test
+ public void upperCaseFirstShouldReturnEmptyStringWhenInputIsEmpty() {
+ assertEquals("", StringUtilsPlus.upperCaseFirst(""));
+ }
+
+ @Test
+ public void lowerCaseFirstShouldReturnStringWithFirstLetterLowercased() {
+ assertEquals("hello", StringUtilsPlus.lowerCaseFirst("Hello"));
+ }
+
+ @Test
+ public void lowerCaseFirstShouldReturnEmptyStringWhenInputIsEmpty() {
+ assertEquals("", StringUtilsPlus.lowerCaseFirst(""));
+ }
+
+ @Test
+ public void underlineToCamelCaseShouldReturnCamelCaseString() {
+ assertEquals("helloWorld", StringUtilsPlus.underlineToCamelCase("hello_world"));
+ }
+
+ @Test
+ public void underlineToCamelCaseShouldReturnEmptyStringWhenInputIsEmpty() {
+ assertEquals("", StringUtilsPlus.underlineToCamelCase(""));
+ }
+
+ @Test
+ public void toUnderlineShouldReturnUnderlinedString() {
+ assertEquals("hello_world", StringUtilsPlus.toUnderline("helloWorld", false));
+ }
+
+ @Test
+ public void toUnderlineShouldReturnEmptyStringWhenInputIsEmpty() {
+ assertEquals("", StringUtilsPlus.toUnderline("", false));
+ }
+
+ @Test
+ public void toCamelShouldReturnCamelCaseString() {
+ assertEquals("helloWorld", StringUtilsPlus.toLowerCamel("hello_world"));
+ }
+
+ @Test
+ public void toCamelShouldReturnEmptyStringWhenInputIsEmpty() {
+ assertEquals("", StringUtilsPlus.toLowerCamel(""));
+ }
+
+ @Test
+ public void isNotNullShouldReturnTrueWhenStringIsNotEmpty() {
+ assertTrue(StringUtilsPlus.isNotNull("hello"));
+ }
+
+ @Test
+ public void isNotNullShouldReturnFalseWhenStringIsEmpty() {
+ assertFalse(StringUtilsPlus.isNotNull(""));
+ }
+
+
+ public static void main(String[] args) {
+ // String updateTime = StringUtils.underlineToCamelCase("updateTime");
+ // System.out.println(updateTime);
+
+
+ // System.out.println(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "userName"));
+ // System.out.println(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, "userNAme-UUU"));
+
+ System.out.println(StringUtilsPlus.toUnderline("userName",false));
+ System.out.println(StringUtilsPlus.toUnderline("UserName",false));
+ System.out.println(StringUtilsPlus.toUnderline("user_NameGgg_x-UUU",false));
+ System.out.println(StringUtilsPlus.toUnderline("username",false));
+
+ System.out.println(StringUtilsPlus.toUnderline("userName",true));
+ System.out.println(StringUtilsPlus.toUnderline("UserName",true));
+ System.out.println(StringUtilsPlus.toUnderline("user_NameGgg_x-UUU",true));
+ System.out.println(StringUtilsPlus.toUnderline("username",true));
+
+ System.out.println(StringUtilsPlus.underlineToCamelCase("CREATE_TIME"));
+ }
+
+}
diff --git a/generator-web/src/test/java/com/softdev/system/generator/util/StringUtilsTest.java b/generator-web/src/test/java/com/softdev/system/generator/util/StringUtilsTest.java
deleted file mode 100644
index b7fbdca..0000000
--- a/generator-web/src/test/java/com/softdev/system/generator/util/StringUtilsTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.softdev.system.generator.util;
-
-import org.junit.Test;
-
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertFalse;
-
-public class StringUtilsTest {
-
- @Test
- public void toLowerCamel() {
- System.out.println(StringUtils.toLowerCamel("hello_world"));
- System.out.println(StringUtils.toLowerCamel("HELLO_WO-RLD-IK"));
- System.out.println(StringUtils.toLowerCamel("HELLO_WORLD-IKabc"));
- System.out.println(StringUtils.toLowerCamel("HELLO-WORLD-IKabc"));
- System.out.println(StringUtils.toLowerCamel("HELLO-123WORLD-IKabc"));
- System.out.println(StringUtils.toLowerCamel("helloWorldOKla"));
- assertEquals("helloWorldChina", StringUtils.toLowerCamel("hello_-_world-cHina"));
- }
-
- @Test
- public void upperCaseFirstShouldReturnStringWithFirstLetterCapitalized() {
- assertEquals("Hello", StringUtils.upperCaseFirst("hello"));
- }
-
- @Test
- public void upperCaseFirstShouldReturnEmptyStringWhenInputIsEmpty() {
- assertEquals("", StringUtils.upperCaseFirst(""));
- }
-
- @Test
- public void lowerCaseFirstShouldReturnStringWithFirstLetterLowercased() {
- assertEquals("hello", StringUtils.lowerCaseFirst("Hello"));
- }
-
- @Test
- public void lowerCaseFirstShouldReturnEmptyStringWhenInputIsEmpty() {
- assertEquals("", StringUtils.lowerCaseFirst(""));
- }
-
- @Test
- public void underlineToCamelCaseShouldReturnCamelCaseString() {
- assertEquals("helloWorld", StringUtils.underlineToCamelCase("hello_world"));
- }
-
- @Test
- public void underlineToCamelCaseShouldReturnEmptyStringWhenInputIsEmpty() {
- assertEquals("", StringUtils.underlineToCamelCase(""));
- }
-
- @Test
- public void toUnderlineShouldReturnUnderlinedString() {
- assertEquals("hello_world", StringUtils.toUnderline("helloWorld", false));
- }
-
- @Test
- public void toUnderlineShouldReturnEmptyStringWhenInputIsEmpty() {
- assertEquals("", StringUtils.toUnderline("", false));
- }
-
- @Test
- public void toCamelShouldReturnCamelCaseString() {
- assertEquals("helloWorld", StringUtils.toLowerCamel("hello_world"));
- }
-
- @Test
- public void toCamelShouldReturnEmptyStringWhenInputIsEmpty() {
- assertEquals("", StringUtils.toLowerCamel(""));
- }
-
- @Test
- public void isNotNullShouldReturnTrueWhenStringIsNotEmpty() {
- assertTrue(StringUtils.isNotNull("hello"));
- }
-
- @Test
- public void isNotNullShouldReturnFalseWhenStringIsEmpty() {
- assertFalse(StringUtils.isNotNull(""));
- }
-}
diff --git a/pom.xml b/pom.xml
index 16071f8..5405e26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.2.5
+ 3.4.1
@@ -28,6 +28,13 @@
+
+
+ com.github.jsqlparser
+ jsqlparser
+ 5.0
+
+
org.springframework.boot
spring-boot-starter-web
@@ -56,18 +63,18 @@
com.alibaba.fastjson2
fastjson2
- 2.0.49
+ 2.0.53
com.alibaba.fastjson2
fastjson2-extension
- 2.0.49
+ 2.0.53
com.alibaba.fastjson2
fastjson2-extension-spring6
- 2.0.49
+ 2.0.53
@@ -103,7 +110,7 @@
org.projectlombok
lombok
- 1.18.32
+ 1.18.36
@@ -130,13 +137,13 @@
org.apache.commons
commons-lang3
- 3.14.0
+ 3.17.0
commons-io
commons-io
- 2.16.1
+ 2.18.0