潘志宝
2024-12-15 bbe7acfbe5a4c08d6edc91eaf81dcecf9d630e18
提交 | 用户 | 时间
2a6f08 1 package com.iailab.module.data.ind.value.controller;
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.item.vo.IndItemRespVO;
7 import com.iailab.module.data.ind.value.entity.IndItemValueEntity;
8 import com.iailab.module.data.ind.value.service.IndItemValueService;
9 import com.iailab.module.data.ind.value.vo.IndItemValuePageReqVO;
10 import com.iailab.module.data.ind.value.vo.IndItemValueSaveReqVO;
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月11日
27  */
28 @Tag(name = "数据平台 - 指标项")
29 @RestController
30 @RequestMapping("/data/ind-item-value")
31 @Validated
32 public class IndItemValueController {
33
34     @Autowired
35     private IndItemValueService indItemValueService;
36
37     @GetMapping("/page")
38     @Operation(summary = "获取指标项列表", description = "用于【指标项】界面")
39     @PreAuthorize("@ss.hasPermission('data:ind-item-value:query')")
40     public CommonResult<PageResult<IndItemRespVO>> page(IndItemValuePageReqVO reqVO) {
41         PageResult<IndItemValueEntity> page = indItemValueService.page(reqVO);
42         return success(BeanUtils.toBean(page, IndItemRespVO.class));
43     }
44
45     @PostMapping("/create")
46     @Operation(summary = "创建指标项")
47     @PreAuthorize("@ss.hasPermission('data:ind-item-value:create')")
48     public CommonResult<Boolean> create(@Valid @RequestBody IndItemValueSaveReqVO createReqVO) {
49         indItemValueService.create(createReqVO);
50         return success(true);
51     }
52
53     @PutMapping("/update")
54     @Operation(summary = "修改指标项")
55     @PreAuthorize("@ss.hasPermission('data:ind-item-value:update')")
56     public CommonResult<Boolean> update(@Valid @RequestBody IndItemValueSaveReqVO updateReqVO) {
57         indItemValueService.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:ind-item-value:delete')")
65     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
66         indItemValueService.delete(id);
67         return success(true);
68     }
69
70     @GetMapping("/get")
71     @Operation(summary = "获取指标项信息")
72     @PreAuthorize("@ss.hasPermission('system:ind-item:query')")
73     public CommonResult<IndItemRespVO> get(String id) {
74         IndItemValueEntity entity = indItemValueService.get(id);
75         return success(BeanUtils.toBean(entity, IndItemRespVO.class));
76     }
77 }