zxl
2025-12-22 cc4a3ff932b1e768914a4aff0eeaa866d08f9b91
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
package com.ycl.controller;
 
import com.ycl.common.group.Update;
import com.ycl.common.group.Add;
import com.ycl.domain.form.ReportReviewForm;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import lombok.RequiredArgsConstructor;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotEmpty;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ycl.service.ReportService;
import com.ycl.common.base.Result;
import com.ycl.domain.form.ReportForm;
import com.ycl.domain.query.ReportQuery;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
 
/**
 *  前端控制器
 *
 * @author zxl
 * @since 2025-12-18
 */
@Validated
@RequiredArgsConstructor
@Api(value = "", tags = "管理")
@RestController
@RequestMapping("/report")
public class ReportController {
 
    private final ReportService reportService;
 
    @PostMapping
    @ApiOperation(value = "添加", notes = "添加")
    @PreAuthorize("@ss.hasPermi('report:add')")
    public Result add(@RequestBody @Validated(Add.class) ReportForm form) {
        return reportService.add(form);
    }
 
    @PutMapping
    @ApiOperation(value = "修改", notes = "修改")
    @PreAuthorize("@ss.hasPermi('report:edit')")
    public Result update(@RequestBody @Validated(Update.class) ReportForm form) {
        return reportService.update(form);
    }
 
    @DeleteMapping("/{id}")
    @ApiOperation(value = "ID删除", notes = "ID删除")
    public Result removeById(@PathVariable("id") String id) {
        return reportService.removeById(id);
    }
 
    @DeleteMapping("/batch")
    @ApiOperation(value = "批量删除", notes = "批量删除")
    @PreAuthorize("@ss.hasPermi('report:del:batch')")
    public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List<String> ids) {
        return reportService.remove(ids);
    }
 
    @GetMapping("/listByMonth")
    @ApiOperation(value = "按年月返回日历以及对应数据", notes = "")
    public Result listByMonth(ReportQuery query) {
        return reportService.listByMonth(query);
    }
    @GetMapping("/page")
    public Result page(ReportQuery query){
        return reportService.getPage(query);
    }
 
    @GetMapping("/{id}")
    @ApiOperation(value = "详情", notes = "详情")
    @PreAuthorize("@ss.hasPermi('report:detail')")
    public Result detail(@PathVariable("id") Integer id) {
        return reportService.detail(id);
    }
 
    @GetMapping("/list")
    @PreAuthorize("@ss.hasPermi('report:list')")
    @ApiOperation(value = "列表", notes = "列表")
    public Result list() {
        return reportService.all();
    }
 
    @PutMapping("/review")
    public Result review(ReportReviewForm form) {
        return reportService.review(form);
    }
}