From 86b8c47da3b0168b15dbb8a96984aad2f2fc6920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=BB=E8=8D=89=E4=BA=BA?= Date: Sat, 22 Apr 2023 10:44:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=E6=B3=A8=E9=87=8A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mybatisflex/codegen/entity/Table.java | 10 ++++++++++ .../src/main/resources/templates/enjoy/entity.tpl | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Table.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Table.java index a05fdf5f..847c035b 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Table.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Table.java @@ -154,6 +154,16 @@ public class Table { return imports.stream().sorted(Comparator.naturalOrder()).collect(Collectors.toList()); } + public String buildRemarks(){ + if (StringUtil.isBlank(remarks)){ + return ""; + }else { + StringBuilder sb = new StringBuilder("/**\n") + .append(" * ").append(remarks).append("\n") + .append(" */"); + return sb.toString(); + } + } /** * 构建 entity 的 Class 名称 diff --git a/mybatis-flex-codegen/src/main/resources/templates/enjoy/entity.tpl b/mybatis-flex-codegen/src/main/resources/templates/enjoy/entity.tpl index 2816dd43..ef2cd733 100644 --- a/mybatis-flex-codegen/src/main/resources/templates/enjoy/entity.tpl +++ b/mybatis-flex-codegen/src/main/resources/templates/enjoy/entity.tpl @@ -4,7 +4,7 @@ package #(globalConfig.entityPackage); import #(importClass); #end - +#(table.buildRemarks()) #(table.buildTableAnnotation()) public class #(table.buildEntityClassName())#(table.buildExtends())#(table.buildImplements()) { #for(column: table.columns)