kgdxpr 3 years ago
commit 4a47f99d1b

@ -462,11 +462,11 @@ public class OrganizationController extends Controller {
JSONArray data = new JSONArray();
JSONObject root = new JSONObject();
root.put("org_id", bureau_id);
root.put("id", bureau_id);
Record rOrg = model.getOrgInfo(bureau_id);
root.put("org_name", rOrg.getStr("org_name"));
root.put("parent_id", "0");
root.put("title", rOrg.getStr("org_name"));
root.put("parentId", "0");
//Level1
JSONArray level1 = new JSONArray();
@ -476,24 +476,23 @@ public class OrganizationController extends Controller {
List<Record> secondList = model.getZyClassSelectTreeLevel2(bureau_id);
for (Record r1 : firstList) {
JSONObject jo = new JSONObject();
jo.put("org_id", r1.getStr("org_id"));
jo.put("org_name", r1.getStr("org_name"));
jo.put("parent_id", r1.getStr("parent_id"));
jo.put("id", r1.getStr("org_id"));
jo.put("title", r1.getStr("org_name"));
jo.put("parentId", r1.getStr("parent_id"));
JSONArray children = new JSONArray();
String org_id = r1.getStr("org_id");
for (Record r2 : secondList) {
if (r2.getStr("parent_id").equals(org_id)) {
JSONObject child = new JSONObject();
child.put("org_id", r2.getStr("org_id"));
child.put("org_name", r2.getStr("org_name"));
child.put("parent_id", r2.getStr("parent_id"));
child.put("id", r2.getStr("org_id"));
child.put("title", r2.getStr("org_name"));
child.put("parentId", r2.getStr("parent_id"));
children.add(child);
}
}
jo.put("children", children);
level1.add(jo);
}
root.put("children", level1);
data.add(root);
res.set("status", status);

Loading…
Cancel
Save