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