Skip to content

Commit 1095661

Browse files
committed
| 2024.12.29 | 优化前端加载速度,优化输出代码着色,CDN改字节跳动静态资源公共库。
1 parent c69d6ad commit 1095661

File tree

14 files changed

+51
-296
lines changed

14 files changed

+51
-296
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SpringBootCodeGenerator
22
----
33
又名`Java代码生成器``JAVA在线代码生成平台``sql转java``大狼狗代码生成器``mybatis在线生成器``SQL转Java JPA、MYBATIS实现类代码生成平台`<br>
4-
![image](https://img.shields.io/badge/SpringBoot2-%E2%98%85%E2%98%85%E2%98%85%E2%98%85%E2%98%85-blue.svg)
4+
![image](https://img.shields.io/badge/SpringBoot3-%E2%98%85%E2%98%85%E2%98%85%E2%98%85%E2%98%85-blue.svg)
55
![image](https://img.shields.io/badge/Freemarker-%E2%98%85%E2%98%85%E2%98%85%E2%98%85%E2%98%85-blue.svg)
66
![image](https://img.shields.io/badge/CodeGenerator-%E2%98%85%E2%98%85%E2%98%85%E2%98%85%E2%98%85-blue.svg)
77
[![Java CI with Maven](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml/badge.svg)](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml)
@@ -73,6 +73,7 @@
7373
# Update Logs
7474
| 更新日期 | 更新内容 |
7575
|:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
76+
| 2024.12.29 | 优化前端加载速度,优化输出代码着色,CDN改字节跳动静态资源公共库。<br> |
7677
| 2024.12.23 | 新增InsertSQL模式,采用JSQLParser引擎进行封装<br>优化代码封装<br>CDN恢复为staticfile.org加速(如果本地卡的话,建议切换local模式)。<br> |
7778
| 2024.04.23 | 切换为更快更稳定的BootCDN进行加速。<br>前端NEWUI改版(基于AdminLTE+Bootstrap+Vue+ElementUI混合模式)。 |
7879
| 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 |

generator-web/src/main/java/com/softdev/system/generator/controller/GeneratorController.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.softdev.system.generator.controller;
22

3+
import com.alibaba.fastjson2.JSONArray;
34
import com.softdev.system.generator.entity.ClassInfo;
45
import com.softdev.system.generator.entity.ParamInfo;
56
import com.softdev.system.generator.entity.ReturnT;
@@ -49,7 +50,7 @@ public ModelAndView mainPage() {
4950
@ResponseBody
5051
public ReturnT getAllTemplates() throws Exception {
5152
String templates = generatorService.getTemplateConfig();
52-
return ReturnT.ok().put("templates",templates);
53+
return ReturnT.ok().put("templates", JSONArray.parseArray(templates));
5354
}
5455
@PostMapping("/code/generate")
5556
@ResponseBody
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
spring:
22
profiles:
3-
active: bejson
3+
active: dev

generator-web/src/main/resources/statics/js/main.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ $(function(){
1717

1818
// init output code area
1919
$.outputArea = CodeMirror.fromTextArea(document.getElementById("outputArea"), {
20+
mode: "text/x-java", // JAV
2021
theme: "idea", // IDEA主题
2122
lineNumbers: true, //显示行号
2223
smartIndent: true, // 自动缩进
@@ -128,15 +129,21 @@ const vm = new Vue({
128129
}
129130
setAllCookie();
130131
//console.log(res.outputJson);
131-
vm.outputJson=res.outputJson;
132+
//兼容后端返回数据格式
133+
if(res.data){
134+
vm.outputJson = res.data.outputJson;
135+
}else {
136+
vm.outputJson = res.outputJson;
137+
}
138+
132139
// console.log(vm.outputJson["bootstrap-ui"]);
133140
vm.outputStr=vm.outputJson[vm.currentSelect].trim();
134141
//console.log(vm.outputJson["bootstrap-ui"]);
135142
//console.log(vm.outputStr);
136143
$.outputArea.setValue(vm.outputStr);
137144
$.outputArea.setSize('auto', 'auto');
138145
//add to historicalData
139-
vm.setHistoricalData(res.outputJson.tableName);
146+
vm.setHistoricalData(vm.outputJson.tableName);
140147
alert("生成成功");
141148
});
142149
},
@@ -150,8 +157,14 @@ const vm = new Vue({
150157
id:1234
151158
}).then(function(res){
152159
//console.log(res.templates);
153-
vm.templates = JSON.parse(res.templates);
154-
// console.log(vm.templates);
160+
// vm.templates = JSON.parse(res.templates);
161+
// console.log(res);
162+
//兼容后端返回数据格式
163+
if(res.data){
164+
vm.templates = res.data.templates;
165+
}else {
166+
vm.templates = res.templates;
167+
}
155168
});
156169
},
157170
updated: function () {

generator-web/src/main/resources/statics/libs/jquery.min.js

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator-web/src/main/resources/statics/libs/vue.min.js

+3-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator-web/src/main/resources/statics/plugins/element-ui/index.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator-web/src/main/resources/statics/plugins/element-ui/theme-chalk/index.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator-web/src/main/resources/templates/header-CDN-v2.html

+14-31
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,26 @@
33
<!--#################-->
44

55
<!--jquery | vue | element-ui | axios-->
6-
<script src="//cdn.staticfile.net/jquery/3.5.1/jquery.min.js"></script>
7-
<script src="//cdn.staticfile.net/vue/2.6.12/vue.min.js"></script>
8-
<script src="//cdn.staticfile.net/element-ui/2.15.14/index.min.js"></script>
9-
<link rel="stylesheet" href="//cdn.staticfile.net/element-ui/2.15.0/theme-chalk/index.min.css">
10-
<script src="//cdn.staticfile.net/axios/0.1.0/axios.min.js"></script>
6+
<script src="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js"></script>
7+
<script src="//lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>
8+
<script src="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/axios/0.26.0/axios.min.js"></script>
9+
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/element-ui/2.15.7/index.min.js"></script>
10+
<link href="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/element-ui/2.15.7/theme-chalk/index.min.css" type="text/css" rel="stylesheet" />
1111

1212
<!--common.js-->
1313
<script src="${request.contextPath}/statics/js/common.js"></script>
1414
<!-- <link rel="stylesheet" href="${request.contextPath}/statics/css/main.css"> -->
1515

16-
<!--[if lt IE 9]>
17-
<script src="//cdn.staticfile.net/html5shiv/3.7.3/html5shiv.min.js"></script>
18-
<script src="//cdn.staticfile.net/respond.js/1.4.2/respond.min.js"></script>
19-
<![endif]-->
20-
21-
<!-- Bootstrap 4 -->
22-
<script src="//cdn.staticfile.net/bootstrap/4.6.2/js/bootstrap.bundle.min.js"></script>
23-
<!-- AdminLTE 3 -->
24-
<script src="//cdn.staticfile.net/admin-lte/3.2.0/js/adminlte.min.js"></script>
25-
<!-- Toastr 2 -->
26-
<script src="//cdn.staticfile.net/toastr.js/2.1.4/toastr.min.js"></script>
16+
<script src="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/toastr.js/2.1.4/toastr.min.js"></script>
17+
<!-- Toastr CSS -->
18+
<link href="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/toastr.js/2.1.4/toastr.min.css" rtype="text/css" rel="stylesheet" >
2719

2820
<!-- import codemirror -->
29-
<script src="//cdn.staticfile.net/codemirror/6.65.7/codemirror.min.js"></script>
30-
<script src="//cdn.staticfile.net/codemirror/6.65.7/mode/sql/sql.min.js"></script>
31-
<script src="//cdn.staticfile.net/codemirror/6.65.7/mode/xml/xml.min.js"></script>
32-
<script src="//cdn.staticfile.net/codemirror/6.65.7/mode/clike/clike.min.js"></script>
33-
<script src="//cdn.staticfile.net/codemirror/6.65.7/mode/javascript/javascript.min.js"></script>
34-
<link rel="stylesheet" href="//cdn.staticfile.net/codemirror/6.65.7/codemirror.min.css">
35-
<link rel="stylesheet" href="//cdn.staticfile.net/codemirror/6.65.7/theme/idea.min.css">
36-
37-
<!--bootsrap css-->
38-
<link rel="stylesheet" href="//cdn.staticfile.net/bootstrap/4.6.2/css/bootstrap.min.css">
39-
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/fontawesome-free/css/all.min.css">
21+
<script src="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/codemirror.min.js"></script>
22+
<script src="//lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/mode/sql/sql.min.js"></script>
23+
<link href="//lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/mode/clike/clike.min.js" type="text/css" rel="stylesheet" >
24+
<link href="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/codemirror.min.css" type="text/css" rel="stylesheet" >
25+
<link href="//lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/theme/idea.min.css" type="text/css" rel="stylesheet" >
4026

4127
<!-- Admin-LTE主题样式 -->
42-
<link rel="stylesheet" href="//cdn.staticfile.net/admin-lte/3.2.0/css/adminlte.min.css">
43-
44-
<!-- Toastr CSS -->
45-
<link href="//cdn.staticfile.net/toastr.js/2.1.4/toastr.min.css" rel="stylesheet">
28+
<link href="//lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/admin-lte/3.2.0/css/adminlte.min.css" type="text/css" rel="stylesheet" >

generator-web/src/main/resources/templates/header-CDN.html

-33
This file was deleted.

generator-web/src/main/resources/templates/header-local-v2.html

+7-23
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,24 @@
55
<!--jquery | vue | element-ui | axios-->
66
<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
77
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
8-
<script src="${request.contextPath}/statics/plugins/element-ui/index.min.js"></script>
9-
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/element-ui/theme-chalk/index.min.css">
108
<script src="${request.contextPath}/statics/plugins/axios/axios.min.js"></script>
9+
<script src="${request.contextPath}/statics/plugins/element-ui/index.min.js"></script>
10+
<link href="${request.contextPath}/statics/plugins/element-ui/theme-chalk/index.min.css" type="text/css" rel="stylesheet" >
1111

1212
<!--common.js-->
1313
<script src="${request.contextPath}/statics/js/common.js"></script>
1414

15-
<!--[if lt IE 9]>
16-
<script src="${request.contextPath}/statics/plugins/IE/html5shiv.min.js"></script>
17-
<script src="${request.contextPath}/statics/plugins/IE/respond.min.js"></script>
18-
<![endif]-->
19-
20-
<!-- Bootstrap 4 -->
21-
<script src="${request.contextPath}/statics/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
22-
<!-- AdminLTE 3 -->
23-
<script src="${request.contextPath}/statics/plugins/admin-lte/adminlte.min.js"></script>
2415
<!-- Toastr 2 -->
2516
<script src="${request.contextPath}/statics/plugins/toastr/toastr.min.js"></script>
17+
<!-- Toastr CSS -->
18+
<link href="${request.contextPath}/statics/plugins/toastr/toastr.min.css" type="text/css" rel="stylesheet" >
2619

2720
<!-- import codemirror -->
2821
<script src="${request.contextPath}/statics/plugins/codemirror/codemirror.min.js"></script>
29-
<script src="${request.contextPath}/statics/plugins/codemirror/javascript.min.js"></script>
3022
<script src="${request.contextPath}/statics/plugins/codemirror/clike.min.js"></script>
3123
<script src="${request.contextPath}/statics/plugins/codemirror/sql.min.js"></script>
32-
<script src="${request.contextPath}/statics/plugins/codemirror/xml.min.js"></script>
33-
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/codemirror/codemirror.min.css">
34-
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/codemirror/idea.min.css">
35-
36-
<!--bootsrap css-->
37-
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/bootstrap/css/bootstrap.min.css">
38-
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/fontawesome-free/css/all.min.css">
39-
24+
<link href="${request.contextPath}/statics/plugins/codemirror/codemirror.min.css" type="text/css" rel="stylesheet" >
25+
<link href="${request.contextPath}/statics/plugins/codemirror/idea.min.css" type="text/css" rel="stylesheet" >
4026

4127
<!-- Admin-LTE主题样式 -->
42-
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/admin-lte/adminlte.min.css">
43-
<!-- Toastr CSS -->
44-
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/toastr/toastr.min.css">
28+
<link href="${request.contextPath}/statics/plugins/admin-lte/adminlte.min.css" type="text/css" rel="stylesheet" >

generator-web/src/main/resources/templates/header-local.html

-44
This file was deleted.

generator-web/src/main/resources/templates/main-v2.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ <h5 class="card-title m-0">生成设置</h5>
130130
<el-form-item label="Lombok">
131131
<el-switch v-model="formData.options.isLombok"></el-switch>
132132
</el-form-item>
133-
133+
134134
</div>
135135
</div>
136136

0 commit comments

Comments
 (0)