|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.dsideal.FengHuang.Organization.Controller;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.FengHuang.Interceptor.*;
|
|
|
|
|
import com.dsideal.FengHuang.Util.CommonUtil;
|
|
|
|
|
import com.dsideal.FengHuang.Util.IpUtil;
|
|
|
|
@ -10,6 +12,7 @@ import com.jfinal.aop.Before;
|
|
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
|
import com.jfinal.ext.interceptor.GET;
|
|
|
|
|
import com.jfinal.ext.interceptor.POST;
|
|
|
|
|
import com.jfinal.kit.Kv;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Page;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
|
|
|
|
@ -449,4 +452,52 @@ public class OrganizationController extends Controller {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// http://10.10.11.124:9000/FengHuang/organization/getZyClassSelectTree?bureau_id=0D8C9679-16B6-4A3B-A6FC-5CF4FF066437
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@EmptyInterface({"bureau_id"})
|
|
|
|
|
public void getZyClassSelectTree(String bureau_id) {
|
|
|
|
|
Kv res = Kv.create();
|
|
|
|
|
Kv status = Kv.by("code", 200).set("message", "操作成功");
|
|
|
|
|
|
|
|
|
|
JSONArray data = new JSONArray();
|
|
|
|
|
JSONObject root = new JSONObject();
|
|
|
|
|
root.put("org_id", bureau_id);
|
|
|
|
|
|
|
|
|
|
Record rOrg = model.getOrgInfo(bureau_id);
|
|
|
|
|
root.put("org_name", rOrg.getStr("org_name"));
|
|
|
|
|
root.put("parent_id", "0");
|
|
|
|
|
|
|
|
|
|
//Level1
|
|
|
|
|
JSONArray level1 = new JSONArray();
|
|
|
|
|
List<Record> firstList = model.getZyClassSelectTreeLevel1(bureau_id);
|
|
|
|
|
|
|
|
|
|
//Level2
|
|
|
|
|
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"));
|
|
|
|
|
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"));
|
|
|
|
|
children.add(child);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
jo.put("children", children);
|
|
|
|
|
level1.add(jo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
root.put("children", level1);
|
|
|
|
|
data.add(root);
|
|
|
|
|
res.set("status", status);
|
|
|
|
|
res.set("data", data);
|
|
|
|
|
renderJson(res);
|
|
|
|
|
}
|
|
|
|
|
}
|