package com.fastbee.data.controller;

import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.data.service.gis.IGisDeviceService;
import com.fastbee.iot.domain.Device;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "GIS设备")
@RestController
@RequestMapping("/gis/device")
public class GisDeviceController extends BaseController {
    @Autowired
    private IGisDeviceService gisDeviceService;

    /**
     * 获取设备数量和列表
     */
    @ApiOperation("获取设备数量和列表")
    @GetMapping("/totalAndList")
    public AjaxResult totalAndList(Device device) {
        return AjaxResult.success(gisDeviceService.totalAndList(device));
    }

    /**
     * 根据设备id获取实时数据
     */
    @GetMapping(value = "/getRealTimeDataByDevicerId")
    public AjaxResult getRealTimeDataByDevicerId(Long deviceId)
    {
        return success(gisDeviceService.getRealTimeDataByDevicerId(deviceId));
    }

    /**
     * 根据设备id获取流量水量
     */
    @GetMapping(value = "/getDeviceLogCurves")
    public AjaxResult getDeviceLogCurves(Long deviceId)
    {
        return success(gisDeviceService.getDeviceLogCurves(deviceId));
    }

}
