龚焕茏
2024-03-07 8af76e086fab5fc346e0431d18797c1ff82af8dc
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package org.dromara.demo.controller;
 
import java.util.List;
import java.util.Map;
 
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.demo.domain.vo.RsIndicatorInfoVo;
import org.dromara.demo.domain.bo.RsIndicatorInfoBo;
import org.dromara.demo.service.IRsIndicatorInfoService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
 
/**
 * 指标取值
 *
 * @author gonghl
 * @date 2024-03-04
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/demo/indicatorInfo")
public class RsIndicatorInfoController extends BaseController {
 
    private final IRsIndicatorInfoService rsIndicatorInfoService;
 
    /**
     * 查询指标取值列表
     */
    @SaCheckPermission("demo:indicatorInfo:list")
    @GetMapping("/list")
    public TableDataInfo<RsIndicatorInfoVo> list(RsIndicatorInfoBo bo, PageQuery pageQuery) {
        return rsIndicatorInfoService.queryPageList(bo, pageQuery);
    }
 
    /**
     * 导出指标取值列表
     */
    @SaCheckPermission("demo:indicatorInfo:export")
    @Log(title = "指标取值", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(RsIndicatorInfoBo bo, HttpServletResponse response) {
        List<RsIndicatorInfoVo> list = rsIndicatorInfoService.queryList(bo);
        ExcelUtil.exportExcel(list, "指标取值", RsIndicatorInfoVo.class, response);
    }
 
    /**
     * 获取指标取值详细信息
     *
     * @param id 主键
     */
    @SaCheckPermission("demo:indicatorInfo:query")
    @GetMapping("/{id}")
    public R<RsIndicatorInfoVo> getInfo(@NotNull(message = "主键不能为空")
                                     @PathVariable String id) {
        return R.ok(rsIndicatorInfoService.queryById(id));
    }
 
    /**
     * 新增指标取值
     */
    @SaCheckPermission("demo:indicatorInfo:add")
    @Log(title = "指标取值", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping()
    public R<Void> add(@Validated(AddGroup.class) @RequestBody RsIndicatorInfoBo bo) {
        return toAjax(rsIndicatorInfoService.insertByBo(bo));
    }
 
    /**
     * 修改指标取值
     */
    @SaCheckPermission("demo:indicatorInfo:edit")
    @Log(title = "指标取值", businessType = BusinessType.UPDATE)
    @RepeatSubmit()
    @PutMapping()
    public R<Void> edit(@Validated(EditGroup.class) @RequestBody RsIndicatorInfoBo bo) {
        return toAjax(rsIndicatorInfoService.updateByBo(bo));
    }
 
    /**
     * 删除指标取值
     *
     * @param ids 主键串
     */
    @SaCheckPermission("demo:indicatorInfo:remove")
    @Log(title = "指标取值", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R<Void> remove(@NotEmpty(message = "主键不能为空")
                          @PathVariable String[] ids) {
        return toAjax(rsIndicatorInfoService.deleteWithValidByIds(List.of(ids), true));
    }
 
    /**
     * 查询指标取值状态
     */
    @GetMapping("/status")
    public Map<String, Long> status() {
        return rsIndicatorInfoService.status();
    }
 
}