// Path: src/main/java/com/itfsw/mybatis/generator/plugins/utils/enhanced/SpecTypeArgumentsFullyQualifiedJavaType.java
// public class SpecTypeArgumentsFullyQualifiedJavaType extends FullyQualifiedJavaType {
//     private String fullTypeSpecification;
//     /**
//      * Use this constructor to construct a generic type with the specified type parameters.
//      * @param fullTypeSpecification the full type specification
//      */
//     public SpecTypeArgumentsFullyQualifiedJavaType(String fullTypeSpecification) {
//         super("");
// 
//         this.fullTypeSpecification = fullTypeSpecification;
//     }
// 
//     @Override
//     public String getShortName() {
//         return this.fullTypeSpecification.substring(1, this.fullTypeSpecification.length() - 1);
//     }
// }
// 
// Path: src/main/java/com/itfsw/mybatis/generator/plugins/utils/hook/IIncrementsPluginHook.java
// public interface IIncrementsPluginHook {
//     /**
//      * 生成增量操作节点
//      * @param introspectedColumn
//      * @param prefix
//      * @param hasComma
//      * @return
//      */
//     List<Element> incrementSetElementGenerated(IntrospectedColumn introspectedColumn, String prefix, boolean hasComma);
// 
//     /**
//      * 生成增量操作节点(SelectiveEnhancedPlugin)
//      * @param columns
//      * @return
//      */
//     List<XmlElement> incrementSetsWithSelectiveEnhancedPluginElementGenerated(List<IntrospectedColumn> columns);
// 
//     /**
//      * 是否支持increment
//      * @param column
//      * @return
//      */
//     boolean supportIncrement(IntrospectedColumn column);
// }
// 
// Path: src/main/java/com/itfsw/mybatis/generator/plugins/utils/hook/ILombokPluginHook.java
// public interface ILombokPluginHook {
//     /**
//      * Model builder class 生成
//      * @param topLevelClass
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelBaseRecordBuilderClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable);
// 
//     /**
//      * Model builder class 生成
//      * @param topLevelClass
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelPrimaryKeyBuilderClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable);
// 
//     /**
//      * Model builder class 生成
//      * @param topLevelClass
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelRecordWithBLOBsBuilderClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable);
// }
// 
// Path: src/main/java/com/itfsw/mybatis/generator/plugins/utils/hook/IModelBuilderPluginHook.java
// public interface IModelBuilderPluginHook {
//     /**
//      * Model builder class 生成
//      * @param topLevelClass
//      * @param builderClass
//      * @param columns
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelBuilderClassGenerated(TopLevelClass topLevelClass, InnerClass builderClass, List<IntrospectedColumn> columns, IntrospectedTable introspectedTable);
// 
//     /**
//      * Model builder set 方法生成
//      * @param method
//      * @param topLevelClass
//      * @param builderClass
//      * @param introspectedColumn
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelBuilderSetterMethodGenerated(Method method, TopLevelClass topLevelClass, InnerClass builderClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable);
// }


import org.mybatis.generator.internal.util.StringUtility;
import java.util.ArrayList;
import java.util.List;
import com.itfsw.mybatis.generator.plugins.utils.*;
import com.itfsw.mybatis.generator.plugins.utils.enhanced.SpecTypeArgumentsFullyQualifiedJavaType;
import com.itfsw.mybatis.generator.plugins.utils.hook.IIncrementsPluginHook;
import com.itfsw.mybatis.generator.plugins.utils.hook.ILombokPluginHook;
import com.itfsw.mybatis.generator.plugins.utils.hook.IModelBuilderPluginHook;
import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.java.*;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.Element;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.codegen.mybatis3.MyBatis3FormattingUtilities;
import org.mybatis.generator.internal.util.JavaBeansUtil;
                InnerClass builderImplCls = new InnerClass(topLevelClass.getType().getShortName() + "BuilderImpl");
                commentGenerator.addClassComment(builderImplCls, introspectedTable);
                FullyQualifiedJavaType builderType1 = new FullyQualifiedJavaType(topLevelClass.getType().getShortName() + "." + topLevelClass.getType().getShortName() + "Builder");
                builderType1.addTypeArgument(new SpecTypeArgumentsFullyQualifiedJavaType(
                        "<" + topLevelClass.getType().getShortName() + ", " + topLevelClass.getType().getShortName() + "." + topLevelClass.getType().getShortName() + "BuilderImpl" + ">"
                ));
                builderImplCls.setSuperClass(builderType1);
                builderImplCls.setVisibility(JavaVisibility.PRIVATE);
                builderImplCls.setFinal(true);
                builderImplCls.setStatic(true);

                topLevelClass.addInnerClass(builderImplCls);

                // self 方法
                Method selfMethod = JavaElementGeneratorTools.generateMethod(
                        "self",
                        JavaVisibility.PROTECTED,
                        new FullyQualifiedJavaType(topLevelClass.getType().getShortName() + "." + topLevelClass.getType().getShortName() + "BuilderImpl")
                );
                commentGenerator.addGeneralMethodComment(selfMethod, introspectedTable);
                selfMethod.addBodyLine("return this;");
                FormatTools.addMethodWithBestPosition(builderImplCls, selfMethod);

                // build 方法
                Method buildMethod = JavaElementGeneratorTools.generateMethod(
                        "build",
                        JavaVisibility.PUBLIC,
                        topLevelClass.getType()
                );
                commentGenerator.addGeneralMethodComment(buildMethod, introspectedTable);
