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

import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.deviceData.service.impl.DeviceRealtimedataWormsServiceImpl;
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("/worms")
public class DeviceRealtimedataWormsController extends BaseController {
    /**
     * 虫情实时数据
     */
    @Autowired
    private DeviceRealtimedataWormsServiceImpl deviceRealtimedataWormsServiceImpl;



    /**
     * 获取设备编码虫情的最新一条数据
     */
    @GetMapping("/latest/realtimedata")
    public AjaxResult getLatestWormsRealtimedata(String deviceId) {
        return AjaxResult.success(deviceRealtimedataWormsServiceImpl.getLatestWormsRealtimedata(deviceId));
    }
    @GetMapping("/all/realtimedata")
    public AjaxResult getAllRealtimedata() {
        return AjaxResult.success(deviceRealtimedataWormsServiceImpl.getWormsRealtimedata());
    }
}
