package com.wsm.admin.dao; import com.wsm.admin.model.DeviceEvent; import com.wsm.common.dao.IBaseDao; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.Date; import java.util.List; @Repository public interface IDeviceEventDao extends IBaseDao { List findByContentAndPostTime(String content, Date postTime); @Query(value = "SELECT * from tb_device_event where device_id = ?1 and rec_status = 'A' order by update_time desc LIMIT 0,1", nativeQuery = true) DeviceEvent findByDeviceIdTop(Long id); @Query(value = "SELECT * from tb_device_event where device_id = ?1 and rec_status = 'A' and status = ?2 ", nativeQuery = true) DeviceEvent findByStatusAndDeviceId(Long deviceId, Integer status); }