修改
This commit is contained in:
@@ -108,7 +108,17 @@ public class ClassstandardController {
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody Long id) {
|
||||
JSONObject jo = WQLObject.getWQLObject("MD_PB_ClassStandard").query("class_id = '" + id + "'").uniqueResult(0);
|
||||
JSONArray maters = ClassstandardService.getSuperior(jo, new JSONArray());
|
||||
return new ResponseEntity<>(ClassstandardService.buildTree(maters), HttpStatus.OK);
|
||||
return new ResponseEntity<>(ClassstandardService.buildTree(maters,""), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询类别:根据ID获取同级与上级数据")
|
||||
@PostMapping("/superior2")
|
||||
//@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
public ResponseEntity<Object> getSuperior2(@RequestBody Map whereJson) {
|
||||
JSONObject jo = WQLObject.getWQLObject("MD_PB_ClassStandard").query("class_id = '" + whereJson.get("id") + "'").uniqueResult(0);
|
||||
jo.put("goal_id",whereJson.get("goal_id"));
|
||||
JSONArray maters = ClassstandardService.getSuperior(jo, new JSONArray());
|
||||
return new ResponseEntity<>(ClassstandardService.buildTree(maters, (String) whereJson.get("goal_id")), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getType")
|
||||
|
||||
@@ -76,7 +76,7 @@ public interface ClassstandardService {
|
||||
|
||||
JSONArray getSuperior(JSONObject jo, JSONArray ja);
|
||||
|
||||
JSONObject buildTree(JSONArray ja);
|
||||
JSONObject buildTree(JSONArray ja,String goal_id);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
JSONObject queryClassBycode(Map whereJson);
|
||||
|
||||
@@ -241,14 +241,18 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
@Override
|
||||
public JSONArray getSuperior(JSONObject jo, JSONArray ja) {
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
if (StrUtil.isEmpty(jo.getString("parent_class_id")) || jo.getString("parent_class_id").equals("0")) {
|
||||
//
|
||||
if (StrUtil.isEmpty(jo.getString("parent_class_id")) || jo.getString("parent_class_id").equals("0") || jo.getString("class_id").equals(jo.getString("goal_id"))) {
|
||||
JSONArray null_pids = new JSONArray();
|
||||
if (jo.getString("base_data_type").equals("03")) {
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0' and base_data_type = '03'").getResultJSONArray(0);
|
||||
if (StrUtil.isNotEmpty(jo.getString("goal_id"))) {
|
||||
null_pids = wo.query("class_id = '" + jo.getString("goal_id") + "' and is_delete = '0'").getResultJSONArray(0);
|
||||
} else {
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
|
||||
if (jo.getString("base_data_type").equals("03")) {
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0' and base_data_type = '03'").getResultJSONArray(0);
|
||||
} else {
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
|
||||
}
|
||||
}
|
||||
|
||||
for (int m = 0; m < null_pids.size(); m++) {
|
||||
JSONObject null_pid = null_pids.getJSONObject(m);
|
||||
ja.add(null_pid);
|
||||
@@ -261,11 +265,14 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
ja.add(pid_row);
|
||||
}
|
||||
JSONObject id_row = wo.query("class_id = '" + jo.getString("parent_class_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.isNotEmpty(jo.getString("goal_id"))) {
|
||||
id_row.put("goal_id", jo.getString("goal_id"));
|
||||
}
|
||||
return getSuperior(id_row, ja);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject buildTree(JSONArray ja) {
|
||||
public JSONObject buildTree(JSONArray ja,String goal_id) {
|
||||
Set<JSONObject> trees = new LinkedHashSet<>();
|
||||
Set<JSONObject> maters = new LinkedHashSet<>();
|
||||
List<String> mater_name = new LinkedList<>();
|
||||
@@ -277,7 +284,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
for (int m = 0; m < ja.size(); m++) {
|
||||
JSONObject jo1 = ja.getJSONObject(m);
|
||||
isChild = false;
|
||||
if (jo1.getString("parent_class_id").equals("0") || StrUtil.isEmpty(jo1.getString("parent_class_id"))) {
|
||||
if (jo1.getString("parent_class_id").equals("0") || StrUtil.isEmpty(jo1.getString("parent_class_id")) || jo1.getString("class_id").equals(goal_id)) {
|
||||
jo1.put("id", jo1.getString("class_id"));
|
||||
jo1.put("label", jo1.getString("class_name"));
|
||||
if (jo1.getInteger("sub_count") > 0) {
|
||||
|
||||
Reference in New Issue
Block a user