Skip to content

Commit 6d54367

Browse files
committed
| 2025.03.16 | 修复由于SQL类型大写导致无法转换的问题。(感谢@zzy-design的反馈)<br> JPA模板:修复不开启Lombok情况下Set/Get方法生成问题;修复importDdate判断为true后没有引入日期类的问题(感谢@PenroseYang的反馈)
1 parent dff15bc commit 6d54367

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,21 @@
6161
- 可在`applicaltion.yml`中的`OEM.mode`设置`js/css引入模式``local`(本地模式,默认)/`CDN`(云CDN模式,在线网站推荐,省流量)
6262
- OEM信息可以在`applicaltion.yml`中的`OEM`中更改
6363
- *支持公共js/css的Local/CDN模式切换,方便`本地`或者`工具站`进行部署,可以在`application.yml``OEM.Mode=`进行设置,之后请在`header-CDN-v2.html`/`header-local-v2.html`中检查对应js/css配置是否正确。默认为`CDN`模式。对于没有网络的环境请使用`local`模式。
64+
- 如何判断是否包含Date日期类并引入,搜索`<#assign importDdate = true />`即可找到对应的方法判断和引入
6465

6566
# Branch Detail 分支介绍
6667
- Master:主力分支,基于SpringBoot3+,需要JDK17+
6768
- JDK11:兼容分支,基于SpringBoot2+,支持JDK8/JDK11/JDK17等版本,请自行(切换jdk11分支)[https://github.com/moshowgame/SpringBootCodeGenerator/tree/jdk11]
6869
- NewUI:新UI界面改版尝鲜
6970

7071
# 更新预告
71-
1.计划引入DJANGO等其他语言的ORM模板,欢迎大家submit相关代码供参考
72+
1.计划优化一下前端界面,改善由于静态资源加载问题导致的访问缓慢问题,目前正在开发中
73+
2.根据大家Raised的Issue优化一下模板
7274

7375
# Update Logs
7476
| 更新日期 | 更新内容 |
7577
|:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
78+
| 2025.03.16 | 修复由于SQL类型大写导致无法转换的问题。(感谢@zzy-design的反馈)<br> JPA模板:修复不开启Lombok情况下Set/Get方法生成问题;修复importDdate判断为true后没有引入日期类的问题(感谢@PenroseYang的反馈) |
7679
| 2024.12.29 | 优化前端加载速度,优化输出代码着色,CDN改字节跳动静态资源公共库。<br> |
7780
| 2024.12.23 | 新增InsertSQL模式,采用JSQLParser引擎进行封装<br>优化代码封装<br>CDN恢复为staticfile.org加速(如果本地卡的话,建议切换local模式)。<br> |
7881
| 2024.04.23 | 切换为更快更稳定的BootCDN进行加速。<br>前端NEWUI改版(基于AdminLTE+Bootstrap+Vue+ElementUI混合模式)。 |

generator-web/src/main/java/com/softdev/system/generator/service/GeneratorServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ public ClassInfo processTableIntoClassInfo(ParamInfo paramInfo)
308308
fieldName = columnName;
309309
}
310310
columnLine = columnLine.substring(columnLine.indexOf("`") + 1).trim();
311-
String mysqlType = columnLine.split("\\s+")[1];
311+
//2025-03-16 修复由于类型大写导致无法转换的问题
312+
String mysqlType = columnLine.split("\\s+")[1].toLowerCase(Locale.ROOT);
312313
if(mysqlType.contains("(")){
313314
mysqlType = mysqlType.substring(0, mysqlType.indexOf("("));
314315
}

generator-web/src/main/resources/templates/code-generator/jpa-starp/starp-repository.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</#if>
99
</#list>
1010
</#if>
11+
<#if importDdate?exists && importDdate==true>import java.util.Date;</#if>
1112
import java.util.List;
1213
import org.springframework.data.jpa.repository.JpaRepository;
1314
import org.springframework.data.jpa.repository.Query;

generator-web/src/main/resources/templates/code-generator/jpa/entity.ftl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ public class ${classInfo.className} implements Serializable {
4040
</#list>
4141
public ${classInfo.className}() {
4242
}
43-
</#if>
4443

44+
45+
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
46+
<#list classInfo.fieldList as fieldItem >
4547
<#if isLombok?exists && isLombok==false>
4648
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
4749
return ${fieldItem.fieldName};
@@ -51,4 +53,6 @@ public class ${classInfo.className} implements Serializable {
5153
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
5254
}
5355
</#if>
56+
</#list>
5457
}
58+
</#if></#if>

generator-web/src/main/resources/templates/code-generator/jpa/repository.ftl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</#if>
99
</#list>
1010
</#if>
11+
<#if importDdate?exists && importDdate==true>import java.util.Date;</#if>
1112
import java.util.List;
1213
import org.springframework.data.jpa.repository.JpaRepository;
1314
import org.springframework.data.jpa.repository.Query;
@@ -21,6 +22,4 @@ import org.springframework.stereotype.Repository;
2122
@Repository
2223
public interface ${classInfo.className}Repository extends JpaRepository<${classInfo.className},Integer> {
2324

24-
25-
26-
}
25+
}

generator-web/src/main/resources/templates/code-generator/tk-mybatis/tk-mapper.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</#if>
99
</#list>
1010
</#if>
11+
<#if importDdate?exists && importDdate==true>import java.util.Date;</#if>
1112
import java.util.List;
1213
import io.mybatis.mapper.Mapper;
1314
</#if>

0 commit comments

Comments
 (0)