java mar --->JSONArray.fromObject
阅读原文时间:2023年07月10日阅读:1

net.sf.json-lib json-lib 2.4 jdk15

----------------------------------------------------------------------

Object map = (Object)this.param.get("map");
int xx =1;
net.sf.json.JSONArray ja = net.sf.json.JSONArray.fromObject(map);
for(int i=0;iinsert into succes:"+(i1>0?"成功":"失败"));
if(obj1.get("menus")==null)
continue;
net.sf.json.JSONArray ja2 = net.sf.json.JSONArray.fromObject(obj1.get("menus"));
for(int j=0;j<ja2.size();j++) {
net.sf.json.JSONObject obj2 = (net.sf.json.JSONObject)ja2.getJSONObject(j);
logger.info("i="+j+","+obj2.get("menuid").toString()+",menuname:"+obj2.get("menuname").toString()+",icon:"+obj2.get("icon").toString()+",url:"+(obj2.get("url")==null?"":obj2.get("url").toString())+",parent_id:"+obj1.get("menuid").toString());

SysPowerMenu sysPowerMenu2 = new SysPowerMenu();
sysPowerMenu2.setMenuid(obj2.get("menuid").toString());
sysPowerMenu2.setMenuname(obj2.get("menuname").toString());
sysPowerMenu2.setUrl((obj2.get("url")==null?"":obj2.get("url").toString()));
sysPowerMenu2.setIcon(obj2.get("icon").toString());
sysPowerMenu2.setParentId(obj1.get("menuid").toString());
int i2 =sysPowerMenuService.add(sysPowerMenu2);
xx+=1;
logger.info("==>insert into succes:"+(i2>0?"成功":"失败"));
if(obj2.get("menus")==null)
continue;
net.sf.json.JSONArray ja3 = net.sf.json.JSONArray.fromObject(obj2.get("menus"));

for(int k=0;kinsert into succes:"+(i3>0?"成功":"失败"));

if(obj3.get("menus")==null)
continue;
net.sf.json.JSONArray ja4 = net.sf.json.JSONArray.fromObject(obj3.get("menus"));
for(int m=0;m<ja4.size();m++) {
net.sf.json.JSONObject obj4 = (net.sf.json.JSONObject)ja4.getJSONObject(m);
logger.info("m="+m+","+obj4.get("menuid").toString()+",menuname:"+obj4.get("menuname").toString()+",icon:"+obj4.get("icon").toString()+",url:"+(obj4.get("url")==null?"":obj4.get("url").toString())+",parent_id:"+obj3.get("menuid").toString());

SysPowerMenu sysPowerMenu4 = new SysPowerMenu();
sysPowerMenu4.setMenuid(obj4.get("menuid").toString());
sysPowerMenu4.setMenuname(obj4.get("menuname").toString());
sysPowerMenu4.setUrl((obj4.get("url")==null?"":obj4.get("url").toString()));
sysPowerMenu4.setIcon(obj4.get("icon").toString());
sysPowerMenu4.setParentId(obj3.get("menuid").toString());
int i4 =sysPowerMenuService.add(sysPowerMenu4);
xx+=1;
logger.info("==>insert into succes:"+(i4>0?"成功":"失败"));

if(obj4.get("menus")==null)
continue;
net.sf.json.JSONArray ja5 = net.sf.json.JSONArray.fromObject(obj4.get("menus"));
for(int n=0;ninsert into succes:"+(i5>0?"成功":"失败"));

if(obj5.get("menus")==null)
continue;
}

}
}
}

}