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");