1414
1515package zuo .biao .apijson .server ;
1616
17- import static zuo .biao .apijson .JSONObject .KEY_CONDITION ;
17+ import static zuo .biao .apijson .JSONObject .KEY_COMBINE ;
1818import static zuo .biao .apijson .JSONObject .KEY_CORRECT ;
1919import static zuo .biao .apijson .JSONObject .KEY_DROP ;
2020import static zuo .biao .apijson .JSONObject .KEY_TRY ;
@@ -225,13 +225,22 @@ public AbstractObjectParser parse() throws Exception {
225225
226226
227227 //条件<<<<<<<<<<<<<<<<<<<
228- List <String > conditionList = null ;
228+ List <String > whereList = null ;
229229 if (method == PUT ) { //这里只有PUTArray需要处理 || method == DELETE) {
230- String [] conditions = StringUtil .split (request .getString (KEY_CONDITION ));
230+ String [] combine = StringUtil .split (request .getString (KEY_COMBINE ));
231+ if (combine != null ) {
232+ String w ;
233+ for (int i = 0 ; i < combine .length ; i ++) { //去除 &,|,! 前缀
234+ w = combine [i ];
235+ if (w != null && (w .startsWith ("&" ) || w .startsWith ("|" ) || w .startsWith ("!" ))) {
236+ combine [i ] = w .substring (1 );
237+ }
238+ }
239+ }
231240 //Arrays.asList()返回值不支持add方法!
232- conditionList = new ArrayList <String >(Arrays .asList (conditions != null ? conditions : new String []{}));
233- conditionList .add (zuo .biao .apijson .JSONRequest .KEY_ID );
234- conditionList .add (zuo .biao .apijson .JSONRequest .KEY_ID_IN );
241+ whereList = new ArrayList <String >(Arrays .asList (combine != null ? combine : new String []{}));
242+ whereList .add (zuo .biao .apijson .JSONRequest .KEY_ID );
243+ whereList .add (zuo .biao .apijson .JSONRequest .KEY_ID_IN );
235244 }
236245 //条件>>>>>>>>>>>>>>>>>>>
237246
@@ -259,7 +268,7 @@ public AbstractObjectParser parse() throws Exception {
259268 }
260269 }
261270 else if (method == PUT && value instanceof JSONArray
262- && (conditionList == null || conditionList .contains (key ) == false )) {//PUT JSONArray
271+ && (whereList == null || whereList .contains (key ) == false )) {//PUT JSONArray
263272 onPUTArrayParse (key , (JSONArray ) value );
264273 }
265274 else {//JSONArray或其它Object,直接填充
@@ -369,13 +378,13 @@ public JSON onChildParse(int index, String key, JSONObject value) throws Excepti
369378
370379 JSON child ;
371380 boolean isEmpty ;
372-
381+
373382 if (zuo .biao .apijson .JSONObject .isArrayKey (key )) {//APIJSON Array
374383 if (isMain ) {
375384 throw new IllegalArgumentException (parentPath + "/" + key + ":{} 不合法!"
376385 + "数组 []:{} 中第一个 key:{} 必须是主表 TableKey:{} !不能为 arrayKey[]:{} !" );
377386 }
378-
387+
379388 child = parser .onArrayParse (value , path , key );
380389 isEmpty = child == null || ((JSONArray ) child ).isEmpty ();
381390 }
@@ -384,9 +393,9 @@ public JSON onChildParse(int index, String key, JSONObject value) throws Excepti
384393 throw new IllegalArgumentException (parentPath + "/" + key + ":{} 不合法!"
385394 + "数组 []:{} 中每个 key:{} 都必须是表 TableKey:{} 或 数组 arrayKey[]:{} !" );
386395 }
387-
396+
388397 child = parser .onObjectParse (value , path , key , isMain ? arrayConfig .setType (SQLConfig .TYPE_ITEM_CHILD_0 ) : null );
389-
398+
390399 isEmpty = child == null || ((JSONObject ) child ).isEmpty ();
391400 if (isFirst && isEmpty ) {
392401 invalidate ();
@@ -578,7 +587,7 @@ public JSONObject response() throws Exception {
578587 public Object onFunctionParse (JSONObject json , String function ) throws Exception {
579588 return null ;
580589 }
581-
590+
582591 @ Override
583592 public Object onReferenceParse (@ NotNull String path ) {
584593 return parser .getValueByPath (path );
0 commit comments