@Override
    public boolean modelExampleClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        List<InnerClass> innerClasses = topLevelClass.getInnerClasses();
        for (int i = 0; i < innerClasses.size(); i++) {
            InnerClass innerClass = innerClasses.get(i);
            if ("Criteria".equals(innerClass.getType().getShortName())) {
                // 工厂方法
                addFactoryMethodToCriteria(topLevelClass, innerClass, introspectedTable);
                // andIf
                if (this.enableAndIf) {
                    addAndIfMethodToCriteria(topLevelClass, innerClass, introspectedTable);
                }
                // when
                addWhenToCriteria(topLevelClass, innerClass, introspectedTable);
            } else if ("GeneratedCriteria".equals(innerClass.getType().getShortName())) {
                // column 方法
                if (this.enableColumnOperate) {
                    addColumnMethodToCriteria(topLevelClass, innerClass, introspectedTable);
                }
            }
        }

        List<Method> methods = topLevelClass.getMethods();
        for (Method method : methods) {
            if (!"createCriteriaInternal".equals(method.getName())) {
                continue;
            } else {
                method.getBodyLines().set(0, "Criteria criteria = new Criteria(this);");
                logger.debug("itfsw(Example增强插件):" + topLevelClass.getType().getShortName() + "修改createCriteriaInternal方法，修改构造Criteria时传入Example对象");
            }
        }

        // orderBy方法
        this.addOrderByMethodToExample(topLevelClass, introspectedTable);

        // createCriteria 静态方法
        this.addStaticCreateCriteriaMethodToExample(topLevelClass, introspectedTable);

        // when
        addWhenToExample(topLevelClass, introspectedTable);

        return true;
    }
@Override
    public boolean modelExampleClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        List<InnerClass> innerClasses = topLevelClass.getInnerClasses();
        for (int i = 0; i < innerClasses.size(); i++) {
            InnerClass innerClass = innerClasses.get(i);
            if ("Criteria".equals(innerClass.getType().getShortName())) {
                
                addFactoryMethodToCriteria(topLevelClass, innerClass, introspectedTable);
                
                if (this.enableAndIf) {
                    addAndIfMethodToCriteria(topLevelClass, innerClass, introspectedTable);
                }
                
                addWhenToCriteria(topLevelClass, innerClass, introspectedTable);
            } else if ("GeneratedCriteria".equals(innerClass.getType().getShortName())) {
                
                if (this.enableColumnOperate) {
                    addColumnMethodToCriteria(topLevelClass, innerClass, introspectedTable);
                }
            }
        }

        List<Method> methods = topLevelClass.getMethods();
        for (Method method : methods) {
            if (!"createCriteriaInternal".equals(method.getName())) {
                continue;
            } else {
                method.getBodyLines().set(0, "Criteria criteria = new Criteria(this);");
                logger.debug("itfsw(Example增强插件):" + topLevelClass.getType().getShortName() + "修改createCriteriaInternal方法，修改构造Criteria时传入Example对象");
            }
        }

        
        this.addOrderByMethodToExample(topLevelClass, introspectedTable);

        
        this.addStaticCreateCriteriaMethodToExample(topLevelClass, introspectedTable);

        
        addWhenToExample(topLevelClass, introspectedTable);

        return true;
    }
@ Override public boolean modelExampleClassGenerated ( TopLevelClass topLevelClass , IntrospectedTable introspectedTable ) { List < InnerClass > innerClasses = topLevelClass . getInnerClasses ( ) ; for ( int i = 0 ; i < innerClasses . size ( ) ; i ++ ) { InnerClass innerClass = innerClasses . get ( i ) ; if ( "Criteria" . equals ( innerClass . getType ( ) . getShortName ( ) ) ) { // 工厂方法 addFactoryMethodToCriteria ( topLevelClass , innerClass , introspectedTable ) ; // andIf if ( this . enableAndIf ) { addAndIfMethodToCriteria ( topLevelClass , innerClass , introspectedTable ) ; } // when addWhenToCriteria ( topLevelClass , innerClass , introspectedTable ) ; } else if ( "GeneratedCriteria" . equals ( innerClass . getType ( ) . getShortName ( ) ) ) { // column 方法 if ( this . enableColumnOperate ) { addColumnMethodToCriteria ( topLevelClass , innerClass , introspectedTable ) ; } } } List < Method > methods = topLevelClass . getMethods ( ) ; for ( Method method : methods ) { if ( ! "createCriteriaInternal" . equals ( method . getName ( ) ) ) { continue ; } else { method . getBodyLines ( ) . set ( 0 , "Criteria criteria = new Criteria(this);" ) ; logger . debug ( "itfsw(Example增强插件):" + topLe e Class.getType ( ).getSh o r t Name() + "修改 c r a eCriteriaInternal方法，修改构造Criteria时传入Example对象"); } } // orderBy方法 this . addOrderByMethodToExample ( topLevelClass , introspectedTable ) ; // createCriteria 静态方法 this . addStaticCreateCriteriaMethodToExample ( topLevelClass , introspectedTable ) ; // when addWhenToExample ( topLevelClass , introspectedTable ) ; return true ; }
ModelExample Methods 生成
具体执行顺序 http://www.mybatis.org/generator/reference/pluggingIn.html
@param topLevelClass
@param introspectedTable
@return
ModelExample Methods 生成 具体执行顺序 http : // www . mybatis . org / generator / reference / pluggingIn . html