package com.yeejoin.amos.boot.module.jxiop.biz.tdmapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {


    @Select("select LAST(address)address,LAST(gateway_id)gatewayId,LAST(data_type)dataType,LAST(equipment_index_name)equipmentIndexName,LAST(`value_f`)valueF,LAST(equipment_number)equipmentNumber,LAST(created_time)createdTime from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName}  and    gateway_id =#{gatewayId} and  ts >=#{startTime} and ts <=#{endTime}    group by address ")
    List<IndicatorData> selectlastfd(@Param("equipmentIndexName") String equipmentIndexName,@Param("gatewayId") String gatewayId,@Param("startTime") String startTime, @Param("endTime") String endTime);

    @Select("select LAST(address)address,LAST(gateway_id)gatewayId,LAST(data_type)dataType,LAST(equipment_index_name)equipmentIndexName,LAST(`value_f`)valueF,LAST(equipment_number)equipmentNumber,LAST(created_time)createdTime from iot_data.indicator_data where  equipment_specific_name like '%逆变器%' and equipment_index_name =#{equipmentIndexName}  and    gateway_id =#{gatewayId} and  ts >=#{startTime} and ts <=#{endTime}    group by address ")
    List<IndicatorData> selectlastgf(@Param("equipmentIndexName") String equipmentIndexName,@Param("gatewayId") String gatewayId,@Param("startTime") String startTime, @Param("endTime") String endTime);

}
