package com.palmnest.dao.dorm.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.palmnest.application.bean.Page;
import com.palmnest.dao.dorm.DormReleaseInfoDao;
import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.model.dorm.DormReleaseInfo;
import com.palmnest.model.dorm.DormRoomerInfo;

/**
 * 放行 退宿申请单DAO实现类
 *
 * @author longmeizhen
 */
@Repository("dormReleaseInfoDao")
public class DormReleaseInfoDaoImpl extends GenericDaoHibernate<DormReleaseInfo, Long> implements DormReleaseInfoDao {
	private static Logger LOG = LoggerFactory.getLogger(DormReleaseInfoDaoImpl.class);

	public DormReleaseInfoDaoImpl() {
		super(DormReleaseInfo.class);
	}

	/**
	 * 根据退宿申请单获取放行操作
	 *
	 * @param checkId
	 * @return
	 */
	@Override
	public DormReleaseInfo getReleaseInfoByCheckId(Long checkId) {
		String sql = "from DormReleaseInfo where sourId=?";
		List<DormReleaseInfo> dormList = getSession().createQuery(sql.toString()).setLong(0, checkId).list();
		if (dormList != null && dormList.size() > 0) {
			return dormList.get(0);
		}
		return null;
	}
}