// Path: src/main/java/com/itfsw/mybatis/generator/plugins/utils/enhanced/SpecTypeArgumentsFullyQualifiedJavaType.java
// public class SpecTypeArgumentsFullyQualifiedJavaType extends FullyQualifiedJavaType {
//     private String fullTypeSpecification;
//     /**
//      * Use this constructor to construct a generic type with the specified type parameters.
//      * @param fullTypeSpecification the full type specification
//      */
//     public SpecTypeArgumentsFullyQualifiedJavaType(String fullTypeSpecification) {
//         super("");
// 
//         this.fullTypeSpecification = fullTypeSpecification;
//     }
// 
//     @Override
//     public String getShortName() {
//         return this.fullTypeSpecification.substring(1, this.fullTypeSpecification.length() - 1);
//     }
// }
// 
// Path: src/main/java/com/itfsw/mybatis/generator/plugins/utils/hook/IIncrementsPluginHook.java
// public interface IIncrementsPluginHook {
//     /**
//      * 生成增量操作节点
//      * @param introspectedColumn
//      * @param prefix
//      * @param hasComma
//      * @return
//      */
//     List<Element> incrementSetElementGenerated(IntrospectedColumn introspectedColumn, String prefix, boolean hasComma);
// 
//     /**
//      * 生成增量操作节点(SelectiveEnhancedPlugin)
//      * @param columns
//      * @return
//      */
//     List<XmlElement> incrementSetsWithSelectiveEnhancedPluginElementGenerated(List<IntrospectedColumn> columns);
// 
//     /**
//      * 是否支持increment
//      * @param column
//      * @return
//      */
//     boolean supportIncrement(IntrospectedColumn column);
// }
// 
// Path: src/main/java/com/itfsw/mybatis/generator/plugins/utils/hook/ILombokPluginHook.java
// public interface ILombokPluginHook {
//     /**
//      * Model builder class 生成
//      * @param topLevelClass
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelBaseRecordBuilderClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable);
// 
//     /**
//      * Model builder class 生成
//      * @param topLevelClass
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelPrimaryKeyBuilderClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable);
// 
//     /**
//      * Model builder class 生成
//      * @param topLevelClass
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelRecordWithBLOBsBuilderClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable);
// }
// 
// Path: src/main/java/com/itfsw/mybatis/generator/plugins/utils/hook/IModelBuilderPluginHook.java
// public interface IModelBuilderPluginHook {
//     /**
//      * Model builder class 生成
//      * @param topLevelClass
//      * @param builderClass
//      * @param columns
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelBuilderClassGenerated(TopLevelClass topLevelClass, InnerClass builderClass, List<IntrospectedColumn> columns, IntrospectedTable introspectedTable);
// 
//     /**
//      * Model builder set 方法生成
//      * @param method
//      * @param topLevelClass
//      * @param builderClass
//      * @param introspectedColumn
//      * @param introspectedTable
//      * @return
//      */
//     boolean modelBuilderSetterMethodGenerated(Method method, TopLevelClass topLevelClass, InnerClass builderClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable);
// }


// Path: src/main/java/com/itfsw/mybatis/generator/plugins/IncrementsPlugin.java
import org.mybatis.generator.internal.util.StringUtility;
import java.util.ArrayList;
import java.util.List;
import com.itfsw.mybatis.generator.plugins.utils.*;
import com.itfsw.mybatis.generator.plugins.utils.enhanced.SpecTypeArgumentsFullyQualifiedJavaType;
import com.itfsw.mybatis.generator.plugins.utils.hook.IIncrementsPluginHook;
import com.itfsw.mybatis.generator.plugins.utils.hook.ILombokPluginHook;
import com.itfsw.mybatis.generator.plugins.utils.hook.IModelBuilderPluginHook;
import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.java.*;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.Element;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.codegen.mybatis3.MyBatis3FormattingUtilities;
import org.mybatis.generator.internal.util.JavaBeansUtil;

                InnerClass builderImplCls = new InnerClass(topLevelClass.getType().getShortName() + "BuilderImpl");
                commentGenerator.addClassComment(builderImplCls, introspectedTable);
                FullyQualifiedJavaType builderType1 = new FullyQualifiedJavaType(topLevelClass.getType().getShortName() + "." + topLevelClass.getType().getShortName() + "Builder");
                builderType1.addTypeArgument(new SpecTypeArgumentsFullyQualifiedJavaType(
                        "<" + topLevelClass.getType().getShortName() + ", " + topLevelClass.getType().getShortName() + "." + topLevelClass.getType().getShortName() + "BuilderImpl" + ">"
                ));
                builderImplCls.setSuperClass(builderType1);
                builderImplCls.setVisibility(JavaVisibility.PRIVATE);
                builderImplCls.setFinal(true);
                builderImplCls.setStatic(true);

                topLevelClass.addInnerClass(builderImplCls);

                // self 方法
                Method selfMethod = JavaElementGeneratorTools.generateMethod(
                        "self",
                        JavaVisibility.PROTECTED,
                        new FullyQualifiedJavaType(topLevelClass.getType().getShortName() + "." + topLevelClass.getType().getShortName() + "BuilderImpl")
                );
                commentGenerator.addGeneralMethodComment(selfMethod, introspectedTable);
                selfMethod.addBodyLine("return this;");
                FormatTools.addMethodWithBestPosition(builderImplCls, selfMethod);

                // build 方法
                Method buildMethod = JavaElementGeneratorTools.generateMethod(
                        "build",
                        JavaVisibility.PUBLIC,
                        topLevelClass.getType()
                );
                commentGenerator.addGeneralMethodComment(buildMethod, introspectedTable);
                buildMethod.addBodyLine("return new " + topLevelClass.getType().getShortName() + "(this);");