src/main/java/com/itfsw/mybatis/generator/plugins/utils/XmlElementGeneratorTools.java
public static void generateWhereByPrimaryKeyTo(XmlElement element, List<IntrospectedColumn> primaryKeyColumns, String prefix) {
        StringBuilder sb = new StringBuilder();
        boolean and = false;
        for (IntrospectedColumn introspectedColumn : primaryKeyColumns) {
            sb.setLength(0);
            if (and) {
                sb.append("  and ");
            } else {
                sb.append("where ");
                and = true;
            }

            sb.append(MyBatis3FormattingUtilities.getEscapedColumnName(introspectedColumn));
            sb.append(" = ");
            sb.append(MyBatis3FormattingUtilities.getParameterClause(introspectedColumn, prefix));
            element.addElement(new TextElement(sb.toString()));
        }
    }
public static void generateWhereByPrimaryKeyTo(XmlElement element, List<IntrospectedColumn> primaryKeyColumns, String prefix) {
        StringBuilder sb = new StringBuilder();
        boolean and = false;
        for (IntrospectedColumn introspectedColumn : primaryKeyColumns) {
            sb.setLength(0);
            if (and) {
                sb.append("  and ");
            } else {
                sb.append("where ");
                and = true;
            }

            sb.append(MyBatis3FormattingUtilities.getEscapedColumnName(introspectedColumn));
            sb.append(" = ");
            sb.append(MyBatis3FormattingUtilities.getParameterClause(introspectedColumn, prefix));
            element.addElement(new TextElement(sb.toString()));
        }
    }
public static void generateWhereByPrimaryKeyTo ( XmlElement element , List < IntrospectedColumn > primaryKeyColumns , String prefix ) { StringBuilder sb = new StringBuilder ( ) ; boolean and = false ; for ( IntrospectedColumn introspectedColumn : primaryKeyColumns ) { sb . setLength ( 0 ) ; if ( and ) { sb . append ( "  and " ) ; } else { sb . append ( "where " ) ; and = true ; } sb . append ( MyBatis3FormattingUtilities . getEscapedColumnName ( introspectedColumn ) ) ; sb . append ( " = " ) ; sb . append ( MyBatis3FormattingUtilities . getParameterClause ( introspectedColumn , prefix ) ) ; element . addElement ( new TextElement ( sb . toString ( ) ) ) ; } }
生成 xxxByPrimaryKey 的where 语句
@param element
@param primaryKeyColumns
@param prefix
@return
生成 xxxByPrimaryKey 的where 语句