潘志宝
2024-12-30 af012402d448313b0888868b9e0230ff3a8f0d49
提交 | 用户 | 时间
8c1646 1 package com.iailab.module.data.plan.data.controller.admin;
2
3 import com.iailab.framework.common.pojo.CommonResult;
4 import com.iailab.framework.common.pojo.PageResult;
5 import com.iailab.framework.common.util.object.BeanUtils;
6 import com.iailab.module.data.plan.data.entity.PlanDataSetEntity;
7 import com.iailab.module.data.plan.data.service.PlanDataSetService;
8 import com.iailab.module.data.plan.data.vo.PlanDataSetPageReqVO;
9 import com.iailab.module.data.plan.data.vo.PlanDataSetRespVO;
10 import com.iailab.module.data.plan.data.vo.PlanDataSetSaveReqVO;
11 import io.swagger.v3.oas.annotations.Operation;
12 import io.swagger.v3.oas.annotations.Parameter;
13 import io.swagger.v3.oas.annotations.tags.Tag;
14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.security.access.prepost.PreAuthorize;
16 import org.springframework.validation.annotation.Validated;
17 import org.springframework.web.bind.annotation.*;
18
19 import javax.validation.Valid;
20 import java.util.List;
21
22 import static com.iailab.framework.common.pojo.CommonResult.success;
23
24 /**
25  * @author PanZhibao
26  * @Description
27  * @createTime 2024年11月01日
28  */
29 @Tag(name = "数据平台 - 计划数据集")
30 @RestController
31 @RequestMapping("/data/plan/data-set")
32 @Validated
33 public class PlanDataSetController {
34     @Autowired
35     private PlanDataSetService indDataSetService;
36
37     @GetMapping("/page")
38     @Operation(summary = "获取计划数据集列表", description = "用于【计划数据集】界面")
39     @PreAuthorize("@ss.hasPermission('data:plan-data-set:query')")
40     public CommonResult<PageResult<PlanDataSetRespVO>> page(PlanDataSetPageReqVO reqVO) {
41         PageResult<PlanDataSetEntity> page = indDataSetService.page(reqVO);
42         return success(BeanUtils.toBean(page, PlanDataSetRespVO.class));
43     }
44
45     @PostMapping("/create")
46     @Operation(summary = "创建计划数据集")
47     @PreAuthorize("@ss.hasPermission('data:plan-data-set:create')")
48     public CommonResult<Boolean> create(@Valid @RequestBody PlanDataSetSaveReqVO createReqVO) {
49         indDataSetService.create(createReqVO);
50         return success(true);
51     }
52
53     @PutMapping("/update")
54     @Operation(summary = "修改计划数据集")
55     @PreAuthorize("@ss.hasPermission('data:plan-data-set:update')")
56     public CommonResult<Boolean> update(@Valid @RequestBody PlanDataSetSaveReqVO updateReqVO) {
57         indDataSetService.update(updateReqVO);
58         return success(true);
59     }
60
61     @DeleteMapping("/delete")
62     @Operation(summary = "删除计划数据集")
63     @Parameter(name = "id", description = "计划数据集编号", required= true, example = "1024")
64     @PreAuthorize("@ss.hasPermission('data:plan-data-set:delete')")
65     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
66         indDataSetService.delete(id);
67         return success(true);
68     }
69
70     @GetMapping("/get")
71     @Operation(summary = "获取计划数据集信息")
72     @PreAuthorize("@ss.hasPermission('data:plan-data-set:query')")
73     public CommonResult<PlanDataSetRespVO> get(String id) {
74         PlanDataSetEntity entity = indDataSetService.get(id);
75         return success(BeanUtils.toBean(entity, PlanDataSetRespVO.class));
76     }
77
78     @GetMapping("/list-all-simple")
79     @Operation(summary = "获取计划数据集列表", description = "用于【计划数据集】界面")
80     @PreAuthorize("@ss.hasPermission('data:plan-data-set:query')")
81     public CommonResult<List<PlanDataSetRespVO>> list(PlanDataSetPageReqVO reqVO) {
82         List<PlanDataSetEntity> list = indDataSetService.list(reqVO);
83         return success(BeanUtils.toBean(list, PlanDataSetRespVO.class));
84     }
85 }