private Method generateSingleValueMethod(IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn, String nameFragment, String operator) {
        // 方法名
        StringBuilder sb = new StringBuilder();
        sb.append(introspectedColumn.getJavaProperty());
        sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
        sb.insert(0, "and");
        sb.append(nameFragment);
        sb.append("Column");

        Method method = JavaElementGeneratorTools.generateMethod(
                sb.toString(),
                JavaVisibility.PUBLIC,
                FullyQualifiedJavaType.getCriteriaInstance(),
                new Parameter(
                        new FullyQualifiedJavaType(introspectedTable.getRules().calculateAllFieldsClass().getShortName() + "." + ModelColumnPlugin.ENUM_NAME),
                        "column"
                )
        );
        commentGenerator.addGeneralMethodComment(method, introspectedTable);

        // 方法体
        sb.setLength(0);
        sb.append("addCriterion(");
        sb.append("new StringBuilder(\"");
        sb.append(MyBatis3FormattingUtilities.getAliasedActualColumnName(introspectedColumn));
        sb.append(" ");
        sb.append(operator);
        sb.append(" \").append(");
        sb.append("column.");
        sb.append(ModelColumnPlugin.METHOD_GET_ESCAPED_COLUMN_NAME);
        sb.append("()).toString());");

        JavaElementGeneratorTools.generateMethodBody(
                method,
                sb.toString(),
                "return (Criteria) this;"
        );

        return method;
    }
private Method generateSingleValueMethod(IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn, String nameFragment, String operator) {
        
        StringBuilder sb = new StringBuilder();
        sb.append(introspectedColumn.getJavaProperty());
        sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
        sb.insert(0, "and");
        sb.append(nameFragment);
        sb.append("Column");

        Method method = JavaElementGeneratorTools.generateMethod(
                sb.toString(),
                JavaVisibility.PUBLIC,
                FullyQualifiedJavaType.getCriteriaInstance(),
                new Parameter(
                        new FullyQualifiedJavaType(introspectedTable.getRules().calculateAllFieldsClass().getShortName() + "." + ModelColumnPlugin.ENUM_NAME),
                        "column"
                )
        );
        commentGenerator.addGeneralMethodComment(method, introspectedTable);

        
        sb.setLength(0);
        sb.append("addCriterion(");
        sb.append("new StringBuilder(\"");
        sb.append(MyBatis3FormattingUtilities.getAliasedActualColumnName(introspectedColumn));
        sb.append(" ");
        sb.append(operator);
        sb.append(" \").append(");
        sb.append("column.");
        sb.append(ModelColumnPlugin.METHOD_GET_ESCAPED_COLUMN_NAME);
        sb.append("()).toString());");

        JavaElementGeneratorTools.generateMethodBody(
                method,
                sb.toString(),
                "return (Criteria) this;"
        );

        return method;
    }
private Method generateSingleValueMethod ( IntrospectedTable introspectedTable , IntrospectedColumn introspectedColumn , String nameFragment , String operator ) { // 方法名 StringBuilder sb = new StringBuilder ( ) ; sb . append ( introspectedColumn . getJavaProperty ( ) ) ; sb . setCharAt ( 0 , Character . toUpperCase ( sb . charAt ( 0 ) ) ) ; sb . insert ( 0 , "and" ) ; sb . append ( nameFragment ) ; sb . append ( "Column" ) ; Method method = JavaElementGeneratorTools . generateMethod ( sb . toString ( ) , JavaVisibility . PUBLIC , FullyQualifiedJavaType . getCriteriaInstance ( ) , new Parameter ( new FullyQualifiedJavaType ( introspectedTable . getRules ( ) . calculateAllFieldsClass ( ) . getShortName ( ) + "." + ModelColumnPlugin . ENUM_NAME ) , "column" ) ) ; commentGenerator . addGeneralMethodComment ( method , introspectedTable ) ; // 方法体 sb . setLength ( 0 ) ; sb . append ( "addCriterion(" ) ; sb . append ( "new StringBuilder(\"" ) ; sb . append ( MyBatis3FormattingUtilities . getAliasedActualColumnName ( introspectedColumn ) ) ; sb . append ( " " ) ; sb . append ( operator ) ; sb . append ( " \").append(" ) ; sb . append ( "column." ) ; sb . append ( ModelColumnPlugin . METHOD_GET_ESCAPED_COLUMN_NAME ) ; sb . append ( "()).toString());" ) ; JavaElementGeneratorTools . generateMethodBody ( method , sb . toString ( ) , "return (Criteria) this;" ) ; return method ; }
生成column操作的具体方法
@param introspectedTable
@param introspectedColumn
@param nameFragment
@param operator
@return
生成column操作的具体方法