diff --git a/README.md b/README.md index 159e6dc..ca2123c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ SpringBootCodeGenerator CSDN博客 http://blog.csdn.net/moshowgame 更新日期 更新内容 +20181212首页UI优化,新增MybatisPlus模块(感谢@三叔同事的建议),修复作者名和包名获取失败问题(感谢@Yanch1994的反馈)。 20181122优化正则表达式点号的处理,优化处理字段类型,对number类型增加int,long,BigDecimal的区分判断(感谢@lshz0088的指导)。 20181108修复非字段描述"KEY FK_xxxx (xxxx)"导致生成KEY字段情况(感谢@tornadoorz反馈)。 20181018支持double(x,x)的类型,以及comment里面包含一些特殊字符的处理(感谢@tanwubo的反馈)。 diff --git a/SpringBootCodeGenerator.iml b/SpringBootCodeGenerator.iml index a88f56c..e67ee34 100644 --- a/SpringBootCodeGenerator.iml +++ b/SpringBootCodeGenerator.iml @@ -36,6 +36,10 @@ + + + + @@ -48,9 +52,8 @@ - + - diff --git a/codegenerator1.png b/codegenerator1.png index 785e4ab..9a62348 100644 Binary files a/codegenerator1.png and b/codegenerator1.png differ diff --git a/codegenerator2.png b/codegenerator2.png index 55b1280..baef35c 100644 Binary files a/codegenerator2.png and b/codegenerator2.png differ 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 8d4b59a..079c873 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 @@ -13,7 +13,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -60,27 +59,32 @@ public class IndexController { // result Map result = new HashMap(); + //UI + result.put("swaggerui", freemarkerTool.processString("xxl-code-generator/swagger-ui.ftl", params)); + result.put("elementui", freemarkerTool.processString("xxl-code-generator/element-ui.ftl", params)); + result.put("bootstrap", freemarkerTool.processString("xxl-code-generator/bootstrap.ftl", params)); + + //mybatis old result.put("controller", freemarkerTool.processString("xxl-code-generator/controller.ftl", params)); result.put("service", freemarkerTool.processString("xxl-code-generator/service.ftl", params)); result.put("service_impl", freemarkerTool.processString("xxl-code-generator/service_impl.ftl", params)); result.put("dao", freemarkerTool.processString("xxl-code-generator/dao.ftl", params)); result.put("mybatis", freemarkerTool.processString("xxl-code-generator/mybatis.ftl", params)); result.put("model", freemarkerTool.processString("xxl-code-generator/model.ftl", params)); - + //jpa result.put("entity", freemarkerTool.processString("xxl-code-generator/entity.ftl", params)); - result.put("swaggerui", freemarkerTool.processString("xxl-code-generator/swagger-ui.ftl", params)); result.put("repository", freemarkerTool.processString("xxl-code-generator/repository.ftl", params)); result.put("jpacontroller", freemarkerTool.processString("xxl-code-generator/jpacontroller.ftl", params)); - + //jdbc template result.put("jtdao", freemarkerTool.processString("xxl-code-generator/jtdao.ftl", params)); result.put("jtdaoimpl", freemarkerTool.processString("xxl-code-generator/jtdaoimpl.ftl", params)); - + //beetsql result.put("beetlmd", freemarkerTool.processString("xxl-code-generator/beetlmd.ftl", params)); result.put("beetlentity", freemarkerTool.processString("xxl-code-generator/beetlentity.ftl", params)); result.put("beetlcontroller", freemarkerTool.processString("xxl-code-generator/beetlcontroller.ftl", params)); - - result.put("elementui", freemarkerTool.processString("xxl-code-generator/element-ui.ftl", params)); - result.put("bootstrap", freemarkerTool.processString("xxl-code-generator/bootstrap.ftl", params)); + //mybatis plus + result.put("pluscontroller", freemarkerTool.processString("xxl-code-generator/pluscontroller.ftl", params)); + result.put("plusmapper", freemarkerTool.processString("xxl-code-generator/plusmapper.ftl", params)); // 计算,生成代码行数 int lineNum = 0; diff --git a/generator-web/src/main/resources/application.yml b/generator-web/src/main/resources/application.yml index 63f003a..e9b8924 100644 --- a/generator-web/src/main/resources/application.yml +++ b/generator-web/src/main/resources/application.yml @@ -7,6 +7,7 @@ tomcat: uri-encoding: UTF-8 max-threads: 10 background-processor-delay: 30 + basedir: ${user.home}/tomcat/ spring: banner: charset: UTF-8 diff --git a/generator-web/src/main/resources/static/js/index-new.js b/generator-web/src/main/resources/static/js/index-new.js index 0ee5b20..8937e4d 100644 --- a/generator-web/src/main/resources/static/js/index-new.js +++ b/generator-web/src/main/resources/static/js/index-new.js @@ -33,12 +33,13 @@ $(function () { $('#btnGenCode').click(function () { var tableSql = ddlSqlArea.getValue(); - $.ajax({ type: 'POST', url: base_url + "/genCode", data: { - "tableSql": tableSql + "tableSql": tableSql, + "packageName":$("#packageName").val(), + "authorName":$("#authorName").val() }, dataType: "json", success: function (data) { @@ -54,9 +55,6 @@ $(function () { } }); - codeData = data.data; - genCodeArea.setValue(codeData.swaggerui); - genCodeArea.setSize('auto', 'auto'); } else { layer.open({ icon: '2', @@ -171,5 +169,17 @@ $(function () { genCodeArea.setSize('auto', 'auto'); } }); + $('#pluscontroller').click(function () { + if(!$.isEmptyObject(codeData)) { + genCodeArea.setValue(codeData.pluscontroller); + genCodeArea.setSize('auto', 'auto'); + } + }); + $('#plusmapper').click(function () { + if(!$.isEmptyObject(codeData)) { + genCodeArea.setValue(codeData.plusmapper); + genCodeArea.setSize('auto', 'auto'); + } + }); }); \ No newline at end of file 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 2c2d9dc..cb10e00 100644 --- a/generator-web/src/main/resources/templates/common/common-import.ftl +++ b/generator-web/src/main/resources/templates/common/common-import.ftl @@ -14,7 +14,7 @@ - + @@ -37,11 +37,11 @@ - - - - - + + + + + diff --git a/generator-web/src/main/resources/templates/index.ftl b/generator-web/src/main/resources/templates/index.ftl index 34a456a..b28fa33 100644 --- a/generator-web/src/main/resources/templates/index.ftl +++ b/generator-web/src/main/resources/templates/index.ftl @@ -16,7 +16,7 @@
-