package com.wsm.admin.service.impl;

import com.wsm.admin.dao.IDeviceEventDao;
import com.wsm.admin.model.Device;
import com.wsm.admin.model.DeviceEvent;
import com.wsm.admin.service.IDeviceEventService;
import com.wsm.common.dao.IBaseDao;
import com.wsm.common.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

@Service
public class DeviceEventServiceImpl extends BaseServiceImpl<DeviceEvent, Long> implements IDeviceEventService {

    @Autowired
    private IDeviceEventDao deviceEventDao;

    @Override
    public IBaseDao<DeviceEvent, Long> getBaseDao() {
        return this.deviceEventDao;
    }


    @Override
    public List<DeviceEvent> findByContentAndPostTime(String content, Date postTime) {
        return deviceEventDao.findByContentAndPostTime(content, postTime);
    }

    @Override
    public DeviceEvent findByDeviceIdTop(Long deviceId) {
        return deviceEventDao.findByDeviceIdTop(deviceId);
    }

    @Override
    public DeviceEvent findByStatusAndDeviceId(Long deviceId, Integer status) {
        return deviceEventDao.findByStatusAndDeviceId( deviceId,  status);
    }
}
