package iet.ustb.sf.controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import iet.ustb.sf.common.R; import iet.ustb.sf.domain.Target; import iet.ustb.sf.service.TableColumnService; import iet.ustb.sf.service.TargetService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * 目标管控-指标 * TargetController * * @author huangge1199 * @since 2025/8/5 16:24:06 */ @RestController @RequestMapping("/mbgk/target") @Tag(name = "目标管控-指标") public class TargetController { @Resource private TargetService targetService; @Resource private TableColumnService tableColumnService; /** * 根据分类显示指标列表 */ @Operation(summary = "根据分类显示指标列表") @PostMapping("/getTargetsByCategory") public R> getTargetsByCategory(@RequestBody JSONObject params) { IPage result = targetService.getTargetsByCategory(params); return R.ok(result); } @Operation(summary = "查询去重单列") @PostMapping("/searchColumn") public R> searchColumn(@RequestBody JSONObject params) { List result = targetService.searchColumn(params); return R.ok(result); } @Operation(summary = "指标输出查询") @PostMapping("/getResult") public R getResult(@RequestBody JSONObject params) { String result = targetService.getResult(params); return R.ok(result); } @Operation(summary = "保存指标") @PostMapping("/saveTarget") public R saveTarget(@RequestBody JSONObject params) { targetService.saveTarget(params); return R.ok(); } @Operation(summary = "获取原子指标详情(点击进入编辑界面)") @PostMapping("/getDetailTarget") public R getDetailTarget(@RequestBody JSONObject params) { JSONObject result = targetService.getDetailTarget(params); Page list = tableColumnService.getDataByTableName(result.getJSONObject("list")); result.put("list", list); result.put("columnList", tableColumnService.getColumnsByTableName(result.getString("tableName"))); return R.ok(result); } @Operation(summary = "根据参数分页查询数据") @PostMapping("/getDataByParam") public R> getDataByParam(@RequestBody JSONObject params) { Page result = targetService.getDataByParam(params); return R.ok(result); } @Operation(summary = "删除指标") @PostMapping("/deleteTargetById") public R deleteTargetById(@RequestBody JSONObject params) { targetService.deleteTargetById(params); return R.ok(); } @Operation(summary = "获取原子指标配置(指标库列表中点击衍生)") @PostMapping("/getDetailExpandTarget") public R 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); } @Operation(summary = "保存衍生指标") @PostMapping("/saveExpandTarget") public R saveExpandTarget(@RequestBody JSONObject params) { targetService.saveExpandTarget(params); return R.ok(); } }