指标库:列表中点击衍生获取原子指标配置

This commit is contained in:
huangge1199 2025-08-08 15:38:44 +08:00
parent 8585429bc5
commit 112c70fa4e
3 changed files with 29 additions and 3 deletions

View File

@ -89,4 +89,15 @@ public class TargetController {
targetService.deleteTargetById(params);
return R.ok();
}
@Operation(summary = "获取原子指标配置(指标库列表中点击衍生)")
@PostMapping("/getDetailExpandTarget")
public R<JSONObject> getDetailExpandTarget(@RequestBody JSONObject params) {
JSONObject result;
result = targetService.getDetailExpandTarget(params);
Page<?> list = tableColumnService.getDataByTableName(result.getJSONObject("list"));
result.put("list", list);
result.put("columnList", tableColumnService.getColumnsByTableName(result.getString("tableName")));
return R.ok(result);
}
}

View File

@ -28,4 +28,6 @@ public interface TargetService extends IService<Target> {
Page<?> getDataByParam(JSONObject params);
void deleteTargetById(JSONObject params);
JSONObject getDetailExpandTarget(JSONObject params);
}

View File

@ -1,6 +1,5 @@
package iet.ustb.sf.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -19,7 +18,6 @@ import iet.ustb.sf.util.CheckUtils;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -60,7 +58,8 @@ public class TargetServiceImpl extends ServiceImpl<TargetMapper, Target>
@Resource
private RuleMapper ruleMapper;
@Autowired
@Resource
private MonitorMapper monitorMapper;
@Override
@ -441,6 +440,20 @@ public class TargetServiceImpl extends ServiceImpl<TargetMapper, Target>
monitorMapper.delete(new QueryWrapper<Monitor>().eq("target_id", id));
}
@Override
public JSONObject getDetailExpandTarget(JSONObject params) {
Target target = params.getObject("target", Target.class);
String id = target.getId();
CheckUtils.checkEmpty(id, "指标ID");
target = targetMapper.selectById(id);
List<TargetOption> optionList = new ArrayList<>();
while (id != null) {
optionList.addAll(0, targetOptionMapper.selectList(new QueryWrapper<TargetOption>().eq("target_id", id)));
id = target.getParent();
}
return getDetailTarget(optionList, target);
}
/**
* 查看指标详情
*