From 1b5d79ded1b396c0825e6c9144bcf997225618df Mon Sep 17 00:00:00 2001 From: "MOSHOW.K.ZHENG" Date: Sat, 23 Nov 2019 10:10:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=A7=BB=E9=99=A4=E9=A2=91=E7=B9=81=E5=87=BA?= =?UTF-8?q?=E9=94=99=E5=92=8C=E8=A2=AB=E8=BF=87=E6=BB=A4=E7=9A=84layer,?= =?UTF-8?q?=E6=94=B9=E4=B8=BAjquery-toast.=202.Util=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96,=E6=96=B0=E5=A2=9Ejson=E5=92=8Cxml.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + .../generator/controller/IndexController.java | 2 + .../templates/code-generator/util/json.ftl | 7 +++ .../templates/code-generator/util/util.ftl | 5 ++ .../templates/code-generator/util/xml.ftl | 11 ++++ .../templates/common/common-import.ftl | 4 +- .../src/main/resources/templates/index.ftl | 50 +++++++++---------- 7 files changed, 54 insertions(+), 26 deletions(-) create mode 100644 generator-web/src/main/resources/templates/code-generator/util/json.ftl create mode 100644 generator-web/src/main/resources/templates/code-generator/util/xml.ftl diff --git a/README.md b/README.md index b7fbb54..6a8fcc0 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ SpringBootCodeGenerator CSDN博客 http://zhengkai.blog.csdn.net 更新日期 更新内容 +201911231.移除频繁出错和被过滤的layer,改为jquery-toast. 2.Util功能优化,新增json和xml. 20191116优化对primary关键字的处理(感谢@liujiansgit的反馈). 201911151.添加tinyint类型转换(感谢@lixiliang&@liujiansgit的Suggestion) 2.添加一键复制功能(感谢@gaohanghang的Suggestion) 3.Mybatis的insert增加keyProperty="id"用于返回自增id(感谢@88888888888888888888的Suggestion) 4.优化date类型的支持(感谢@SteveLsf的反馈) 5.其他一些优化. 20191015修复jdbcTemplates中insert语句第一个字段丢失的问题. diff --git a/generator-web/src/main/java/com/softdev/system/generator/controller/IndexController.java b/generator-web/src/main/java/com/softdev/system/generator/controller/IndexController.java index ce0e79c..cdcbc79 100644 --- a/generator-web/src/main/java/com/softdev/system/generator/controller/IndexController.java +++ b/generator-web/src/main/java/com/softdev/system/generator/controller/IndexController.java @@ -92,6 +92,8 @@ public class IndexController { result.put("plusmapper", freemarkerTool.processString("code-generator/mybatis-plus/plusmapper.ftl", params)); //util result.put("util", freemarkerTool.processString("code-generator/util/util.ftl", params)); + result.put("json", freemarkerTool.processString("code-generator/util/json.ftl", params)); + result.put("xml", freemarkerTool.processString("code-generator/util/xml.ftl", params)); //sql generate result.put("select", freemarkerTool.processString("code-generator/sql/select.ftl", params)); result.put("insert", freemarkerTool.processString("code-generator/sql/insert.ftl", params)); diff --git a/generator-web/src/main/resources/templates/code-generator/util/json.ftl b/generator-web/src/main/resources/templates/code-generator/util/json.ftl new file mode 100644 index 0000000..a0be13a --- /dev/null +++ b/generator-web/src/main/resources/templates/code-generator/util/json.ftl @@ -0,0 +1,7 @@ +<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0> +{ +<#list classInfo.fieldList as fieldItem> + "${fieldItem.fieldName}":""<#if fieldItem_has_next>, + +} + diff --git a/generator-web/src/main/resources/templates/code-generator/util/util.ftl b/generator-web/src/main/resources/templates/code-generator/util/util.ftl index 7176745..13da0ab 100644 --- a/generator-web/src/main/resources/templates/code-generator/util/util.ftl +++ b/generator-web/src/main/resources/templates/code-generator/util/util.ftl @@ -13,4 +13,9 @@ ${fieldItem.fieldClass} ${fieldItem.fieldName} = ${classInfo.className?uncap_fir // ${fieldItem.fieldComment} ${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}(); + +<#list classInfo.fieldList as fieldItem> +// ${fieldItem.fieldComment} +${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}(${classInfo.className?uncap_first}2.get${fieldItem.fieldName?cap_first}();); + diff --git a/generator-web/src/main/resources/templates/code-generator/util/xml.ftl b/generator-web/src/main/resources/templates/code-generator/util/xml.ftl new file mode 100644 index 0000000..d815657 --- /dev/null +++ b/generator-web/src/main/resources/templates/code-generator/util/xml.ftl @@ -0,0 +1,11 @@ + +<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0> +<${classInfo.className}> +<#list classInfo.fieldList as fieldItem> + <${fieldItem.fieldName}> + + + diff --git a/generator-web/src/main/resources/templates/common/common-import.ftl b/generator-web/src/main/resources/templates/common/common-import.ftl index c307aae..3e6c424 100644 --- a/generator-web/src/main/resources/templates/common/common-import.ftl +++ b/generator-web/src/main/resources/templates/common/common-import.ftl @@ -16,6 +16,8 @@ + + + - diff --git a/generator-web/src/main/resources/templates/index.ftl b/generator-web/src/main/resources/templates/index.ftl index 4195e2e..0550ff2 100644 --- a/generator-web/src/main/resources/templates/index.ftl +++ b/generator-web/src/main/resources/templates/index.ftl @@ -9,7 +9,6 @@ <@netCommon.commonStyle /> <@netCommon.commonScript /> - <#---->