| | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.BiDashboardDO; |
| | | import cn.iocoder.yudao.module.bi.service.dashboard.DashboardService; |
| | | import cn.iocoder.yudao.framework.security.core.service.SecurityFrameworkService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @Resource |
| | | private DashboardService dashboardService; |
| | | |
| | | @Resource |
| | | private SecurityFrameworkService securityFrameworkService; |
| | | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "获取仪表盘列表") |
| | | public CommonResult<List<BiDashboardDO>> getDashboardList() { |
| | | return success(dashboardService.getDashboardList()); |
| | | return success(dashboardService.getDashboardList().stream() |
| | | .filter(dashboard -> securityFrameworkService.hasPermission( |
| | | "bi:dashboard:" + dashboard.getCode() + ":query")) |
| | | .toList()); |
| | | } |
| | | |
| | | @PostMapping("/{dashboardCode}/data") |
| | | @PreAuthorize("@ss.hasPermission('bi:dashboard:' + #dashboardCode + ':query')") |
| | | @Operation(summary = "获取仪表盘数据") |
| | | @Parameter(name = "dashboardCode", description = "仪表盘编码", required = true, |
| | | example = "purchase_sales")
public CommonResult<List<Map<String, Object>>> getDashboardData( |
| | | example = "purchase_sales") |
| | | public CommonResult<List<Map<String, Object>>> getDashboardData( |
| | | @PathVariable("dashboardCode") String dashboardCode, |
| | | @RequestBody(required = false) Map<String, Object> params) { |
| | | List<Map<String, Object>> data = dashboardService.getDashboardData(dashboardCode, params); |