From 2779dc08532bd5b16ad6d1325059a6e1affa394f Mon Sep 17 00:00:00 2001 From: jeesun Date: Fri, 14 Jun 2019 15:52:34 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=9B=BD=E9=99=85=E5=8C=96bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simon/controller/FontAwesomeController.java | 10 ++++++++-- .../main/resources/templates/vue/fontAwesome/add.html | 11 +++++++---- .../resources/templates/vue/fontAwesome/edit.html | 9 +++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/web/src/main/java/com/simon/controller/FontAwesomeController.java b/web/src/main/java/com/simon/controller/FontAwesomeController.java index 8eefa4b..651e14b 100644 --- a/web/src/main/java/com/simon/controller/FontAwesomeController.java +++ b/web/src/main/java/com/simon/controller/FontAwesomeController.java @@ -8,6 +8,7 @@ import com.simon.common.domain.ResultMsg; import com.simon.common.domain.UserEntity; import com.simon.dto.FontAwesomeDto; import com.simon.model.FontAwesome; +import com.simon.service.DictTypeService; import com.simon.service.FontAwesomeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiParam; @@ -42,19 +43,24 @@ public class FontAwesomeController extends BaseController { @Autowired private FontAwesomeService fontAwesomeService; + @Autowired + private DictTypeService dictTypeService; + @GetMapping("list") public String list(Model model) { return "vue/fontAwesome/list"; } @GetMapping("add") - public String add(Model model) { + public String add(Model model, Locale locale) { + model.addAttribute("statusList", listToMap(dictTypeService.getTypeByGroupCode("status", locale.toString()))); return "vue/fontAwesome/add"; } @GetMapping("edit") - public String edit(Model model, @RequestParam Integer id) { + public String edit(Model model, Locale locale, @RequestParam Integer id) { model.addAttribute("entity", entityToMap(fontAwesomeService.findById(id))); + model.addAttribute("statusList", listToMap(dictTypeService.getTypeByGroupCode("status", locale.toString()))); return "vue/fontAwesome/edit"; } diff --git a/web/src/main/resources/templates/vue/fontAwesome/add.html b/web/src/main/resources/templates/vue/fontAwesome/add.html index c317eac..fff2841 100644 --- a/web/src/main/resources/templates/vue/fontAwesome/add.html +++ b/web/src/main/resources/templates/vue/fontAwesome/add.html @@ -20,10 +20,12 @@ - - - - + + @@ -53,6 +55,7 @@ var app = new Vue({ el: '#app', data: { + statusList: [[${statusList}]], ruleForm: { id: "", iconClass: "fas fa-", diff --git a/web/src/main/resources/templates/vue/fontAwesome/edit.html b/web/src/main/resources/templates/vue/fontAwesome/edit.html index cefdb83..b979fc5 100644 --- a/web/src/main/resources/templates/vue/fontAwesome/edit.html +++ b/web/src/main/resources/templates/vue/fontAwesome/edit.html @@ -21,8 +21,12 @@ - - + + @@ -53,6 +57,7 @@ var app = new Vue({ el: '#app', data: { + statusList: [[${statusList}]], ruleForm: { id: String([[${entity.id}]]), iconClass: [[${entity.iconClass}]], -- Gitee From dc916114eddb377d14c2ad1fbefc891cfb447a22 Mon Sep 17 00:00:00 2001 From: jeesun Date: Fri, 14 Jun 2019 15:58:35 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8DquartzJob=20form=20label?= =?UTF-8?q?=E8=BF=87=E9=95=BF=E6=8D=A2=E8=A1=8Cbug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/main/resources/templates/vue/quartzJob/add.html | 2 +- web/src/main/resources/templates/vue/quartzJob/edit.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/main/resources/templates/vue/quartzJob/add.html b/web/src/main/resources/templates/vue/quartzJob/add.html index 5f34c27..292a8d7 100644 --- a/web/src/main/resources/templates/vue/quartzJob/add.html +++ b/web/src/main/resources/templates/vue/quartzJob/add.html @@ -6,7 +6,7 @@ - + diff --git a/web/src/main/resources/templates/vue/quartzJob/edit.html b/web/src/main/resources/templates/vue/quartzJob/edit.html index 4c905e1..740d18a 100644 --- a/web/src/main/resources/templates/vue/quartzJob/edit.html +++ b/web/src/main/resources/templates/vue/quartzJob/edit.html @@ -6,7 +6,7 @@ - + -- Gitee From 10e64da24fa877f0b1929aa3dfa2185c37d6bc8f Mon Sep 17 00:00:00 2001 From: jeesun Date: Sat, 15 Jun 2019 17:18:50 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schema-mysql-20190613.sql" | 5 ++++- .../schema-oracle-20190613.sql" | 3 +++ .../schema-postgresql-20190613.sql" | 2 ++ .../java/com/simon/dto/EasyUiSideMenuDto.java | 3 +++ .../simon/controller/SideMenuController.java | 3 +++ web/src/main/resources/messages.properties | 5 ++++- .../main/resources/messages_en_US.properties | 3 +++ .../main/resources/messages_zh_CN.properties | 3 +++ .../templates/vue/sideMenu/subAdd.html | 14 ++++++++----- .../templates/vue/sideMenu/subEdit.html | 20 +++++++++++++------ 10 files changed, 48 insertions(+), 13 deletions(-) diff --git "a/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-mysql-20190613.sql" "b/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-mysql-20190613.sql" index 308dd9c..f2b7a06 100644 --- "a/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-mysql-20190613.sql" +++ "b/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-mysql-20190613.sql" @@ -391,4 +391,7 @@ drop table t_multi_language; -- 2019-06-13 by simon 重命名t_s_font_awesome字段 ALTER TABLE t_s_font_awesome CHANGE label label_en_us VARCHAR(50) NOT NULL; -ALTER TABLE t_s_font_awesome CHANGE tags label_zh_cn VARCHAR(50) NOT NULL; \ No newline at end of file +ALTER TABLE t_s_font_awesome CHANGE tags label_zh_cn VARCHAR(50) NOT NULL; + +-- 2019-06-14 by simon 修改t_side_menu数据 +UPDATE t_side_menu SET request_method='GET' WHERE remark='list'; diff --git "a/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-oracle-20190613.sql" "b/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-oracle-20190613.sql" index 2635da5..f0bba6b 100644 --- "a/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-oracle-20190613.sql" +++ "b/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-oracle-20190613.sql" @@ -435,3 +435,6 @@ drop table t_multi_language; -- 2019-06-13 by simon 重命名t_s_font_awesome字段 ALTER TABLE t_s_font_awesome rename column label to label_en_us; ALTER TABLE t_s_font_awesome rename column tags to label_zh_cn; + +-- 2019-06-14 by simon 修改t_side_menu数据 +UPDATE t_side_menu SET request_method='GET' WHERE remark='list'; diff --git "a/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-postgresql-20190613.sql" "b/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-postgresql-20190613.sql" index 653a07a..3f0e7a5 100644 --- "a/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-postgresql-20190613.sql" +++ "b/SQL\345\242\236\351\207\217\346\233\264\346\226\260/schema-postgresql-20190613.sql" @@ -417,3 +417,5 @@ drop table t_multi_language; ALTER TABLE t_s_font_awesome rename column label to label_en_us; ALTER TABLE t_s_font_awesome rename column tags to label_zh_cn; +-- 2019-06-14 by simon 修改t_side_menu数据 +UPDATE t_side_menu SET request_method='GET' WHERE remark='list'; diff --git a/common/src/main/java/com/simon/dto/EasyUiSideMenuDto.java b/common/src/main/java/com/simon/dto/EasyUiSideMenuDto.java index b485e38..3fdf7f5 100644 --- a/common/src/main/java/com/simon/dto/EasyUiSideMenuDto.java +++ b/common/src/main/java/com/simon/dto/EasyUiSideMenuDto.java @@ -66,4 +66,7 @@ public class EasyUiSideMenuDto implements Serializable { @ApiModelProperty(value = "请求方式") private String requestMethod; + + @ApiModelProperty(value = "备注") + private String remark; } diff --git a/web/src/main/java/com/simon/controller/SideMenuController.java b/web/src/main/java/com/simon/controller/SideMenuController.java index 178c3f3..73f19fe 100644 --- a/web/src/main/java/com/simon/controller/SideMenuController.java +++ b/web/src/main/java/com/simon/controller/SideMenuController.java @@ -222,6 +222,7 @@ public class SideMenuController extends BaseController { dto.setOrderNum(sideMenu.getOrderNum()); dto.setPid(sideMenu.getPid()); dto.setRequestMethod(sideMenu.getRequestMethod()); + dto.setRemark(sideMenu.getRemark()); List subSideMenus = sideMenu.getSubSideMenus(); if (null != subSideMenus && subSideMenus.size() > 0) { @@ -242,6 +243,7 @@ public class SideMenuController extends BaseController { child.setOrderNum(subSideMenu.getOrderNum()); child.setPid(subSideMenu.getPid()); child.setUrl(subSideMenu.getUrl()); + child.setRemark(subSideMenu.getRemark()); List grandchildren = new ArrayList<>(); List grandchildrenMenus = sideMenuService.selectByPid(subSideMenu.getId(), locale.toString()); @@ -262,6 +264,7 @@ public class SideMenuController extends BaseController { grandchild.setPid(grandchildMenu.getPid()); grandchild.setUrl(grandchildMenu.getUrl()); grandchild.setRequestMethod(grandchildMenu.getRequestMethod()); + grandchild.setRemark(grandchildMenu.getRemark()); grandchildren.add(grandchild); } child.setChildren(grandchildren); diff --git a/web/src/main/resources/messages.properties b/web/src/main/resources/messages.properties index 1c1a036..7435d67 100644 --- a/web/src/main/resources/messages.properties +++ b/web/src/main/resources/messages.properties @@ -188,6 +188,9 @@ sideMenu.addMenuGroup=\u65b0\u589e\u83dc\u5355\u7ec4 sideMenu.addChildMenu=\u65b0\u589e\u5b50\u83dc\u5355 sideMenu.parentMenuName=\u7236\u83dc\u5355\u540d\u79f0 sideMenu.authorities=\u83dc\u5355\u6743\u9650 +sideMenu.entityName=\u5b9e\u4f53\u540d +sideMenu.remark.list=\u5217\u8868\u9875\u9762 +sideMenu.remark.data=\u5217\u8868\u6570\u636e dictType.name=\u5b57\u5178\u540d\u79f0 dictType.code=\u5b57\u5178\u7f16\u7801 @@ -199,4 +202,4 @@ dictType.addDictGroup=\u65b0\u589e\u5b57\u5178\u7ec4 fontAwesome.iconClass=\u56fe\u6807\u0063\u006c\u0061\u0073\u0073 fontAwesome.iconPreview=\u56fe\u6807\u9884\u89c8 fontAwesome.labelEnUs=\u82f1\u6587\u6807\u7b7e -fontAwesome.labelZhCn=\u4e2d\u6587\u6807\u7b7e \ No newline at end of file +fontAwesome.labelZhCn=\u4e2d\u6587\u6807\u7b7e diff --git a/web/src/main/resources/messages_en_US.properties b/web/src/main/resources/messages_en_US.properties index da779bf..d28339e 100644 --- a/web/src/main/resources/messages_en_US.properties +++ b/web/src/main/resources/messages_en_US.properties @@ -188,6 +188,9 @@ sideMenu.addMenuGroup=add menu group sideMenu.addChildMenu=add child menu sideMenu.parentMenuName=parent menu sideMenu.authorities=authority +sideMenu.entityName=entity name +sideMenu.remark.list=list page +sideMenu.remark.data=list data dictType.name=dict name dictType.code=dict code diff --git a/web/src/main/resources/messages_zh_CN.properties b/web/src/main/resources/messages_zh_CN.properties index 1c1a036..5570537 100644 --- a/web/src/main/resources/messages_zh_CN.properties +++ b/web/src/main/resources/messages_zh_CN.properties @@ -188,6 +188,9 @@ sideMenu.addMenuGroup=\u65b0\u589e\u83dc\u5355\u7ec4 sideMenu.addChildMenu=\u65b0\u589e\u5b50\u83dc\u5355 sideMenu.parentMenuName=\u7236\u83dc\u5355\u540d\u79f0 sideMenu.authorities=\u83dc\u5355\u6743\u9650 +sideMenu.entityName=\u5b9e\u4f53\u540d +sideMenu.remark.list=\u5217\u8868\u9875\u9762 +sideMenu.remark.data=\u5217\u8868\u6570\u636e dictType.name=\u5b57\u5178\u540d\u79f0 dictType.code=\u5b57\u5178\u7f16\u7801 diff --git a/web/src/main/resources/templates/vue/sideMenu/subAdd.html b/web/src/main/resources/templates/vue/sideMenu/subAdd.html index da652a2..946cc7a 100644 --- a/web/src/main/resources/templates/vue/sideMenu/subAdd.html +++ b/web/src/main/resources/templates/vue/sideMenu/subAdd.html @@ -7,9 +7,6 @@ - - + @@ -53,7 +50,14 @@ - + + + + + + + + diff --git a/web/src/main/resources/templates/vue/sideMenu/subEdit.html b/web/src/main/resources/templates/vue/sideMenu/subEdit.html index d243905..372d984 100644 --- a/web/src/main/resources/templates/vue/sideMenu/subEdit.html +++ b/web/src/main/resources/templates/vue/sideMenu/subEdit.html @@ -7,9 +7,6 @@ - - + @@ -50,7 +47,17 @@ - + + + + + + + + + + + @@ -95,7 +102,8 @@ menuType: [[${entity.menuType}]], icon: [[${entity.icon}]], requestMethod: [[${entity.requestMethod}]], - remark: [[${entity.remark}]] + remark: [[${entity.remark}]], + entityName: [[${entity.entityName}]] }, rules: { name: [ -- Gitee From c1f5105427c180c18cb4b6b62aa33fdfe0c8590c Mon Sep 17 00:00:00 2001 From: jeesun Date: Mon, 17 Jun 2019 15:11:18 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=8D=87=E7=BA=A7myexcel=202.5.0->2.5.1?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d819df4..24f7256 100644 --- a/pom.xml +++ b/pom.xml @@ -465,7 +465,7 @@ com.github.liaochong myexcel - 2.5.0 + 2.5.1 -- Gitee From 3f0d6b8fcfeeb1bc3e7d4b11836a44bc986d4133 Mon Sep 17 00:00:00 2001 From: jeesun Date: Mon, 17 Jun 2019 16:13:50 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=99=A8=E7=94=9F=E6=88=90=E7=9A=84entity?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0excel=E5=AF=BC=E5=85=A5=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=B3=A8=E8=A7=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/code/entity.ftl | 11 ++++- .../com/simon/common/code/CodeGenerator.java | 16 ++++---- .../common/code/FreeMarkerGeneratorUtil.java | 21 ++-------- .../java/com/simon/common/utils/DbUtil.java | 40 ++++++++++++++----- .../main/resources/templates/code/entity.ftl | 11 ++++- .../main/resources/templates/code/entity.ftl | 11 ++++- 6 files changed, 69 insertions(+), 41 deletions(-) diff --git a/api/src/main/resources/templates/code/entity.ftl b/api/src/main/resources/templates/code/entity.ftl index cc5c2a6..3e3207b 100644 --- a/api/src/main/resources/templates/code/entity.ftl +++ b/api/src/main/resources/templates/code/entity.ftl @@ -3,12 +3,17 @@ package ${basePackage}.model; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.serializer.ToStringSerializer; import com.fasterxml.jackson.annotation.JsonFormat; +import com.github.liaochong.myexcel.core.WorkbookType; +import com.github.liaochong.myexcel.core.annotation.ExcelColumn; +import com.github.liaochong.myexcel.core.annotation.ExcelTable; +import com.github.liaochong.myexcel.core.annotation.ExcludeColumn; import ${basePackage}.common.config.AppConfig; import ${basePackage}.common.utils.UUIdGenId; import ${basePackage}.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.hibernate.annotations.GenericGenerator; +import org.springframework.format.annotation.DateTimeFormat; import tk.mybatis.mapper.annotation.KeySql; import lombok.Data; @@ -26,12 +31,14 @@ import java.time.LocalDateTime; * @author ${AUTHOR} * @date ${CREATE} **/ +@ExcelTable(sheetName = "${tableComment}", workbookType = WorkbookType.SXLSX, rowAccessWindowSize = 100, useFieldNameAsTitle = true) @ApiModel(description = "${tableComment}") @Data @EqualsAndHashCode(callSuper = false) @Entity @Table(name="${tableName}") -public class ${entityName} implements Serializable{ +public class ${entityName} implements Serializable { + @ExcludeColumn private static final long serialVersionUID = 1L; <#list columns as column> @@ -39,10 +46,12 @@ public class ${entityName} implements Serializable{ private ${column.type} ${column.name}; + @ExcludeColumn @ApiModelProperty(value = "创建人名称") @Transient private String createUser; + @ExcludeColumn @ApiModelProperty(value = "更新人名称") @Transient private String updateUser; diff --git a/common/src/main/java/com/simon/common/code/CodeGenerator.java b/common/src/main/java/com/simon/common/code/CodeGenerator.java index 25e2ee0..0688315 100644 --- a/common/src/main/java/com/simon/common/code/CodeGenerator.java +++ b/common/src/main/java/com/simon/common/code/CodeGenerator.java @@ -1,6 +1,7 @@ package com.simon.common.code; import com.google.common.base.CaseFormat; +import com.simon.common.utils.DbUtil; import freemarker.template.TemplateExceptionHandler; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -324,14 +325,11 @@ public class CodeGenerator { log.info(modelName + "Mapper.xml 生成成功"); FreeMarkerGeneratorUtil.generatorMvcCode( - JDBC_DIVER_CLASS_NAME, - JDBC_URL, - JDBC_USERNAME, - JDBC_PASSWORD, + DbUtil.getConnection(JDBC_DIVER_CLASS_NAME, JDBC_URL, JDBC_USERNAME, JDBC_PASSWORD), tableName, modelName, MODEL_PACKAGE); - + //重新生成Mapper.java,覆盖自动生成的。 reGenMapper(tableName, tableComment, modelName, idType); } @@ -362,7 +360,7 @@ public class CodeGenerator { } cfg.getTemplate("mapper.ftl").process(data, new FileWriter(file)); - log.info(modelNameUpperCamel + "Mapper.java 重新生成成功"); + log.info(modelNameUpperCamel + "Mapper.java 重新生成成功,文件位置{}", file.getPath()); } catch (Exception e) { @@ -389,7 +387,7 @@ public class CodeGenerator { } cfg.getTemplate("repository.ftl").process(data, new FileWriter(file)); - log.info(modelNameUpperCamel + "Repository.java 生成成功"); + log.info(modelNameUpperCamel + "Repository.java 生成成功,文件位置:{}", file.getPath()); } catch (Exception e) { throw new RuntimeException("生成repository失败", e); @@ -415,7 +413,7 @@ public class CodeGenerator { } cfg.getTemplate("service.ftl").process(data, new FileWriter(file)); - log.info(modelNameUpperCamel + "Service.java 生成成功"); + log.info(modelNameUpperCamel + "Service.java 生成成功,文件位置:{}", file.getPath()); File file1 = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_SERVICE_IMPL + modelNameUpperCamel + "ServiceImpl.java"); if (!file1.getParentFile().exists()) { @@ -423,7 +421,7 @@ public class CodeGenerator { } cfg.getTemplate("service-impl.ftl").process(data, new FileWriter(file1)); - log.info(modelNameUpperCamel + "ServiceImpl.java 生成成功"); + log.info(modelNameUpperCamel + "ServiceImpl.java 生成成功,文件位置:{}", file1.getPath()); } catch (Exception e) { throw new RuntimeException("生成Service失败", e); } diff --git a/common/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java b/common/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java index 0db5d9d..65c49b0 100644 --- a/common/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java +++ b/common/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.io.Writer; import java.nio.file.Files; import java.sql.Connection; -import java.sql.DriverManager; /** * 代码生成器工具类 @@ -26,27 +25,13 @@ public class FreeMarkerGeneratorUtil { /** * 仅生成dao层 - * @param driver - * @param url - * @param user - * @param pwd + * @param con * @param tableName * @param modelName * @param basePackage */ - public static void generatorMvcCode(String driver, String url, String user, String pwd, String tableName, + public static void generatorMvcCode(Connection con, String tableName, String modelName, String basePackage) { - - Connection con = null; - //注册驱动 - try { - Class.forName(driver); - con = DriverManager.getConnection(url, user, pwd); - } catch (Exception e) { - log.error("获取数据连接失败,{}", e.getMessage()); - return; - } - //获取模板路径 String templatePath = CodeGenerator.TEMPLATE_FILE_PATH; //log.info("当前模板路径为:{}", templatePath); @@ -130,6 +115,6 @@ public class FreeMarkerGeneratorUtil { //填充数据模型 template.process(dataModel, writer); writer.close(); - log.info("代码生成成功,文件位置:{}",file); + log.info("{} 生成成功,文件位置:{}", targetFile.getName(), targetFile.getPath()); } } \ No newline at end of file diff --git a/common/src/main/java/com/simon/common/utils/DbUtil.java b/common/src/main/java/com/simon/common/utils/DbUtil.java index d5cd912..0a57335 100644 --- a/common/src/main/java/com/simon/common/utils/DbUtil.java +++ b/common/src/main/java/com/simon/common/utils/DbUtil.java @@ -340,6 +340,7 @@ public class DbUtil { rs = ps.executeQuery(); List columns = new ArrayList<>(); + int index = 0; while (rs.next()) { Column col = new Column(); String name = rs.getString("column_name"); @@ -371,46 +372,61 @@ public class DbUtil { if ("id".equalsIgnoreCase(name)) { if ("Long".equalsIgnoreCase(propertyType)) { //fastjson转换成map时,将Long转换成String,保证前端不丢失精度 - annotation = "@JSONField(serializeUsing = ToStringSerializer.class)\n" + + annotation = "@ExcelColumn(title = \"id\", index = " + index + ", convertToString = true)\n" + + " @JSONField(serializeUsing = ToStringSerializer.class)\n" + " @Id\n" + " @Column(name = \"id\")\n" + " @KeySql(genId = SnowflakeGenId.class)\n" + " @GeneratedValue(generator = \"sequenceId\")\n" + " @GenericGenerator(name = \"sequenceId\", strategy = \"" + CodeGenerator.BASE_PACKAGE + ".common.utils.snowflake.SequenceId\")"; } else if ("String".equalsIgnoreCase(propertyType)) { - annotation = "@Id\n" + + annotation = "@ExcelColumn(title = \"id\", index = " + index + ")\n" + + " @Id\n" + " @Column(name = \"id\")\n" + " @KeySql(genId = UUIdGenId.class)\n" + " @GeneratedValue(generator = \"uuid\")\n" + " @GenericGenerator(name = \"uuid\", strategy = \"" + CodeGenerator.BASE_PACKAGE + ".common.utils.UuidGenerator\")"; } else if ("Integer".equalsIgnoreCase(propertyType)) { - annotation = "@Id\n" + + annotation = "@ExcelColumn(title = \"id\", index = " + index + ")\n" + + " @Id\n" + " @Column(name = \"id\")\n" + " @GeneratedValue(strategy = GenerationType.IDENTITY)"; } else { - annotation = "@Id\n" + + annotation = "@ExcelColumn(title = \"id\", index = " + index + ")\n" + + " @Id\n" + " @Column(name = \"id\")\n" + " @GeneratedValue(strategy = GenerationType.IDENTITY)"; } } else { if ("Date".equalsIgnoreCase(propertyType)) { - annotation = "@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DATETIME, timezone = AppConfig.DATE_TIMEZONE)\n" + + annotation = "@ExcelColumn(title = \"" + comment + "\", index = " + index + ", dateFormatPattern = AppConfig.DATE_PATTERN_DATETIME)\n" + + " @DateTimeFormat(pattern = AppConfig.DATE_PATTERN_TIME)\n" + + " @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DATETIME, timezone = AppConfig.DATE_TIMEZONE)\n" + " @JSONField(format = AppConfig.DATE_PATTERN_DATETIME)\n"; } else if ("Long".equalsIgnoreCase(propertyType)) { //fastjson转换成map时,将Long转换成String,保证前端不丢失精度 - annotation = "@JSONField(serializeUsing = ToStringSerializer.class)\n"; + annotation = "@ExcelColumn(title = \"" + comment + "\", index = " + index + ", convertToString = true)\n" + + " @JSONField(serializeUsing = ToStringSerializer.class)\n"; } else if ("LocalDateTime".equalsIgnoreCase(propertyType)) { - annotation = "@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DATETIME, timezone = AppConfig.DATE_TIMEZONE)\n" + + annotation = "@ExcelColumn(title = \"" + comment + "\", index = " + index + ", dateFormatPattern = AppConfig.DATE_PATTERN_DATETIME)\n" + + " @DateTimeFormat(pattern = AppConfig.DATE_PATTERN_DATETIME)\n" + + " @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DATETIME, timezone = AppConfig.DATE_TIMEZONE)\n" + " @JSONField(format = AppConfig.DATE_PATTERN_DATETIME)\n"; } else if ("LocalDate".equalsIgnoreCase(propertyType)) { - annotation = "@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DAY, timezone = AppConfig.DATE_TIMEZONE)\n" + + annotation = "@ExcelColumn(title = \"" + comment + "\", index = " + index + ", dateFormatPattern = AppConfig.DATE_PATTERN_DAY)\n" + + " @DateTimeFormat(pattern = AppConfig.DATE_PATTERN_DAY)\n" + + " @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DAY, timezone = AppConfig.DATE_TIMEZONE)\n" + " @JSONField(format = AppConfig.DATE_PATTERN_DAY)\n"; } else if ("LocalTime".equalsIgnoreCase(propertyType)) { - annotation = "@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_TIME, timezone = AppConfig.DATE_TIMEZONE)\n" + + annotation = "@ExcelColumn(title = \"" + comment + "\", index = " + index + ", dateFormatPattern = AppConfig.DATE_PATTERN_TIME)\n" + + " @DateTimeFormat(pattern = AppConfig.DATE_PATTERN_TIME)\n" + + " @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_TIME, timezone = AppConfig.DATE_TIMEZONE)\n" + " @JSONField(format = AppConfig.DATE_PATTERN_TIME)\n"; + } else { + annotation = "@ExcelColumn(title = \"" + comment + "\", index = " + index + ")\n"; } - if (!"".equals(annotation)) { + if (StringUtils.isNotEmpty(annotation)) { annotation += " "; } @@ -452,7 +468,9 @@ public class DbUtil { col.setAnnotation(annotation); col.setComment(comment); columns.add(col); - } + + index++; + }//while dataModel.setBasePackage(basePackage); //dataModel.setEntityPackage(basePackage); diff --git a/common/src/main/resources/templates/code/entity.ftl b/common/src/main/resources/templates/code/entity.ftl index cc5c2a6..3e3207b 100644 --- a/common/src/main/resources/templates/code/entity.ftl +++ b/common/src/main/resources/templates/code/entity.ftl @@ -3,12 +3,17 @@ package ${basePackage}.model; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.serializer.ToStringSerializer; import com.fasterxml.jackson.annotation.JsonFormat; +import com.github.liaochong.myexcel.core.WorkbookType; +import com.github.liaochong.myexcel.core.annotation.ExcelColumn; +import com.github.liaochong.myexcel.core.annotation.ExcelTable; +import com.github.liaochong.myexcel.core.annotation.ExcludeColumn; import ${basePackage}.common.config.AppConfig; import ${basePackage}.common.utils.UUIdGenId; import ${basePackage}.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.hibernate.annotations.GenericGenerator; +import org.springframework.format.annotation.DateTimeFormat; import tk.mybatis.mapper.annotation.KeySql; import lombok.Data; @@ -26,12 +31,14 @@ import java.time.LocalDateTime; * @author ${AUTHOR} * @date ${CREATE} **/ +@ExcelTable(sheetName = "${tableComment}", workbookType = WorkbookType.SXLSX, rowAccessWindowSize = 100, useFieldNameAsTitle = true) @ApiModel(description = "${tableComment}") @Data @EqualsAndHashCode(callSuper = false) @Entity @Table(name="${tableName}") -public class ${entityName} implements Serializable{ +public class ${entityName} implements Serializable { + @ExcludeColumn private static final long serialVersionUID = 1L; <#list columns as column> @@ -39,10 +46,12 @@ public class ${entityName} implements Serializable{ private ${column.type} ${column.name}; + @ExcludeColumn @ApiModelProperty(value = "创建人名称") @Transient private String createUser; + @ExcludeColumn @ApiModelProperty(value = "更新人名称") @Transient private String updateUser; diff --git a/web/src/main/resources/templates/code/entity.ftl b/web/src/main/resources/templates/code/entity.ftl index cc5c2a6..3e3207b 100644 --- a/web/src/main/resources/templates/code/entity.ftl +++ b/web/src/main/resources/templates/code/entity.ftl @@ -3,12 +3,17 @@ package ${basePackage}.model; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.serializer.ToStringSerializer; import com.fasterxml.jackson.annotation.JsonFormat; +import com.github.liaochong.myexcel.core.WorkbookType; +import com.github.liaochong.myexcel.core.annotation.ExcelColumn; +import com.github.liaochong.myexcel.core.annotation.ExcelTable; +import com.github.liaochong.myexcel.core.annotation.ExcludeColumn; import ${basePackage}.common.config.AppConfig; import ${basePackage}.common.utils.UUIdGenId; import ${basePackage}.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.hibernate.annotations.GenericGenerator; +import org.springframework.format.annotation.DateTimeFormat; import tk.mybatis.mapper.annotation.KeySql; import lombok.Data; @@ -26,12 +31,14 @@ import java.time.LocalDateTime; * @author ${AUTHOR} * @date ${CREATE} **/ +@ExcelTable(sheetName = "${tableComment}", workbookType = WorkbookType.SXLSX, rowAccessWindowSize = 100, useFieldNameAsTitle = true) @ApiModel(description = "${tableComment}") @Data @EqualsAndHashCode(callSuper = false) @Entity @Table(name="${tableName}") -public class ${entityName} implements Serializable{ +public class ${entityName} implements Serializable { + @ExcludeColumn private static final long serialVersionUID = 1L; <#list columns as column> @@ -39,10 +46,12 @@ public class ${entityName} implements Serializable{ private ${column.type} ${column.name}; + @ExcludeColumn @ApiModelProperty(value = "创建人名称") @Transient private String createUser; + @ExcludeColumn @ApiModelProperty(value = "更新人名称") @Transient private String updateUser; -- Gitee From aef8793db1b86743a5a3420adecff354d6544615 Mon Sep 17 00:00:00 2001 From: jeesun Date: Mon, 17 Jun 2019 16:20:16 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 29 +++++++++++------------------ tutorial/CHANGE_LOG.md | 17 +++++++++++++++++ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9635cac..b96c879 100644 --- a/README.md +++ b/README.md @@ -51,32 +51,25 @@ oauthserver是一个基于Spring Boot Oauth2的完整的独立的Oauth2 Server 4. 日志管理 ## 更新日志 +### 2.0.20190617-alpha +1. 更新代码生成器生成的entity模板,添加excel导入导出注解; +2. 升级myexcel 2.5.0->2.5.1,升级element-ui 2.7.2->2.9.1; +3. 菜单管理页面优化; +4. 修复quartzJob form label过长换行bug; +5. 图标管理页面国际化bug修复; +6. 修复一些国际化细节bug。 + ### 2.0.20190613-alpha 1. 重写导入导出功能; 2. 删除无用页面代码; -3. 一些细节。 +3. 图标选择框bug修复; +4. 重命名表t_s_font_awesome的部分字段; +5. 一些细节。 ### 2.0.20190521-alpha 1. 更新角色管理页面; 2. 解决角色已拥有页面权限,页面依然不显示的bug,需要重新保存一次权限。 -### 2.0.20190517-alpha -1. 修复quartz定时任务bug; -2. 移除api模块的代码生成器,统一使用web模块的生成器,代码生成器位置允许选择common模块; -3. 省市区信息添加缓存; -4. 重写home页面; -5. 使用java8时间类型代替Date类型,并解决序列化问题; -6. 合并model、service、serviceImpl、repository、mapper到common模块; -7. 增加登录失败原因提示; -8. Spring Boot 1.5.20->1.5.21; -9. 动态计算iframe高度; -10. 其他bug修复。 - -### 2.0.20190506-alpha -1. 新增了很多功能; -2. 修复了很多bug; -3. 管理端页面重构,使用Vue + Element UI代替JQuery + EasyUI。 - **更多历史更新日志查看[CHANGE_LOG.md](tutorial/CHANGE_LOG.md)** ## 使用流程 diff --git a/tutorial/CHANGE_LOG.md b/tutorial/CHANGE_LOG.md index 317faaa..252941e 100644 --- a/tutorial/CHANGE_LOG.md +++ b/tutorial/CHANGE_LOG.md @@ -1,3 +1,20 @@ +### 2.0.20190517-alpha +1. 修复quartz定时任务bug; +2. 移除api模块的代码生成器,统一使用web模块的生成器,代码生成器位置允许选择common模块; +3. 省市区信息添加缓存; +4. 重写home页面; +5. 使用java8时间类型代替Date类型,并解决序列化问题; +6. 合并model、service、serviceImpl、repository、mapper到common模块; +7. 增加登录失败原因提示; +8. Spring Boot 1.5.20->1.5.21; +9. 动态计算iframe高度; +10. 其他bug修复。 + +### 2.0.20190506-alpha +1. 新增了很多功能; +2. 修复了很多bug; +3. 管理端页面重构,使用Vue + Element UI代替JQuery + EasyUI。 + ### 1.3.0-4 alpha(2019-02-20) 1. 支持PostgreSQL。 ### 1.3.0-3 alpha(2019-01-24) -- Gitee