package com.ifish.daoImpl;

import com.ifish.dao.PushRemindDao;
import com.ifish.entity.PushRemind;
import com.ifish.hibernate.HibernateBaseDao;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author: yan.y
 * @Description:
 * @Date: Created in 17:11 2018/1/28
 * @Modified by:
 */
@Repository
public class PushRemindDaoImpl extends HibernateBaseDao<PushRemind ,Integer> implements PushRemindDao {


    /**
     * 根据设备 查询出推送信息表
     * @param deviceId
     * @return
     */
    @Override
    public List<PushRemind> getPushRemindByDeviceId(Integer deviceId) {
        Criterion criterion = Restrictions.eq("id.deviceId",deviceId);
        List<PushRemind> pushReminds = this.findByProperty(criterion);
        return pushReminds;
    }

    @Override
    protected Class<PushRemind> getEntityClass() {
        return PushRemind.class;
    }
}
