2026-08-05 9e97c94713ada364bfee7be2616c79a53bafb8c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package cn.iocoder.yudao.module.bi.controller.admin.config;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bi.dal.dataobject.BiChartConfigDO;
import cn.iocoder.yudao.module.bi.service.config.BiChartConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
@Tag(name = "管理后台 - BI 图表配置")
@RestController
@RequestMapping("/bi/chart-config")
@Validated
public class BiChartConfigController {
 
    @Resource
    private BiChartConfigService chartConfigService;
 
    @PostMapping("/create")
    @Operation(summary = "创建图表配置")
    @PreAuthorize("@ss.hasPermission('bi:chart-config:create')")
    public CommonResult<Long> create(@Valid @RequestBody BiChartConfigDO config) {
        return success(chartConfigService.create(config));
    }
 
    @PutMapping("/update")
    @Operation(summary = "更新图表配置")
    @PreAuthorize("@ss.hasPermission('bi:chart-config:update')")
    public CommonResult<Boolean> update(@Valid @RequestBody BiChartConfigDO config) {
        chartConfigService.update(config);
        return success(true);
    }
 
    @DeleteMapping("/delete")
    @Operation(summary = "删除图表配置")
    @Parameter(name = "id", description = "编号", required = true)
    @PreAuthorize("@ss.hasPermission('bi:chart-config:delete')")
    public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
        chartConfigService.delete(id);
        return success(true);
    }
 
    @GetMapping("/get")
    @Operation(summary = "获取图表配置")
    @Parameter(name = "id", description = "编号", required = true)
    @PreAuthorize("@ss.hasPermission('bi:chart-config:query')")
    public CommonResult<BiChartConfigDO> get(@RequestParam("id") Long id) {
        return success(chartConfigService.get(id));
    }
 
    @GetMapping("/page")
    @Operation(summary = "分页查询图表配置")
    @PreAuthorize("@ss.hasPermission('bi:chart-config:query')")
    public CommonResult<PageResult<BiChartConfigDO>> getPage(
            @RequestParam(value = "dashboardId", required = false) Long dashboardId,
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
        return success(chartConfigService.getPage(dashboardId, pageNo, pageSize));
    }
 
}