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