| 1234567891011121314151617181920212223242526 |
- package com.hwmonitor.controller;
- import com.hwmonitor.model.entity.MetricRecord;
- import com.hwmonitor.service.HistoryService;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- @RestController
- @RequestMapping("/api/v1")
- public class HistoryController {
- private final HistoryService historyService;
- public HistoryController(HistoryService historyService) {
- this.historyService = historyService;
- }
- @GetMapping("/history")
- public List<MetricRecord> getHistory(
- @RequestParam(required = false) String type,
- @RequestParam Long from,
- @RequestParam Long to) {
- return historyService.queryHistory(type, from, to);
- }
- }
|