src/main/java/com/itfsw/mybatis/generator/plugins/IncrementsPlugin.java
private InnerEnum generatedIncEnum(IntrospectedTable introspectedTable) {
        // 增加枚举
        InnerEnum eIncrements = new InnerEnum(new FullyQualifiedJavaType("Inc"));
        eIncrements.setVisibility(JavaVisibility.PUBLIC);
        eIncrements.setStatic(true);
        eIncrements.addEnumConstant("INC(\"+\")");
        eIncrements.addEnumConstant("DEC(\"-\")");
        commentGenerator.addEnumComment(eIncrements, introspectedTable);
        // 生成属性和构造函数
        Field fValue = new Field("value", FullyQualifiedJavaType.getStringInstance());
        fValue.setVisibility(JavaVisibility.PRIVATE);
        fValue.setFinal(true);
        commentGenerator.addFieldComment(fValue, introspectedTable);
        eIncrements.addField(fValue);

        Method mInc = new Method("Inc");
        mInc.setConstructor(true);
        mInc.addBodyLine("this.value = value;");
        mInc.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "value"));
        commentGenerator.addGeneralMethodComment(mInc, introspectedTable);
        FormatTools.addMethodWithBestPosition(eIncrements, mInc);

        Method mValue = JavaElementGeneratorTools.generateGetterMethod(fValue);
        commentGenerator.addGeneralMethodComment(mValue, introspectedTable);
        FormatTools.addMethodWithBestPosition(eIncrements, mValue);

        return eIncrements;
    }
private InnerEnum generatedIncEnum(IntrospectedTable introspectedTable) {
        // 增加枚举
        InnerEnum eIncrements = new InnerEnum(new FullyQualifiedJavaType("Inc"));
        eIncrements.setVisibility(JavaVisibility.PUBLIC);
        eIncrements.setStatic(true);
        eIncrements.addEnumConstant("INC(\"+\")");
        eIncrements.addEnumConstant("DEC(\"-\")");
        commentGenerator.addEnumComment(eIncrements, introspectedTable);
        // 生成属性和构造函数
        Field fValue = new Field("value", FullyQualifiedJavaType.getStringInstance());
        fValue.setVisibility(JavaVisibility.PRIVATE);
        fValue.setFinal(true);
        commentGenerator.addFieldComment(fValue, introspectedTable);
        eIncrements.addField(fValue);

        Method mInc = new Method("Inc");
        mInc.setConstructor(true);
        mInc.addBodyLine("this.value = value;");
        mInc.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "value"));
        commentGenerator.addGeneralMethodComment(mInc, introspectedTable);
        FormatTools.addMethodWithBestPosition(eIncrements, mInc);

        Method mValue = JavaElementGeneratorTools.generateGetterMethod(fValue);
        commentGenerator.addGeneralMethodComment(mValue, introspectedTable);
        FormatTools.addMethodWithBestPosition(eIncrements, mValue);

        return eIncrements;
    }
private InnerEnum generatedIncEnum ( IntrospectedTable introspectedTable ) { // 增加枚举 InnerEnum eIncrements = new InnerEnum ( new FullyQualifiedJavaType ( "Inc" ) ) ; eIncrements . setVisibility ( JavaVisibility . PUBLIC ) ; eIncrements . setStatic ( true ) ; eIncrements . addEnumConstant ( "INC(\"+\")" ) ; eIncrements . addEnumConstant ( "DEC(\"-\")" ) ; commentGenerator . addEnumComment ( eIncrements , introspectedTable ) ; // 生成属性和构造函数 Field fValue = new Field ( "value" , FullyQualifiedJavaType . getStringInstance ( ) ) ; fValue . setVisibility ( JavaVisibility . PRIVATE ) ; fValue . setFinal ( true ) ; commentGenerator . addFieldComment ( fValue , introspectedTable ) ; eIncrements . addField ( fValue ) ; Method mInc = new Method ( "Inc" ) ; mInc . setConstructor ( true ) ; mInc . addBodyLine ( "this.value = value;" ) ; mInc . addParameter ( new Parameter ( FullyQualifiedJavaType . getStringInstance ( ) , "value" ) ) ; commentGenerator . addGeneralMethodComment ( mInc , introspectedTable ) ; FormatTools . addMethodWithBestPosition ( eIncrements , mInc ) ; Method mValue = JavaElementGeneratorTools . generateGetterMethod ( fValue ) ; commentGenerator . addGeneralMethodComment ( mValue , introspectedTable ) ; FormatTools . addMethodWithBestPosition ( eIncrements , mValue ) ; return eIncrements ; }
生成Inc enum
@param introspectedTable
@return
生成Inc enum