@@ -2237,13 +2237,15 @@ protected JSONObject batchVerify(RequestMethod method, String tag, int version,
22372237 }
22382238
22392239 String _tag = buildTag (request , key , method , tag );
2240- JSONObject requestItem = new JSONObject ();
2241- // key 处理别名
2242- String _key = keyDelAlias (key );
2243- requestItem .put (_key , obj );
22442240 JSONObject object = getRequestStructure (_method , _tag , version );
2245- JSONObject ret = objectVerify (_method , _tag , version , name , requestItem , maxUpdateCount , creator , object );
2246- jsonObject .put (key , ret .get (_key ));
2241+ if (method == RequestMethod .CRUD && StringUtil .isEmpty (tag , true )) {
2242+ JSONObject requestItem = new JSONObject ();
2243+ requestItem .put (key , obj );
2244+ JSONObject ret = objectVerify (_method , _tag , version , name , requestItem , maxUpdateCount , creator , object );
2245+ jsonObject .put (key , ret .get (key ));
2246+ } else {
2247+ return objectVerify (_method , _tag , version , name , request , maxUpdateCount , creator , object );
2248+ }
22472249 } else {
22482250 jsonObject .put (key , obj );
22492251 }
@@ -2283,64 +2285,16 @@ protected void setRequestAttribute(String key, boolean isArray, String attrKey,
22832285 }
22842286 }
22852287
2286- protected String keyDelAlias (String key ) {
2287- int keyIndex = key .indexOf (":" );
2288- if (keyIndex != -1 ) {
2289- String _key = key .substring (0 , keyIndex );
2290- if (apijson .JSONObject .isTableArray (key )) {
2291- _key += apijson .JSONObject .KEY_ARRAY ;
2292- }
2293- return _key ;
2294- }
2295- return key ;
2296- }
2297-
22982288 protected String buildTag (JSONObject request , String key , RequestMethod method , String tag ) {
2299- Object val = request .get (key );
2300-
23012289 if (method == RequestMethod .CRUD ) {
23022290 Map <String , Object > attrMap = keyObjectAttributesMap .get (key );
23032291 Object _tag = attrMap == null ? null : attrMap .get (JSONRequest .KEY_TAG );
2304-
2305- if (_tag != null ) {
2306- if (val instanceof JSONArray ) {
2307- return _tag .toString ();
2308- }
2309-
2310- tag = _tag .toString ();
2311- } else {
2312- // key 作为默认的 tag
2313- if (StringUtil .isEmpty (tag )) {
2314- if (val instanceof JSONArray ) {
2315- return keyDelAlias (key );
2316- }
2317-
2318- tag = key ;
2319- } else {
2320- if (val instanceof JSONArray ) {
2321- return tag ;
2322- }
2323- }
2324- }
2292+ return _tag != null ? _tag .toString () : StringUtil .isEmpty (tag ) ? key : tag ;
23252293 } else {
23262294 if (StringUtil .isEmpty (tag , true )) {
23272295 throw new IllegalArgumentException ("请在最外层传 tag !一般是 Table 名,例如 \" tag\" : \" User\" " );
23282296 }
2329- if (val instanceof JSONArray ) {
2330- return tag ;
2331- }
23322297 }
2333-
2334- // 通用判断
2335- // 对象, 需处理别名
2336- if (val instanceof JSONObject && StringUtil .isNotEmpty (tag )) {
2337- int keyIndex = tag .indexOf (":" );
2338- if (keyIndex != -1 ) {
2339- return tag .substring (0 , keyIndex );
2340- }
2341- return tag ;
2342- }
2343-
23442298 return tag ;
23452299 }
23462300
0 commit comments