package com.jiayue.ipfcst.common.data.repository;

import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
import com.jiayue.ipfcst.common.data.entity.EnvironmentalData;
import com.jiayue.ipfcst.common.data.entity.EquipmentAttribute;
import org.springframework.data.jpa.repository.Query;

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


public interface EnvironmentalDataRepository extends BaseRepository<EnvironmentalData, Integer> {


	@Query("select e from EnvironmentalData e  where e.equipmentTypeEnum=?1 and e.equipmentId=?2 and e.equipmentAttribute=?3 and e.statisticalTime=?4")
	List<EnvironmentalData> queryByTimeAndAttr(EquipmentTypeEnum equipmentType, Integer equipmentId, EquipmentAttribute equipmentAttribute, Date statisticalTime);

	List<EnvironmentalData> findByStatisticalTimeBetweenAndEquipmentTypeEnumInAndEquipmentIdIn(Date startDate,Date endDate,EquipmentTypeEnum[] equipmentTypeEnum,Integer[] eqId);

	List<EnvironmentalData> findByStatisticalTimeBetweenAndEquipmentTypeEnumInAndEquipmentId(Date startDate,Date endDate,EquipmentTypeEnum[] equipmentTypeEnum,Integer eqId);

}
