dengzedong
2024-11-05 200adeb65fddffc4cd2cc80d718be5e386cc5bab
提交 | 用户 | 时间
200ade 1 package com.iailab.module.model.mpk.controller.admin;
D 2
3 import com.iailab.framework.common.page.PageData;
4 import com.iailab.framework.common.pojo.CommonResult;
5 import com.iailab.module.model.mpk.dto.ChartDTO;
6 import com.iailab.module.model.mpk.dto.ChartParamDTO;
7 import com.iailab.module.model.mpk.entity.ChartEntity;
8 import com.iailab.module.model.mpk.entity.ChartParamEntity;
9 import com.iailab.module.model.mpk.service.ChartService;
10 import io.swagger.v3.oas.annotations.Operation;
11 import io.swagger.v3.oas.annotations.tags.Tag;
12 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.security.access.prepost.PreAuthorize;
14 import org.springframework.web.bind.annotation.*;
15
16 import java.util.Map;
17
18 import static com.iailab.framework.common.pojo.CommonResult.success;
19
20 /**
21  * @description:
22  * @author: dzd
23  * @date: 2024/11/5 11:43
24  **/
25 @Tag(name = "图表参数")
26 @RestController
27 @RequestMapping("/model/chart")
28 public class ChartController {
29
30     @Autowired
31     private ChartService chartService;
32
33     @GetMapping("page")
34     @Operation(summary = "分页")
35     @PreAuthorize("@ss.hasPermission('model:chart:query')")
36     public CommonResult<PageData<ChartDTO>> page(@RequestParam Map<String, Object> params) {
37         PageData<ChartDTO> page = chartService.page(params);
38         return success(page);
39     }
40
41     @GetMapping("/get")
42     @Operation(summary = "获得详情")
43     public CommonResult<ChartEntity> get(@RequestParam("id") String id) {
44         ChartEntity data = chartService.get(id);
45         return success(data);
46     }
47
48     @PostMapping("/create")
49     @Operation(summary = "创建")
50     @PreAuthorize("@ss.hasPermission('model:chart:create')")
51     public CommonResult<Boolean> save(@RequestBody ChartEntity entity) {
52         chartService.create(entity);
53         return success(true);
54     }
55
56     @PutMapping("/update")
57     @Operation(summary = "更新")
58     @PreAuthorize("@ss.hasPermission('model:chart:update')")
59     public CommonResult<Boolean> update(@RequestBody ChartEntity entity) {
60         chartService.update(entity);
61         return success(true);
62     }
63
64     @DeleteMapping("/delete")
65     @PreAuthorize("@ss.hasPermission('model:chart:delete')")
66     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
67         chartService.delete(id);
68         return success(true);
69     }
70 }