mirror of
https://github.com/moshowgame/SpringBootCodeGenerator.git
synced 2026-03-22 07:28:25 +08:00
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
|更新日期|更新内容|
|
|更新日期|更新内容|
|
||||||
|-|-|
|
|-|-|
|
||||||
|
|20191229|1.修复bejson安全防护策略拦截问题(感谢@liangbintao和@1808083642的反馈) 2.优化字段名含date字符串的处理(感谢@smilexzh的反馈) 3.控制台动态输出项目访问地址(感谢@gaohanghang的提交)|
|
||||||
|20191128|1.修复支持string-copy导致的以n结尾的字母不显示问题 2.jpa-entity新增swagger@ApiModel@ApiModelProperty注解和SQL字段@Column注解(感谢@yjq907的建议) |
|
|20191128|1.修复支持string-copy导致的以n结尾的字母不显示问题 2.jpa-entity新增swagger@ApiModel@ApiModelProperty注解和SQL字段@Column注解(感谢@yjq907的建议) |
|
||||||
|20191126|1.springboot2内置tomcat更换为性能更强大的undertow 2.修复tinyintTransType参数丢失问题 |
|
|20191126|1.springboot2内置tomcat更换为性能更强大的undertow 2.修复tinyintTransType参数丢失问题 |
|
||||||
|20191124|1.java代码结构优化. 2.新增简单的json生成模式 3.新增简单的正则表达式匹配模式(感谢@ydq的贡献) 4.新增对复制String代码中的乱SQL代码的支持 5.优化对JSON的父子节点/处理,JSONObject和JSONArray节点处理,子节点缺失'{'头处理|
|
|20191124|1.java代码结构优化. 2.新增简单的json生成模式 3.新增简单的正则表达式匹配模式(感谢@ydq的贡献) 4.新增对复制String代码中的乱SQL代码的支持 5.优化对JSON的父子节点/处理,JSONObject和JSONArray节点处理,子节点缺失'{'头处理|
|
||||||
|
|||||||
@@ -1,49 +1,49 @@
|
|||||||
package com.softdev.system.generator.config;
|
package com.softdev.system.generator.config;
|
||||||
|
|
||||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 2019-2-11 liutf WebMvcConfig 整合 cors 和 SpringMvc MessageConverter
|
* 2019-2-11 liutf WebMvcConfig 整合 cors 和 SpringMvc MessageConverter
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WebMvcConfig implements WebMvcConfigurer {
|
public class WebMvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
/* @Override
|
/* @Override
|
||||||
public void addCorsMappings(CorsRegistry registry) {
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
registry.addMapping("/**")
|
registry.addMapping("/**")
|
||||||
.allowedOrigins("*")
|
.allowedOrigins("*")
|
||||||
.allowedHeaders("x-requested-with")
|
.allowedHeaders("x-requested-with")
|
||||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE")
|
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE")
|
||||||
.maxAge(3600);
|
.maxAge(3600);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
//FastJsonHttpMessageConverter
|
//FastJsonHttpMessageConverter
|
||||||
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
||||||
|
|
||||||
List<MediaType> fastMediaTypes = new ArrayList<>();
|
List<MediaType> fastMediaTypes = new ArrayList<>();
|
||||||
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
|
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
|
||||||
fastConverter.setSupportedMediaTypes(fastMediaTypes);
|
fastConverter.setSupportedMediaTypes(fastMediaTypes);
|
||||||
|
|
||||||
FastJsonConfig fastJsonConfig = new FastJsonConfig();
|
FastJsonConfig fastJsonConfig = new FastJsonConfig();
|
||||||
fastJsonConfig.setCharset(Charset.forName("UTF-8"));
|
fastJsonConfig.setCharset(StandardCharsets.UTF_8);
|
||||||
fastConverter.setFastJsonConfig(fastJsonConfig);
|
fastConverter.setFastJsonConfig(fastJsonConfig);
|
||||||
|
|
||||||
//StringHttpMessageConverter
|
//StringHttpMessageConverter
|
||||||
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
|
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
|
||||||
stringConverter.setDefaultCharset(Charset.forName("UTF-8"));
|
stringConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||||
stringConverter.setSupportedMediaTypes(fastMediaTypes);
|
stringConverter.setSupportedMediaTypes(fastMediaTypes);
|
||||||
converters.add(stringConverter);
|
converters.add(stringConverter);
|
||||||
converters.add(fastConverter);
|
converters.add(fastConverter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -37,7 +38,7 @@ public class IndexController {
|
|||||||
|
|
||||||
@PostMapping("/genCode")
|
@PostMapping("/genCode")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<Map<String, String>> codeGenerate( ParamInfo paramInfo ) {
|
public ReturnT<Map<String, String>> codeGenerate(@RequestBody ParamInfo paramInfo ) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public class TableParseUtil {
|
|||||||
fieldClass = Float.class.getSimpleName();
|
fieldClass = Float.class.getSimpleName();
|
||||||
} else if (columnLine.contains("double")) {
|
} else if (columnLine.contains("double")) {
|
||||||
fieldClass = Double.class.getSimpleName();
|
fieldClass = Double.class.getSimpleName();
|
||||||
} else if (columnLine.contains("time") || columnLine.contains("date") || columnLine.contains("datetime") || columnLine.contains("timestamp")) {
|
} else if (columnLine.contains("time") || columnLine.contains(" date") || columnLine.contains("datetime") || columnLine.contains("timestamp")) {
|
||||||
fieldClass = Date.class.getSimpleName();
|
fieldClass = Date.class.getSimpleName();
|
||||||
} else if (columnLine.contains("varchar") || columnLine.contains(" text")|| columnLine.contains("char")
|
} else if (columnLine.contains("varchar") || columnLine.contains(" text")|| columnLine.contains("char")
|
||||||
|| columnLine.contains("clob")||columnLine.contains("blob")||columnLine.contains("json")) {
|
|| columnLine.contains("clob")||columnLine.contains("blob")||columnLine.contains("json")) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version": "20191128"}
|
{"version": "20191229"}
|
||||||
@@ -42,27 +42,44 @@
|
|||||||
genCodeArea.setSize('auto','auto');
|
genCodeArea.setSize('auto','auto');
|
||||||
|
|
||||||
var codeData;
|
var codeData;
|
||||||
|
// 使用:var jsonObj = $("#formId").serializeObject();
|
||||||
|
$.fn.serializeObject = function()
|
||||||
|
{
|
||||||
|
var o = {};
|
||||||
|
var a = this.serializeArray();
|
||||||
|
$.each(a, function() {
|
||||||
|
if (o[this.name]) {
|
||||||
|
if (!o[this.name].push) {
|
||||||
|
o[this.name] = [o[this.name]];
|
||||||
|
}
|
||||||
|
o[this.name].push(this.value || '');
|
||||||
|
} else {
|
||||||
|
o[this.name] = this.value || '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return o;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* 生成代码
|
* 生成代码
|
||||||
*/
|
*/
|
||||||
$('#btnGenCode').click(function () {
|
$('#btnGenCode').click(function () {
|
||||||
var tableSql = ddlSqlArea.getValue();
|
var jsonData = {
|
||||||
|
"tableSql": ddlSqlArea.getValue(),
|
||||||
|
"packageName":$("#packageName").val(),
|
||||||
|
"returnUtil":$("#returnUtil").val(),
|
||||||
|
"authorName":$("#authorName").val(),
|
||||||
|
"dataType":$("#dataType").val(),
|
||||||
|
"tinyintTransType":$("#tinyintTransType").val(),
|
||||||
|
"nameCaseType":$("#nameCaseType").val()
|
||||||
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: base_url + "/genCode",
|
url: base_url + "/genCode",
|
||||||
data: {
|
data:(JSON.stringify(jsonData)),
|
||||||
"tableSql": tableSql,
|
|
||||||
"packageName":$("#packageName").val(),
|
|
||||||
"returnUtil":$("#returnUtil").val(),
|
|
||||||
"authorName":$("#authorName").val(),
|
|
||||||
"dataType":$("#dataType").val(),
|
|
||||||
"tinyintTransType":$("#tinyintTransType").val(),
|
|
||||||
"nameCaseType":$("#nameCaseType").val()
|
|
||||||
},
|
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
contentType: "application/json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.code == 200) {
|
if (data.code === 200) {
|
||||||
codeData = data.data;
|
codeData = data.data;
|
||||||
genCodeArea.setValue(codeData.beetlentity);
|
genCodeArea.setValue(codeData.beetlentity);
|
||||||
genCodeArea.setSize('auto', 'auto');
|
genCodeArea.setSize('auto', 'auto');
|
||||||
@@ -72,6 +89,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* 按钮事件组
|
* 按钮事件组
|
||||||
|
|||||||
Reference in New Issue
Block a user