@@ -2801,30 +2801,21 @@ protected String parseCombineExpression(RequestMethod method, String quote, Stri
28012801 throw new IllegalArgumentException (errPrefix + " 中字符 '" + s + "' 不合法!"
28022802 + "其中 key 数量 " + allCount + " 已超过最大值,必须在条件键值对数量 0-" + maxCombineCount + " 内!" );
28032803 }
2804-
2805- String column = key ;
2806- int keyIndex = column .indexOf (":" );
2807- column = keyIndex > 0 ? column .substring (0 , keyIndex ) : column ;
2808- Object value = conditionMap .get (column );
2809- String wi = "" ;
2810- if (value == null ) {
2811- isNot = false ; // 以默认表达式为准
2812- size ++; // 兼容 key 数量判断
2813- wi = keyIndex > 0 ? key .substring (keyIndex + 1 ) : "" ;
2814- if (StringUtil .isEmpty (wi )) {
2815- throw new IllegalArgumentException (errPrefix + " 中字符 '" + key
2816- + "' 对应的条件键值对 " + column + ":value 不存在!" );
2817- }
2818- } else {
2819- wi = isHaving ? getHavingItem (quote , table , alias , column , (String ) value , containRaw ) : getWhereItem (column , value , method , verifyName );
2820- }
2821-
28222804 if (1.0f *allCount /size > maxCombineRatio && maxCombineRatio > 0 ) {
28232805 throw new IllegalArgumentException (errPrefix + " 中字符 '" + s + "' 不合法!"
28242806 + "其中 key 数量 " + allCount + " / 条件键值对数量 " + size + " = " + (1.0f *allCount /size )
28252807 + " 已超过 最大倍数,必须在条件键值对数量 0-" + maxCombineRatio + " 倍内!" );
28262808 }
2827-
2809+
2810+ String column = key ;
2811+
2812+ Object value = conditionMap .get (column );
2813+ if (value == null ) {
2814+ throw new IllegalArgumentException (errPrefix + " 中字符 '" + key
2815+ + "' 对应的条件键值对 " + column + ":value 不存在!" );
2816+ }
2817+
2818+ String wi = isHaving ? getHavingItem (quote , table , alias , column , (String ) value , containRaw ) : getWhereItem (column , value , method , verifyName );
28282819 if (StringUtil .isEmpty (wi , true )) { // 转成 1=1 ?
28292820 throw new IllegalArgumentException (errPrefix + " 中字符 '" + key
28302821 + "' 对应的 " + column + ":value 不是有效条件键值对!" );
@@ -2837,6 +2828,7 @@ protected String parseCombineExpression(RequestMethod method, String quote, Stri
28372828 + "其中 '" + column + "' 重复引用,次数 " + count + " 已超过最大值,必须在 0-" + maxCombineKeyCount + " 内!" );
28382829 }
28392830 usedKeyCountMap .put (column , count );
2831+
28402832 result += "( " + getCondition (isNot , wi ) + " )" ;
28412833 isNot = false ;
28422834 first = false ;
@@ -5130,9 +5122,8 @@ else if (w.startsWith("!")) {
51305122 combineMap .put ("!" , notList );
51315123 }
51325124 config .setCombineMap (combineMap );
5133- //combineExpr = callback.onMissingKey4Combine(table, request, combineExpr, tableWhere);
51345125 config .setCombine (combineExpr );
5135-
5126+
51365127 config .setContent (tableContent );
51375128 }
51385129
@@ -5614,16 +5605,6 @@ public static interface Callback<T extends Object> extends IdCallback<T> {
56145605 * @param request
56155606 */
56165607 public void onMissingKey4Combine (String name , JSONObject request , String combine , String item , String key ) throws Exception ;
5617-
5618- /***
5619- * 前端 搜索条件动态生成@combine 表达式
5620- * 1、orm、route配置 @combine 表达式
5621- * Document json、Request structure 配置 @combine = a | (b & c)
5622- * 2、将 @combine 表达式 生成执行 @combine语句
5623- * 比如:传递参数a,b , 生成执行 combineExpr = a | b
5624- * @return
5625- */
5626- public String onMissingKey4Combine (String name , JSONObject request , String combineExpr , Map <String , Object > tableWhere );
56275608 }
56285609
56295610 public static Long LAST_ID ;
@@ -5660,10 +5641,6 @@ public void onMissingKey4Combine(String name, JSONObject request, String combine
56605641 throw new IllegalArgumentException (name + ":{} 里的 @combine:value 中的value里 " + item + " 对应的条件 " + key + ":value 中 value 不能为 null!" );
56615642 }
56625643
5663- @ Override
5664- public String onMissingKey4Combine (String name , JSONObject request , String combineExpr , Map <String , Object > tableWhere ) {
5665- return combineExpr ;
5666- }
56675644 }
56685645
56695646 private static boolean keyInCombineExpr (String combineExpr , String key ) {
0 commit comments