public static String[] replaceEqualNullWithIsNull(String fieldName, String... sqlFragments) {
        String namedParam = "{" + fieldName + "}";
        for (int i = 0; i < sqlFragments.length; i++) {
            String fragment = sqlFragments[i];
            String equalNull = findEqualNamedParamPattern(fragment, namedParam);
            while (equalNull != null) {
                fragment = fragment.replaceAll(equalNull, " is null");//注意这里is null 前面的空格，很重要
                sqlFragments[i] = fragment;
                equalNull = findEqualNamedParamPattern(fragment, namedParam);
            }
        }
        return sqlFragments;
    }
public static String [ ] replaceEqualNullWithIsNull ( String fieldName , String ... sqlFragments ) { String namedParam = "{" + fieldName + "}" ; for ( int i = 0 ; i < sqlFragments . length ; i ++ ) { String fragment = sqlFragments [ i ] ; String equalNull = findEqualNamedParamPattern ( fragment , namedParam ) ; while ( equalNull != null ) { fragment = fragment . replaceAll ( equalNull , " is null" ) ; sqlFragments [ i ] = fragment ; equalNull = findEqualNamedParamPattern ( fragment , namedParam ) ; } } return sqlFragments ; }
将形如 xxx = {fieldName} 的语句全部转为 xxx is null
注意，该算法修改了数组参数sqlFragments内的数组元素