package com.palmnest.dao.repair.impl;

import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.dao.repair.RepairReturnVisitDao;
import com.palmnest.model.repair.RepairReturnVisit;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("repairReturnVisitDao")
public class RepairReturnVisitDaoImpl extends GenericDaoHibernate<RepairReturnVisit, Long> implements RepairReturnVisitDao {

	public RepairReturnVisitDaoImpl() {
		super(RepairReturnVisit.class);
	}

	@Override
	public RepairReturnVisit findBy(Long billId) {
		String                  strHql = "from RepairReturnVisit where billId = ?";
		List<RepairReturnVisit> list   = getSession().createQuery(strHql).setLong(0, billId).list();
		if (list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
