Jay
2024-11-08 02722a3f9eca857ce7fffea352e9f7ee692a1b71
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 com.iailab.module.model.mpk.controller.admin;
 
import com.iailab.framework.common.page.PageData;
import com.iailab.framework.common.pojo.CommonResult;
import com.iailab.module.model.mpk.dto.ChartDTO;
import com.iailab.module.model.mpk.dto.ChartParamDTO;
import com.iailab.module.model.mpk.entity.ChartEntity;
import com.iailab.module.model.mpk.entity.ChartParamEntity;
import com.iailab.module.model.mpk.service.ChartService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
import java.util.Map;
 
import static com.iailab.framework.common.pojo.CommonResult.success;
 
/**
 * @description:
 * @author: dzd
 * @date: 2024/11/5 11:43
 **/
@Tag(name = "图表参数")
@RestController
@RequestMapping("/model/chart")
public class ChartController {
 
    @Autowired
    private ChartService chartService;
 
    @GetMapping("page")
    @Operation(summary = "分页")
    @PreAuthorize("@ss.hasPermission('model:chart:query')")
    public CommonResult<PageData<ChartDTO>> page(@RequestParam Map<String, Object> params) {
        PageData<ChartDTO> page = chartService.page(params);
        return success(page);
    }
 
    @GetMapping("/get")
    @Operation(summary = "获得详情")
    public CommonResult<ChartEntity> get(@RequestParam("id") String id) {
        ChartEntity data = chartService.get(id);
        return success(data);
    }
 
    @PostMapping("/create")
    @Operation(summary = "创建")
    @PreAuthorize("@ss.hasPermission('model:chart:create')")
    public CommonResult<Boolean> save(@RequestBody ChartEntity entity) {
        chartService.create(entity);
        return success(true);
    }
 
    @PutMapping("/update")
    @Operation(summary = "更新")
    @PreAuthorize("@ss.hasPermission('model:chart:update')")
    public CommonResult<Boolean> update(@RequestBody ChartEntity entity) {
        chartService.update(entity);
        return success(true);
    }
 
    @DeleteMapping("/delete")
    @PreAuthorize("@ss.hasPermission('model:chart:delete')")
    public CommonResult<Boolean> delete(@RequestParam("id") String id) {
        chartService.delete(id);
        return success(true);
    }
}