From 049e54d023107bc8d138f5aba65f058040de6a53 Mon Sep 17 00:00:00 2001 From: yulichang <570810310@qq.com> Date: Sun, 21 Jul 2024 21:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/yulichang/processor/EntityProcessor.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugin/mybatis-plus-join-processor/src/main/java/com/github/yulichang/processor/EntityProcessor.java b/plugin/mybatis-plus-join-processor/src/main/java/com/github/yulichang/processor/EntityProcessor.java index 4dbd932..0ad26c2 100644 --- a/plugin/mybatis-plus-join-processor/src/main/java/com/github/yulichang/processor/EntityProcessor.java +++ b/plugin/mybatis-plus-join-processor/src/main/java/com/github/yulichang/processor/EntityProcessor.java @@ -127,6 +127,7 @@ public class EntityProcessor extends AbstractProcessor { .addConstructor(tableInfo) .addFields(tableInfo) .addMethod(tableInfo) + .addBuild(tableInfo) ); writerFile(tableInfo.getTagClassPackage() + "." + tableInfo.getTagClassName(), content.getContent()); return tableInfo; @@ -248,6 +249,18 @@ public class EntityProcessor extends AbstractProcessor { return this; } + public StringBuilderHelper addBuild(TableInfo tableInfo) { + sb.append("\tpublic static ").append(tableInfo.getTagClassName()).append(" build() {\n") + .append("\t\treturn new ").append(tableInfo.getTagClassName()).append("();\n") + .append("\t}\n"); + newLine(); + sb.append("\tpublic static ").append(tableInfo.getTagClassName()).append(" build(String alias) {\n") + .append("\t\treturn new ").append(tableInfo.getTagClassName()).append("(alias);\n") + .append("\t}\n"); + newLine(); + return this; + } + private StringBuilderHelper addComment(String prefix, String comment) { if (StringUtil.isNotEmpty(comment)) { sb.append(prefix).append("/**\n");