潘志宝
2024-12-15 bbe7acfbe5a4c08d6edc91eaf81dcecf9d630e18
提交 | 用户 | 时间
a63a4f 1 package com.iailab.module.data.ind.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.ind.data.entity.IndDataSetEntity;
7 import com.iailab.module.data.ind.data.service.IndDataSetService;
8 import com.iailab.module.data.ind.data.vo.IndDataSetPageReqVO;
9 import com.iailab.module.data.ind.data.vo.IndDataSetRespVO;
10 import com.iailab.module.data.ind.data.vo.IndDataSetSaveReqVO;
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
215dbc 21 import java.util.List;
22
a63a4f 23 import static com.iailab.framework.common.pojo.CommonResult.success;
24
25 /**
26  * @author PanZhibao
27  * @Description
28  * @createTime 2024年09月10日
29  */
30 @Tag(name = "数据平台 - 指标数据集")
31 @RestController
ac6fb5 32 @RequestMapping("/data/ind/data-set")
a63a4f 33 @Validated
34 public class IndDataSetController {
35     @Autowired
36     private IndDataSetService indDataSetService;
37
38     @GetMapping("/page")
e41062 39     @Operation(summary = "获取指标数据集列表", description = "用于【指标数据集】界面")
a63a4f 40     @PreAuthorize("@ss.hasPermission('data:ind-data-set:query')")
41     public CommonResult<PageResult<IndDataSetRespVO>> page(IndDataSetPageReqVO reqVO) {
42         PageResult<IndDataSetEntity> page = indDataSetService.page(reqVO);
43         return success(BeanUtils.toBean(page, IndDataSetRespVO.class));
44     }
45
46     @PostMapping("/create")
e41062 47     @Operation(summary = "创建指标数据集")
a63a4f 48     @PreAuthorize("@ss.hasPermission('data:ind-data-set:create')")
49     public CommonResult<Boolean> create(@Valid @RequestBody IndDataSetSaveReqVO createReqVO) {
50         indDataSetService.create(createReqVO);
51         return success(true);
52     }
53
54     @PutMapping("/update")
e41062 55     @Operation(summary = "修改指标数据集")
a63a4f 56     @PreAuthorize("@ss.hasPermission('data:ind-data-set:update')")
57     public CommonResult<Boolean> update(@Valid @RequestBody IndDataSetSaveReqVO updateReqVO) {
58         indDataSetService.update(updateReqVO);
59         return success(true);
60     }
61
62     @DeleteMapping("/delete")
e41062 63     @Operation(summary = "删除指标数据集")
64     @Parameter(name = "id", description = "指标数据集编号", required= true, example = "1024")
a63a4f 65     @PreAuthorize("@ss.hasPermission('data:ind-data-set:delete')")
66     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
67         indDataSetService.delete(id);
68         return success(true);
69     }
70
71     @GetMapping("/get")
e41062 72     @Operation(summary = "获取指标数据集信息")
ac6fb5 73     @PreAuthorize("@ss.hasPermission('data:ind-data-set:query')")
a63a4f 74     public CommonResult<IndDataSetRespVO> get(String id) {
75         IndDataSetEntity entity = indDataSetService.get(id);
76         return success(BeanUtils.toBean(entity, IndDataSetRespVO.class));
77     }
215dbc 78
79     @GetMapping("/list-all-simple")
80     @Operation(summary = "获取指标数据集列表", description = "用于【指标数据集】界面")
81     @PreAuthorize("@ss.hasPermission('data:ind-data-set:query')")
82     public CommonResult<List<IndDataSetRespVO>> list(IndDataSetPageReqVO reqVO) {
83         List<IndDataSetEntity> list = indDataSetService.list(reqVO);
84         return success(BeanUtils.toBean(list, IndDataSetRespVO.class));
85     }
a63a4f 86 }