Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from moshowgame:master #14

Merged
merged 8 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![image](https://img.shields.io/badge/SpringBoot2-%E2%98%85%E2%98%85%E2%98%85%E2%98%85%E2%98%85-blue.svg)
![image](https://img.shields.io/badge/Freemarker-%E2%98%85%E2%98%85%E2%98%85%E2%98%85%E2%98%85-blue.svg)
![image](https://img.shields.io/badge/CodeGenerator-%E2%98%85%E2%98%85%E2%98%85%E2%98%85%E2%98%85-blue.svg)
[![Build Status](https://travis-ci.org/moshowgame/SpringBootCodeGenerator.svg?branch=master)](https://travis-ci.org/moshowgame/SpringBootCodeGenerator)
[![Java CI with Maven](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml/badge.svg)](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml)

# Author
>powered by `Moshow郑锴(大狼狗)` , [https://zhengkai.blog.csdn.net](https://zhengkai.blog.csdn.net)
Expand Down Expand Up @@ -35,13 +35,13 @@

- 感谢`卡卡`将他部署在[BEJSON](https://java.bejson.com/generator)上,目前是besjon专供的`金牌工具`(线上版本不一定是最新的,会有延迟,请谅解,谢谢).<br>
- 感谢`jully.top`部署的副本 [https://jully.top/generator/](https://jully.top/generator/)。<br>
- 感谢`三叔`将他部署在[DEVTOOLS](https://java.devtools.cn/) (Demised)上,继续作为Golden Tool开放给大家使用。<br>
- 感谢`七牛`提供的云js/css免费加速服务,它尽可能全面收录优秀的开源库,并免费为之提供 CDN 加速服务,使之有更好的访问速度和稳定的环境。
- 感谢`BootCDN`提供稳定、快速、免费的前端开源项目 CDN 加速服务
- Thanks for `JetBrains` providing us the `Licenses for Open Source Development` ,[Get free access to all JetBrains tools for developing your open source project!](https://www.jetbrains.com/community/opensource/#support) .<br>

| 访问地址 | http://localhost:1234/generator |
|:-----------------------|:--------------------------------------------------------------|
| BEJSON 在线地址 | https://java.bejson.com/generator/ |
| BEJSON 金牌工具 在线地址 | https://java.bejson.com/generator/ |
| JSON.CN 金牌工具 在线地址 | https://java.json.cn/generator/ |
| Jully 在线地址 | https://jully.top/generator/ |
| DEVTOOLS 在线地址(Demised) | https://java.devtools.cn |
| CSDN BLOG | https://zhengkai.blog.csdn.net |
Expand All @@ -59,7 +59,7 @@
- 可设置`表名前缀`,例如sys_user前缀为sys_之后可以正确生成user类
- 可在`applicaltion.yml`中的`OEM.mode`设置`js/css引入模式`为`local`(本地模式,默认)/`CDN`(云CDN模式,在线网站推荐,省流量)
- OEM信息可以在`applicaltion.yml`中的`OEM`中更改
- *支持公共js/css的Local/CDN模式切换,方便`本地`或者`工具站`进行部署,可以在`application.yml`的`OEM.Mode=`进行设置,之后请在`header-CDN.html`/`header-local.html`中检查对应js/css配置是否正确。
- *支持公共js/css的Local/CDN模式切换,方便`本地`或者`工具站`进行部署,可以在`application.yml`的`OEM.Mode=`进行设置,之后请在`header-CDN-v2.html`/`header-local-v2.html`中检查对应js/css配置是否正确。默认为`CDN`模式。对于没有网络的环境请使用`local`模式

# Branch Detail 分支介绍
- Master:主力分支,基于SpringBoot3+,需要JDK17+
Expand All @@ -68,15 +68,15 @@

# 更新预告
1.计划引入DJANGO等其他语言的ORM模板,欢迎大家submit相关代码供参考
2.计划升级一下UI界面

# Update Logs
| 更新日期 | 更新内容 |
|:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 2024.04.21 | 推出JDK11分支,支持JDK8/JDK11/JDK17等版本,兼容性较好但维护速度较慢,为了更好兼容旧机器和旧环境
| 2024.04.20 | 修复CDN版本cdn.staticfile.org域名备份失败问题,已同步更新到cdn.staticfile.net(本地版本则不受影响)
| 2024.01.26 | 修复大写下滑线列名转驼峰问题(感谢@Nisus-Liu
的PR) |
| 2024.04.23 | 切换为更快更稳定的BootCDN进行加速。<br>前端NEWUI改版(基于AdminLTE+Bootstrap+Vue+ElementUI混合模式)。|
| 2024.04.22 | [Java CI with Maven](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml) 更新<br>SpringBoot升级到3.2.5<br>FastJSON升级到FastJSON2.0.49|
| 2024.04.21 | 推出JDK11分支,支持JDK8/JDK11/JDK17等版本,兼容性较好但维护速度较慢,为了更好兼容旧机器和旧环境|
| 2024.04.20 | 修复CDN版本cdn.staticfile.org域名备份失败问题,已同步更新到cdn.staticfile.net(本地版本则不受影响)|
| 2024.01.26 | 修复大写下滑线列名转驼峰问题(感谢@Nisus-Liu的PR)|
| 2023.10.22 | 工具站CDN更新。 |
| 2023.08.31 | (感谢@Nisus-Liu的PR)<br>fix 驼峰列名转命名风格错误问题<br>增强转下划线命名风格, 对原始风格不敏感. 支持各种命名风格的列名 to 下划线<br>增加 NonCaseString 大小写不敏感字符串包装类, 简化编码<br>几点代码小优化。 |
| 2023.07.11 | 安全更新,正式支持SpringBoot3,javax升级到jakarta。 |
Expand Down Expand Up @@ -174,9 +174,25 @@
2. COPY并编写freemarker模板文件`.ftl`
3. 修改`template.json`文件,新增模板信息,页面可动态加载

# Upgrade Issue Resolution 升级问题解决方案
- 如果你最近也在升级FastJson到FastJson2版本,而跟我一样也遇到了FastJsonHttpMessageConverter找不到类问题以及FastJsonConfig找不到问题,那么恭喜你,看完本文,安装完fastjson2、fastjson2-extension、fastjson2-extension-spring6这三个类库,你就可以成功使用新版FastJson2了。
[FastJson2中FastJsonHttpMessageConverter找不到类问题](https://blog.csdn.net/moshowgame/article/details/138013669)

- 当项目从2.7.x的springboot升级到3.0.x的时候,遇到一个问题“java: 程序包javax.servlet.http不存在” 问题:
[java: 程序包javax.servlet.http不存在](https://zhengkai.blog.csdn.net/article/details/131362304)

2024 NEWUI版本
<img src="./newui_version.png">
2021 半Vue半JS版本
<img src="./codegenerator1.png">
2019 初代版本
<img src="./old_version.png">
配置模板
<img src="./codegenerator2.png">
网站流量分析-2024
<img src="./site_analysis-2024.png">
网站流量分析-2022
<img src="./site_analysis.png">
代码与你,越变越美
<img src="./donate.png">

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.softdev.system.generator.config;

import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;

// import com.alibaba.fastjson.support.config.FastJsonConfig;
// import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import jakarta.servlet.DispatcherType;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
Expand All @@ -12,8 +13,14 @@
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.support.config.FastJsonConfig;
import com.alibaba.fastjson2.support.spring6.http.converter.FastJsonHttpMessageConverter;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* 2019-2-11 liutf WebMvcConfig 整合 cors 和 SpringMvc MessageConverter
Expand All @@ -36,25 +43,43 @@ public FilterRegistrationBean xssFilterRegistration() {
return registration;
}

// @Override
// public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// converters.clear();
// //FastJsonHttpMessageConverter
// FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();

// List<MediaType> fastMediaTypes = new ArrayList<>();
// fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
// fastConverter.setSupportedMediaTypes(fastMediaTypes);

// FastJsonConfig fastJsonConfig = new FastJsonConfig();
// fastJsonConfig.setCharset(StandardCharsets.UTF_8);
// fastConverter.setFastJsonConfig(fastJsonConfig);

// //StringHttpMessageConverter
// StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
// stringConverter.setDefaultCharset(StandardCharsets.UTF_8);
// stringConverter.setSupportedMediaTypes(fastMediaTypes);
// converters.add(stringConverter);
// converters.add(fastConverter);
// }
/**
* FASTJSON2升级 by https://zhengkai.blog.csdn.net/
* https://blog.csdn.net/moshowgame/article/details/138013669
*/
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
//FastJsonHttpMessageConverter
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();

List<MediaType> fastMediaTypes = new ArrayList<>();
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
fastConverter.setSupportedMediaTypes(fastMediaTypes);

FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setCharset(StandardCharsets.UTF_8);
fastConverter.setFastJsonConfig(fastJsonConfig);

//StringHttpMessageConverter
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
stringConverter.setDefaultCharset(StandardCharsets.UTF_8);
stringConverter.setSupportedMediaTypes(fastMediaTypes);
converters.add(stringConverter);
converters.add(fastConverter);
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
//自定义配置...
FastJsonConfig config = new FastJsonConfig();
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
config.setReaderFeatures(JSONReader.Feature.FieldBased, JSONReader.Feature.SupportArrayToBean);
config.setWriterFeatures(JSONWriter.Feature.WriteMapNullValue, JSONWriter.Feature.PrettyFormat);
converter.setFastJsonConfig(config);
converter.setDefaultCharset(StandardCharsets.UTF_8);
converter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));
converters.add(0, converter);
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.softdev.system.generator.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.softdev.system.generator.entity.TemplateConfig;
import com.softdev.system.generator.util.FreemarkerUtil;
import com.softdev.system.generator.util.MapUtil;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.softdev.system.generator.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.softdev.system.generator.entity.ClassInfo;
import com.softdev.system.generator.entity.FieldInfo;
import com.softdev.system.generator.entity.NonCaseString;
Expand Down
4 changes: 2 additions & 2 deletions generator-web/src/main/resources/application-bejson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ OEM:
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实现类代码生成平台`。
description: <p>SpringBootCodeGenerator(JAVA代码生成平台),<br>又名`大狼狗代码生成器`、`SQL转JAVA`、`SQL转JPA`、`SQL转Mybatis`、`Mybatis在线生成器`、`SQL转Java JPA、MYBATIS实现类代码生成平台`。</p><p>——以解放双手为目的,减少大量的重复CRUD工作,可通过建表SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper等相关模板代码。</p>
author: BEJSON
packageName: www.bejson.com
copyright: powered by Moshow郑锴(大狼狗)
copyright: Powered by Moshow郑锴 , Might the holy light be with you !
returnUtilSuccess: ReturnT.success
returnUtilFailure: ReturnT.error
outputStr: www.bejson.com
Expand Down
8 changes: 4 additions & 4 deletions generator-web/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ OEM:
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实现类代码生成平台`。
author: zhengkai.blog.csdn.net
description: <p>SpringBootCodeGenerator(JAVA代码生成平台),<br>又名`大狼狗代码生成器`、`SQL转JAVA`、`SQL转JPA`、`SQL转Mybatis`、`Mybatis在线生成器`、`SQL转Java JPA、MYBATIS实现类代码生成平台`。</p><p>——以解放双手为目的,减少大量的重复CRUD工作,可通过建表SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper等相关模板代码。</p>
author: Zhengkai.blog.csdn.net
packageName: com.software.system
copyright: powered by Moshow郑锴(大狼狗)
copyright: Powered by Moshow郑锴 , Might the holy light be with you !
returnUtilSuccess: ReturnT.success
returnUtilFailure: ReturnT.error
outputStr: zhengkai.blog.csdn.net
outputStr: Zhengkai.blog.csdn.net
mode: local
Loading
Loading