@@ -2230,13 +2230,15 @@ protected JSONObject batchVerify(RequestMethod method, String tag, int version,
22302230 }
22312231
22322232 String _tag = buildTag (request , key , method , tag );
2233- JSONObject requestItem = new JSONObject ();
2234- // key 处理别名
2235- String _key = keyDelAlias (key );
2236- requestItem .put (_key , obj );
22372233 JSONObject object = getRequestStructure (_method , _tag , version );
2238- JSONObject ret = objectVerify (_method , _tag , version , name , requestItem , maxUpdateCount , creator , object );
2239- jsonObject .put (key , ret .get (_key ));
2234+ if (method == RequestMethod .CRUD && StringUtil .isEmpty (tag , true )) {
2235+ JSONObject requestItem = new JSONObject ();
2236+ requestItem .put (key , obj );
2237+ JSONObject ret = objectVerify (_method , _tag , version , name , requestItem , maxUpdateCount , creator , object );
2238+ jsonObject .put (key , ret .get (key ));
2239+ } else {
2240+ return objectVerify (_method , _tag , version , name , request , maxUpdateCount , creator , object );
2241+ }
22402242 } else {
22412243 jsonObject .put (key , obj );
22422244 }
@@ -2276,64 +2278,16 @@ protected void setRequestAttribute(String key, boolean isArray, String attrKey,
22762278 }
22772279 }
22782280
2279- protected String keyDelAlias (String key ) {
2280- int keyIndex = key .indexOf (":" );
2281- if (keyIndex != -1 ) {
2282- String _key = key .substring (0 , keyIndex );
2283- if (apijson .JSONObject .isTableArray (key )) {
2284- _key += apijson .JSONObject .KEY_ARRAY ;
2285- }
2286- return _key ;
2287- }
2288- return key ;
2289- }
2290-
22912281 protected String buildTag (JSONObject request , String key , RequestMethod method , String tag ) {
2292- Object val = request .get (key );
2293-
22942282 if (method == RequestMethod .CRUD ) {
22952283 Map <String , Object > attrMap = keyObjectAttributesMap .get (key );
22962284 Object _tag = attrMap == null ? null : attrMap .get (JSONRequest .KEY_TAG );
2297-
2298- if (_tag != null ) {
2299- if (val instanceof JSONArray ) {
2300- return _tag .toString ();
2301- }
2302-
2303- tag = _tag .toString ();
2304- } else {
2305- // key 作为默认的 tag
2306- if (StringUtil .isEmpty (tag )) {
2307- if (val instanceof JSONArray ) {
2308- return keyDelAlias (key );
2309- }
2310-
2311- tag = key ;
2312- } else {
2313- if (val instanceof JSONArray ) {
2314- return tag ;
2315- }
2316- }
2317- }
2285+ return _tag != null ? _tag .toString () : StringUtil .isEmpty (tag ) ? key : tag ;
23182286 } else {
23192287 if (StringUtil .isEmpty (tag , true )) {
23202288 throw new IllegalArgumentException ("请在最外层传 tag !一般是 Table 名,例如 \" tag\" : \" User\" " );
23212289 }
2322- if (val instanceof JSONArray ) {
2323- return tag ;
2324- }
23252290 }
2326-
2327- // 通用判断
2328- // 对象, 需处理别名
2329- if (val instanceof JSONObject && StringUtil .isNotEmpty (tag )) {
2330- int keyIndex = tag .indexOf (":" );
2331- if (keyIndex != -1 ) {
2332- return tag .substring (0 , keyIndex );
2333- }
2334- return tag ;
2335- }
2336-
23372291 return tag ;
23382292 }
23392293
0 commit comments