|
楼主 |
发表于 2016-12-22 16:28:00
|
显示全部楼层
本帖最后由 lmk123 于 2016-12-22 16:31 编辑
public static String querySA_Oporg(){//JSONObject
String sOrgKindID = "wind";
String sql = "select * from SA_OPOrg where sOrgKindID='" + sOrgKindID + "'";
HashMap<String, String> sqlMap = new HashMap<String, String>();
sqlMap.put(DatabaseProduct.MYSQL.name(), sql);
Table table = SQL.select(sqlMap, null, "/IOMM/common/data");
Map map = new HashMap();
Iterator<Row> it = table.iterator();
JSONObject ret = new JSONObject();
String str = "";
while(it.hasNext()) {
Row row = it.next();
String fID = (String) row.getString("sID");
String sFName = (String) row.getString("sName");
ret.put("safetyMeasuresTemplate",sFName);
ret.put("fID",fID.toString());
ret.put( "parent","3");
ret.put("hasChild","nkLeaf");
System.out.println(ret);
String rete = ret.toString();
str = str+rete+","; }
str = str.substring(0, str.length()-1);
System.out.println(str);
return str;
}//后台自定义了action,运行结果如下({"fID":"2GwTGcvcNIblSoWbRem","hasChild":"nkLeaf","parent":"3","safetyMeasuresTemplate":"电场"},{"fID":"2IDOlCF2Q5hrznynXC4","hasChild":"nkLeaf","parent":"3","safetyMeasuresTemplate":"新建场站1"},{"fID":"3avSLdUTZJpmIWmGuro","hasChild":"nkLeaf","parent":"3","safetyMeasuresTemplate":"电场"},{"fID":"huGYuoSP55RucNY2GBu","hasChild":"nkLeaf","parent":"3","safetyMeasuresTemplate":"风电场"}
|
|