package com.fastbee.data.controller.aaScreenAgricultural.deviceRealTimeData;

import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.deviceData.service.IDeviceRealtimedataMoistureService;
import com.fastbee.deviceInfo.service.IDeviceInformationMoistureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 获取墒情设备实时数据
 */
@RestController()
@RequestMapping("/moisture")
public class DeviceRealtimedataMoistureController {


    @Autowired
    private IDeviceRealtimedataMoistureService deviceRealtimedataMoistureService;
    @Autowired
    private IDeviceInformationMoistureService deviceInformationMoistureService;


    /**
     * 获取最新一条墒情数据
     */
    @GetMapping("/weather/realtimedata")
    public AjaxResult getLatestWeatherRealtimedata( String deviceId) {
        return AjaxResult.success(deviceRealtimedataMoistureService.getLatestWeatherRealtimedata(deviceId));
    }

    /**
     * 获取墒情设备列表
     */
    @GetMapping("/weather/pullDown")
    public AjaxResult getLatestWeatherPullDown() {
        return AjaxResult.success(deviceInformationMoistureService.selectDeviceInformationMoistureList(null));
    }
}
