Skip to content

Commit

Permalink
| 2024.12.29 | 优化前端加载速度,优化输出代码着色,CDN改字节跳动静态资源公共库。
Browse files Browse the repository at this point in the history
  • Loading branch information
moshowgame committed Dec 29, 2024
1 parent c69d6ad commit 1095661
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 296 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SpringBootCodeGenerator
----
又名`Java代码生成器``JAVA在线代码生成平台``sql转java``大狼狗代码生成器``mybatis在线生成器``SQL转Java JPA、MYBATIS实现类代码生成平台`<br>
![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/SpringBoot3-%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)
[![Java CI with Maven](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml/badge.svg)](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml)
Expand Down Expand Up @@ -73,6 +73,7 @@
# Update Logs
| 更新日期 | 更新内容 |
|:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 2024.12.29 | 优化前端加载速度,优化输出代码着色,CDN改字节跳动静态资源公共库。<br> |
| 2024.12.23 | 新增InsertSQL模式,采用JSQLParser引擎进行封装<br>优化代码封装<br>CDN恢复为staticfile.org加速(如果本地卡的话,建议切换local模式)。<br> |
| 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 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.softdev.system.generator.controller;

import com.alibaba.fastjson2.JSONArray;
import com.softdev.system.generator.entity.ClassInfo;
import com.softdev.system.generator.entity.ParamInfo;
import com.softdev.system.generator.entity.ReturnT;
Expand Down Expand Up @@ -49,7 +50,7 @@ public ModelAndView mainPage() {
@ResponseBody
public ReturnT getAllTemplates() throws Exception {
String templates = generatorService.getTemplateConfig();
return ReturnT.ok().put("templates",templates);
return ReturnT.ok().put("templates", JSONArray.parseArray(templates));
}
@PostMapping("/code/generate")
@ResponseBody
Expand Down
2 changes: 1 addition & 1 deletion generator-web/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
spring:
profiles:
active: bejson
active: dev
21 changes: 17 additions & 4 deletions generator-web/src/main/resources/statics/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ $(function(){

// init output code area
$.outputArea = CodeMirror.fromTextArea(document.getElementById("outputArea"), {
mode: "text/x-java", // JAV
theme: "idea", // IDEA主题
lineNumbers: true, //显示行号
smartIndent: true, // 自动缩进
Expand Down Expand Up @@ -128,15 +129,21 @@ const vm = new Vue({
}
setAllCookie();
//console.log(res.outputJson);
vm.outputJson=res.outputJson;
//兼容后端返回数据格式
if(res.data){
vm.outputJson = res.data.outputJson;
}else {
vm.outputJson = res.outputJson;
}

// console.log(vm.outputJson["bootstrap-ui"]);
vm.outputStr=vm.outputJson[vm.currentSelect].trim();
//console.log(vm.outputJson["bootstrap-ui"]);
//console.log(vm.outputStr);
$.outputArea.setValue(vm.outputStr);
$.outputArea.setSize('auto', 'auto');
//add to historicalData
vm.setHistoricalData(res.outputJson.tableName);
vm.setHistoricalData(vm.outputJson.tableName);
alert("生成成功");
});
},
Expand All @@ -150,8 +157,14 @@ const vm = new Vue({
id:1234
}).then(function(res){
//console.log(res.templates);
vm.templates = JSON.parse(res.templates);
// console.log(vm.templates);
// vm.templates = JSON.parse(res.templates);
// console.log(res);
//兼容后端返回数据格式
if(res.data){
vm.templates = res.data.templates;
}else {
vm.templates = res.templates;
}
});
},
updated: function () {
Expand Down
6 changes: 2 additions & 4 deletions generator-web/src/main/resources/statics/libs/jquery.min.js

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions generator-web/src/main/resources/statics/libs/vue.min.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

45 changes: 14 additions & 31 deletions generator-web/src/main/resources/templates/header-CDN-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,26 @@
<!--#################-->

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

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

<!--[if lt IE 9]>
<script src="//cdn.staticfile.net/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdn.staticfile.net/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<!-- Bootstrap 4 -->
<script src="//cdn.staticfile.net/bootstrap/4.6.2/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE 3 -->
<script src="//cdn.staticfile.net/admin-lte/3.2.0/js/adminlte.min.js"></script>
<!-- Toastr 2 -->
<script src="//cdn.staticfile.net/toastr.js/2.1.4/toastr.min.js"></script>
<script src="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/toastr.js/2.1.4/toastr.min.js"></script>
<!-- Toastr CSS -->
<link href="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/toastr.js/2.1.4/toastr.min.css" rtype="text/css" rel="stylesheet" >

<!-- import codemirror -->
<script src="//cdn.staticfile.net/codemirror/6.65.7/codemirror.min.js"></script>
<script src="//cdn.staticfile.net/codemirror/6.65.7/mode/sql/sql.min.js"></script>
<script src="//cdn.staticfile.net/codemirror/6.65.7/mode/xml/xml.min.js"></script>
<script src="//cdn.staticfile.net/codemirror/6.65.7/mode/clike/clike.min.js"></script>
<script src="//cdn.staticfile.net/codemirror/6.65.7/mode/javascript/javascript.min.js"></script>
<link rel="stylesheet" href="//cdn.staticfile.net/codemirror/6.65.7/codemirror.min.css">
<link rel="stylesheet" href="//cdn.staticfile.net/codemirror/6.65.7/theme/idea.min.css">

<!--bootsrap css-->
<link rel="stylesheet" href="//cdn.staticfile.net/bootstrap/4.6.2/css/bootstrap.min.css">
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/fontawesome-free/css/all.min.css">
<script src="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/codemirror.min.js"></script>
<script src="//lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/mode/sql/sql.min.js"></script>
<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" >
<link href="//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/codemirror.min.css" type="text/css" rel="stylesheet" >
<link href="//lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/codemirror/5.65.2/theme/idea.min.css" type="text/css" rel="stylesheet" >

<!-- Admin-LTE主题样式 -->
<link rel="stylesheet" href="//cdn.staticfile.net/admin-lte/3.2.0/css/adminlte.min.css">

<!-- Toastr CSS -->
<link href="//cdn.staticfile.net/toastr.js/2.1.4/toastr.min.css" rel="stylesheet">
<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" >
33 changes: 0 additions & 33 deletions generator-web/src/main/resources/templates/header-CDN.html

This file was deleted.

30 changes: 7 additions & 23 deletions generator-web/src/main/resources/templates/header-local-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,24 @@
<!--jquery | vue | element-ui | axios-->
<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
<script src="${request.contextPath}/statics/plugins/element-ui/index.min.js"></script>
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/element-ui/theme-chalk/index.min.css">
<script src="${request.contextPath}/statics/plugins/axios/axios.min.js"></script>
<script src="${request.contextPath}/statics/plugins/element-ui/index.min.js"></script>
<link href="${request.contextPath}/statics/plugins/element-ui/theme-chalk/index.min.css" type="text/css" rel="stylesheet" >

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

<!--[if lt IE 9]>
<script src="${request.contextPath}/statics/plugins/IE/html5shiv.min.js"></script>
<script src="${request.contextPath}/statics/plugins/IE/respond.min.js"></script>
<![endif]-->

<!-- Bootstrap 4 -->
<script src="${request.contextPath}/statics/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE 3 -->
<script src="${request.contextPath}/statics/plugins/admin-lte/adminlte.min.js"></script>
<!-- Toastr 2 -->
<script src="${request.contextPath}/statics/plugins/toastr/toastr.min.js"></script>
<!-- Toastr CSS -->
<link href="${request.contextPath}/statics/plugins/toastr/toastr.min.css" type="text/css" rel="stylesheet" >

<!-- import codemirror -->
<script src="${request.contextPath}/statics/plugins/codemirror/codemirror.min.js"></script>
<script src="${request.contextPath}/statics/plugins/codemirror/javascript.min.js"></script>
<script src="${request.contextPath}/statics/plugins/codemirror/clike.min.js"></script>
<script src="${request.contextPath}/statics/plugins/codemirror/sql.min.js"></script>
<script src="${request.contextPath}/statics/plugins/codemirror/xml.min.js"></script>
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/codemirror/codemirror.min.css">
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/codemirror/idea.min.css">

<!--bootsrap css-->
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/fontawesome-free/css/all.min.css">

<link href="${request.contextPath}/statics/plugins/codemirror/codemirror.min.css" type="text/css" rel="stylesheet" >
<link href="${request.contextPath}/statics/plugins/codemirror/idea.min.css" type="text/css" rel="stylesheet" >

<!-- Admin-LTE主题样式 -->
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/admin-lte/adminlte.min.css">
<!-- Toastr CSS -->
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/toastr/toastr.min.css">
<link href="${request.contextPath}/statics/plugins/admin-lte/adminlte.min.css" type="text/css" rel="stylesheet" >
44 changes: 0 additions & 44 deletions generator-web/src/main/resources/templates/header-local.html

This file was deleted.

2 changes: 1 addition & 1 deletion generator-web/src/main/resources/templates/main-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h5 class="card-title m-0">生成设置</h5>
<el-form-item label="Lombok">
<el-switch v-model="formData.options.isLombok"></el-switch>
</el-form-item>

</div>
</div>

Expand Down
Loading

0 comments on commit 1095661

Please sign in to comment.