private String sqlProcess(String originSql, Map<String, Object> params) {

        if (params == null || params.size() == 0)
            return originSql;

        String newSql = originSql;
        for (Entry<String, Object> entry : params.entrySet()) {
            String paramName = entry.getKey();
            Object paramObj = entry.getValue();

            if (paramObj.getClass().isArray()) {
                String inSqlExp = inSqlProcess(paramName, paramObj);
                newSql = newSql.replaceAll("@" + paramName, inSqlExp);
            }

            if (paramObj instanceof Collection) {
                Collection<?> collection = (Collection<?>) paramObj;
                Object[] paramVals = Lang.collection2array(collection);
                String inSqlExp = inSqlProcess(paramName, paramVals);
                newSql = newSql.replaceAll("@" + paramName, inSqlExp);
            }

        }

        return newSql;
    }
private String sqlProcess(String originSql, Map<String, Object> params) {

        if (params == null || params.size() == 0)
            return originSql;

        String newSql = originSql;
        for (Entry<String, Object> entry : params.entrySet()) {
            String paramName = entry.getKey();
            Object paramObj = entry.getValue();

            if (paramObj.getClass().isArray()) {
                String inSqlExp = inSqlProcess(paramName, paramObj);
                newSql = newSql.replaceAll("@" + paramName, inSqlExp);
            }

            if (paramObj instanceof Collection) {
                Collection<?> collection = (Collection<?>) paramObj;
                Object[] paramVals = Lang.collection2array(collection);
                String inSqlExp = inSqlProcess(paramName, paramVals);
                newSql = newSql.replaceAll("@" + paramName, inSqlExp);
            }

        }

        return newSql;
    }
private String sqlProcess ( String originSql , Map < String , Object > params ) { if ( params == null || params . size ( ) == 0 ) return originSql ; String newSql = originSql ; for ( Entry < String , Object > entry : params . entrySet ( ) ) { String paramName = entry . getKey ( ) ; Object paramObj = entry . getValue ( ) ; if ( paramObj . getClass ( ) . isArray ( ) ) { String inSqlExp = inSqlProcess ( paramName , paramObj ) ; newSql = newSql . replaceAll ( "@" + paramName , inSqlExp ) ; } if ( paramObj instanceof Collection ) { Collection < ? > collection = ( Collection < ? > ) paramObj ; Object [ ] paramVals = Lang . collection2array ( collection ) ; String inSqlExp = inSqlProcess ( paramName , paramVals ) ; newSql = newSql . replaceAll ( "@" + paramName , inSqlExp ) ; } } return newSql ; }
将Array Collection类型参数对应的sql占位符进行处理

@param originSql
原包含变量占位符的SQL
@param params
参数map，无参数时，可为null

@return 包含处理IN表达式的sql
将Array Collection类型参数对应的sql占位符进行处理