diff --git a/src/main/java/iet/ustb/sf/controller/TargetController.java b/src/main/java/iet/ustb/sf/controller/TargetController.java index fe65a14..692f595 100644 --- a/src/main/java/iet/ustb/sf/controller/TargetController.java +++ b/src/main/java/iet/ustb/sf/controller/TargetController.java @@ -100,8 +100,7 @@ public class TargetController { @Operation(summary = "获取原子指标配置(指标库列表中点击衍生)") @PostMapping("/getDetailExpandTarget") public R getDetailExpandTarget(@RequestBody JSONObject params) { - JSONObject result; - result = targetService.getDetailExpandTarget(params); + JSONObject result = targetService.getDetailExpandTarget(params); Page list = tableColumnService.getDataByTableName(result.getJSONObject("list")); result.put("list", list); result.put("columnList", tableColumnService.getColumnsByTableName(result.getString("tableName"))); diff --git a/src/main/java/iet/ustb/sf/service/impl/TargetServiceImpl.java b/src/main/java/iet/ustb/sf/service/impl/TargetServiceImpl.java index edaa0f8..0833616 100644 --- a/src/main/java/iet/ustb/sf/service/impl/TargetServiceImpl.java +++ b/src/main/java/iet/ustb/sf/service/impl/TargetServiceImpl.java @@ -456,9 +456,11 @@ public class TargetServiceImpl extends ServiceImpl CheckUtils.checkEmpty(id, "指标ID"); target = targetMapper.selectById(id); List optionList = new ArrayList<>(); - while (id != null) { + Target parent = targetMapper.selectById(id); + while (!StringUtils.isEmpty(id)) { optionList.addAll(0, targetOptionMapper.selectList(new QueryWrapper().eq("target_id", id))); - id = target.getParent(); + id = parent.getParent(); + parent = targetMapper.selectById(id); } return getDetailTarget(optionList, target); }