package org.jeecg.modules.stm.metric.controller;

import java.util.List;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.stm.metric.entity.MetricMonitorSetHistory;
import org.jeecg.modules.stm.metric.service.IMetricMonitorSetHistoryService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;

import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
 

/**
 * @Description: 指标历史表
 * @Author: jeecg-boot
 * @Date:   2025-07-06
 * @Version: V1.0
 */
  
@RestController
@RequestMapping("/metric/metricMonitorSetHistory")
@Slf4j
public class MetricMonitorSetHistoryController extends JeecgController<MetricMonitorSetHistory, IMetricMonitorSetHistoryService> {
	@Autowired
	private IMetricMonitorSetHistoryService metricMonitorSetHistoryService;
	

	@GetMapping(value = "/findHistoryByMetricNo")
	public Result<List<MetricMonitorSetHistory>> findHistoryByMetricCode(MetricMonitorSetHistory metricMonitorSetHistory,
								   HttpServletRequest req) {
		QueryWrapper<MetricMonitorSetHistory> queryWrapper = QueryGenerator.initQueryWrapper(metricMonitorSetHistory, req.getParameterMap());
		List<MetricMonitorSetHistory> list = metricMonitorSetHistoryService.list(queryWrapper);
		return Result.OK(list);
	}


	 @GetMapping(value = "/saveHistory")
	 public void saveHistory(MetricMonitorSetHistory metricMonitorSetHistory, HttpServletRequest req) {
		 QueryWrapper<MetricMonitorSetHistory> queryWrapper = QueryGenerator.initQueryWrapper(metricMonitorSetHistory, req.getParameterMap());
		 metricMonitorSetHistoryService.save(metricMonitorSetHistory);

	 }




}
