package com.dcs.equipment.controller;

import com.dcs.common.core.domain.AjaxResult;
import com.dcs.equipment.service.DataTwinService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: wangpx
 * @date: 2025-05-06 09:01
 */
@Api
@RestController
@RequestMapping("/datatwin")
public class DataTwinController {
    @Autowired
    private DataTwinService service;

    @RequestMapping("/getEquipmentList")
    public AjaxResult getEquipmentList() {
        return AjaxResult.success(service.getEquipmentList());
    }

    @GetMapping("/getTemperatureList")
    public AjaxResult getTemperatureList() {
        return AjaxResult.success(service.getTemperatureList());
    }

    @GetMapping("/getTemperatureByDay")
    @ApiOperation(value = "获取1天内温度数据")
    public AjaxResult getTemperatureByDay() {
        return AjaxResult.success(service.queryTemperatureByDay());
    }
    @GetMapping("/getTemperatureByWeek")
    @ApiOperation(value = "获取1周内温度数据")
    public AjaxResult getTemperatureByWeek() {
        return AjaxResult.success(service.queryTemperatureByWeek());
    }
    @GetMapping("/getTemperatureByMonth")
    @ApiOperation(value = "获取1月内温度数据")
    public AjaxResult getTemperatureByMonth() {
        return AjaxResult.success(service.queryTemperatureByMonth());
    }

    @GetMapping("/getDataByCode/{equipmentCode}")
    public AjaxResult getDataByCode(@PathVariable("equipmentCode") String equipmentCode) {
        return AjaxResult.success(service.getDataByCode(equipmentCode));
    }
}
