package com.usky.backend.controller.api;
import com.usky.backend.client.DataQueryClient;
import com.usky.backend.domain.*;
import com.usky.backend.domain.request.LastQueryVo;
import com.usky.backend.domain.response.LastResultVo;
import com.usky.backend.service.DataQueryService;
import com.usky.common.core.bean.ApiResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  数据统一查询 前端控制器
 * </p>
 *
 */
@RestController
@Api(tags = "数据统一查询RPC")
public class DataQueryApi implements DataQueryClient {

    @Autowired
    private DataQueryService dataQueryService;

    @Override
    public ApiResult<List<StatusVO>> status(){
        return ApiResult.success(dataQueryService.status());
    }

    @Override
    public List<Map<String,Object>> deviceDataTotal(DataTotalRequestVO requestVO){
        List<Map<String,Object>> list = dataQueryService.deviceDataTotal(requestVO);
        return list;
    }

    @Override
    public List<DataAverageResponseVO> deviceDataAverage(DataAverageRequestVO requestVO){
        List<DataAverageResponseVO> list = dataQueryService.deviceDataAverage(requestVO);
        return list;
    }

    @Override
    public List<DataAverageExportVO> DataAverageExport(DataAverageRequestVO requestVO){
        List<DataAverageExportVO> list = dataQueryService.DataAverageExport(requestVO);
        return list;
    }

}