package com.huimv.environ.eco.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huimv.environ.eco.entity.EcoDeviceFlow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huimv.environ.eco.entity.SysHumidity;
import com.huimv.environ.eco.entity.dto.EcoDeviceDto;
import com.huimv.environ.eco.entity.dto.LastFlowDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zn
 * @since 2022-11-09
 */
@Repository
public interface EcoDeviceFlowMapper extends BaseMapper<EcoDeviceFlow> {

    List<LastFlowDto> getLastFlow(@Param("farmId") String farmId);

    List<LastFlowDto>  getLastFlowByPigpenId(@Param("pigpenId") String pigpenId,@Param("farmId") String farmId);

    List<EcoDeviceDto> listDevice(@Param("farmId") String farmId,
                                  @Param("unitId") String unitId,
                                  @Param("startDate") String startDate,
                                  @Param("endDate") String endDate);

    List<EcoDeviceDto> listDayDevice(@Param("farmId") String farmId,
                                     @Param("unitId") String unitId);


    List<EcoDeviceDto> listWeekDevice(@Param("farmId") String farmId,
                                     @Param("unitId") String unitId);

    List<EcoDeviceDto> listMonthDevice(@Param("farmId") String farmId,
                                     @Param("unitId") String unitId);

    LastFlowDto getLastFlowByUnitId(@Param("unitId") String unitId);


    LastFlowDto getUnitLastFlow(@Param("deviceCode") String deviceCode);

    //读取烘干数据
    List<EcoDeviceFlow> getLastDryDeviceFlow(@Param("dryDeviceCode") String deviceCode, @Param("startTime") Date startTime,@Param("endTime") String endTime);
}
