package com.usky.backend.mapper;

import com.usky.backend.domain.DataRealTime;
//import com.usky.backend.domain.request.DeviceDataInfoVO;
import com.usky.backend.domain.MetricItemVo;
import com.usky.backend.domain.DataHistoryAvergerVO;
import com.usky.backend.domain.DataHistoryTotalVO;
import com.usky.common.mybatis.core.CrudMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 实时数据表 Mapper 接口
 * </p>
 *
 * @author ya
 * @since 2023-06-07
 */
@Repository
public interface DataRealTimeMapper extends CrudMapper<DataRealTime> {

//    int insertHistoryTable(@Param("dataInfo") DeviceDataInfoVO dataInfo, @Param("tableName") String tableName, @Param("curTime") LocalDateTime curTime);
    List<MetricItemVo> QueryHistoryData(@Param("deviceId") String deviceId,@Param("metric") String metric,@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("tableName") String tableName);

    String QueryDeviceTypeAbbrevia(@Param("deviceType") String deviceType);

    List<DataHistoryTotalVO> QueryEachHistoryTotalData(@Param("tableName") String tableName,
                                                       @Param("startTime") String startTime,
                                                       @Param("endTime") String endTime,
                                                       @Param("productCode") String productCode,
                                                       @Param("deviceIdList") List<String> deviceIdList,
                                                       @Param("attributeNameList") List<String> attributeNameList);

    List<DataHistoryTotalVO> QueryTotalHistoryTotalData(@Param("tableName") String tableName,
                                                        @Param("startTime") String startTime,
                                                        @Param("endTime") String endTime,
                                                        @Param("productCode") String productCode,
                                                        @Param("attributeNameList") List<String> attributeNameList);

    List<DataHistoryAvergerVO> QueryEachHistoryAvrgData(@Param("leftLen") Integer leftLen,
                                                        @Param("tableName") String tableName,
                                                        @Param("startTime") String startTime,
                                                        @Param("endTime") String endTime,
                                                        @Param("productCode") String productCode,
                                                        @Param("deviceIdList") List<String> deviceIdList,
                                                        @Param("attributeNameList") List<String> attributeNameList);


    List<DataHistoryAvergerVO> QueryTotalOptHistoryAvrgData(@Param("leftLen") Integer leftLen,
                                                        @Param("tableName") String tableName,
                                                        @Param("startTime") String startTime,
                                                        @Param("endTime") String endTime,
                                                        @Param("productCode") String productCode,
                                                        @Param("deviceIdList") List<String> deviceIdList,
                                                        @Param("attributeNameList") List<String> attributeNameList);

    List<DataHistoryAvergerVO> QueryTotalHistoryAvrgData(@Param("leftLen") Integer leftLen,
                                                        @Param("tableName") String tableName,
                                                        @Param("startTime") String startTime,
                                                        @Param("endTime") String endTime,
                                                        @Param("productCode") String productCode,
                                                        @Param("attributeNameList") List<String> attributeNameList);

}
