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.IndDataSetFieldEntity;
7 import com.iailab.module.data.ind.data.service.IndDataSetFieldService;
8 import com.iailab.module.data.ind.data.vo.*;
9 import io.swagger.v3.oas.annotations.Operation;
10 import io.swagger.v3.oas.annotations.Parameter;
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.validation.annotation.Validated;
15 import org.springframework.web.bind.annotation.*;
16
17 import javax.validation.Valid;
18
19 import static com.iailab.framework.common.pojo.CommonResult.success;
20
21 /**
22  * @author PanZhibao
23  * @Description
24  * @createTime 2024年09月10日
25  */
26 @Tag(name = "数据平台 - 指标数据集字段")
27 @RestController
ac6fb5 28 @RequestMapping("/data/ind/data-set-field")
a63a4f 29 @Validated
30 public class IndDataSetFieldController {
31
32     @Autowired
33     private IndDataSetFieldService indDataSetFieldService;
34
35     @GetMapping("/page")
e41062 36     @Operation(summary = "获取指标数据集字段列表", description = "用于【指标数据集字段】界面")
a63a4f 37     @PreAuthorize("@ss.hasPermission('data:ind-data-set:query')")
ac6fb5 38     public CommonResult<PageResult<IndDataSetFieldRespVO>> page(IndDataSetFieldPageReqVO reqVO) {
a63a4f 39         PageResult<IndDataSetFieldEntity> page = indDataSetFieldService.page(reqVO);
ac6fb5 40         return success(BeanUtils.toBean(page, IndDataSetFieldRespVO.class));
a63a4f 41     }
42
43     @PostMapping("/create")
e41062 44     @Operation(summary = "创建指标数据集字段")
a63a4f 45     @PreAuthorize("@ss.hasPermission('data:ind-data-set:create')")
46     public CommonResult<Boolean> create(@Valid @RequestBody IndDataSetFieldSaveReqVO createReqVO) {
47         indDataSetFieldService.create(createReqVO);
48         return success(true);
49     }
50
51     @PutMapping("/update")
e41062 52     @Operation(summary = "修改指标数据集字段")
a63a4f 53     @PreAuthorize("@ss.hasPermission('data:ind-data-set:update')")
54     public CommonResult<Boolean> update(@Valid @RequestBody IndDataSetFieldSaveReqVO updateReqVO) {
55         indDataSetFieldService.update(updateReqVO);
56         return success(true);
57     }
58
59     @DeleteMapping("/delete")
e41062 60     @Operation(summary = "删除指标数据集字段")
ac6fb5 61     @Parameter(name = "id", description = "指标数据集字段编号", required = true, example = "1024")
a63a4f 62     @PreAuthorize("@ss.hasPermission('data:ind-data-set:delete')")
63     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
64         indDataSetFieldService.delete(id);
65         return success(true);
66     }
67
68     @GetMapping("/get")
e41062 69     @Operation(summary = "获取指标数据集字段信息")
a63a4f 70     @PreAuthorize("@ss.hasPermission('system:ind-data-set:query')")
ac6fb5 71     public CommonResult<IndDataSetFieldRespVO> get(String id) {
a63a4f 72         IndDataSetFieldEntity entity = indDataSetFieldService.get(id);
ac6fb5 73         return success(BeanUtils.toBean(entity, IndDataSetFieldRespVO.class));
a63a4f 74     }
75 }