@SuppressWarnings("SameParameterValue")
    protected final String formatSqlMaybeWithParam(String sqlStr, Object... params) {
        if (StringUtils.isBlank(sqlStr)) {
            return null;
        }
        if (ArrayUtils.isNotEmpty(params)) {
            for (int i = 0; i < params.length; ++i) {
                String target = Constants.LEFT_BRACE + i + Constants.RIGHT_BRACE;
                if (sqlStr.contains(target)) {
                    sqlStr = sqlStr.replace(target, formatParam(null, params[i]));
                } else {
                    Matcher matcher = Pattern.compile("[{]" + i + ",[a-zA-Z0-9.,=]+}").matcher(sqlStr);
                    if (!matcher.find()) {
                        throw ExceptionUtils.mpe("Please check the syntax correctness! sql not contains: \"%s\"", target);
                    }
                    String group = matcher.group();
                    sqlStr = sqlStr.replace(group, formatParam(group.substring(target.length(), group.length() - 1), params[i]));
                }
            }
        }
        return sqlStr;
    }
@Test
    void formatSqlMaybeWithParam() {
        QueryWrapper<Object> wrapper = new QueryWrapper<>();
        String s = wrapper.formatSqlMaybeWithParam("c={0}", 1);
        assertThat(s).isEqualTo("c=#{ew.paramNameValuePairs.MPGENVAL1}");

        s = wrapper.formatSqlMaybeWithParam("c={0,javaType=int}", 1);
        assertThat(s).isEqualTo("c=#{ew.paramNameValuePairs.MPGENVAL2,javaType=int}");

        s = wrapper.formatSqlMaybeWithParam("c={0,javaType=int} and b={1,jdbcType=NUMERIC} pp", 1, 2);
        assertThat(s).isEqualTo("c=#{ew.paramNameValuePairs.MPGENVAL3,javaType=int} " +
            "and b=#{ew.paramNameValuePairs.MPGENVAL4,jdbcType=NUMERIC} pp");

        s = wrapper.formatSqlMaybeWithParam("c={0,javaType=int,jdbcType=NUMERIC,typeHandler=xxx.xxx.MyTypeHandler} pp", 1);
        assertThat(s).isEqualTo("c=#{ew.paramNameValuePairs.MPGENVAL5,javaType=int,jdbcType=NUMERIC,typeHandler=xxx.xxx.MyTypeHandler} pp");

        Exception ex = null;
        try {
            wrapper.formatSqlMaybeWithParam("c={1} pp", 1);
        } catch (Exception e) {
            ex = e;
        }
        assertThat(ex).isNotNull();

        try {
            wrapper.formatSqlMaybeWithParam("c={1}", 1);
        } catch (Exception e) {
            ex = e;
        }
        assertThat(ex).isNotNull();
        System.out.println(ex.getMessage());
    }