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