yeg
2026-09-06 b2cf27e4e124608820062ceddea1803d2c2e4b6e
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
package com.battery.business.web;
 
import com.battery.business.report.CompareReportRepository;
import com.battery.business.report.CompareReportService;
import com.battery.business.report.CompareReportRequest;
import jakarta.validation.Valid;
import java.util.List;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
 
/** 对比报表按正式动作授权,创建人不限制报表可见范围。 */
@RestController
@RequestMapping("/system/compare-report")
public class CompareReportController extends BaseController
{
    private final CompareReportRepository reports;
    private final CompareReportService service;
    public CompareReportController(CompareReportRepository reports, CompareReportService service)
    { this.reports = reports; this.service = service; }
 
    /** 查询报表摘要;筛选与分页沿用现有列表交互。 */
    @PreAuthorize("@ss.hasPermi('system:compare-report:query')")
    @GetMapping("/list")
    public AjaxResult list() { return success().put("rows", reports.list()); }
 
    /** 新建页查询可选真实来源。 */
    @PreAuthorize("@ss.hasPermi('system:compare-report:add')")
    @GetMapping("/sources")
    public AjaxResult sources() { return success(service.sources()); }
 
    /** 预览范围由后端验证并读取,不接收浏览器测量事实。 */
    @PreAuthorize("@ss.hasPermi('system:compare-report:add')")
    @PostMapping("/preview")
    public AjaxResult preview(@RequestBody List<CompareReportRequest.Selection> selections)
    { return success(service.preview(selections)); }
 
    /** 首次保存报表及独立版本。 */
    @PreAuthorize("@ss.hasPermi('system:compare-report:add')")
    @PostMapping
    public AjaxResult create(@Valid @RequestBody CompareReportRequest request)
    { return success(service.create(request, getUserId(), getUsername())); }
 
    /** 读取已保存版本,不检查来源测试是否仍存在。 */
    @PreAuthorize("@ss.hasPermi('system:compare-report:query')")
    @GetMapping("/{id}")
    public AjaxResult get(@PathVariable long id) { return success(service.get(id)); }
}