package com.palmnest.dao.repair.impl;

import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.dao.repair.RepairConfigDao;
import com.palmnest.model.repair.RepairConfig;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("repairConfigDao")
public class RepairConfigDaoImpl extends GenericDaoHibernate<RepairConfig, Long> implements RepairConfigDao {

	public RepairConfigDaoImpl() {
		super(RepairConfig.class);

	}

	@Override
	public RepairConfig getByOrgId(Integer org_id) {

		String             strHql = "from RepairConfig where org_id = ?  ";
		List<RepairConfig> list   = getSession().createQuery(strHql).setInteger(0, org_id).list();
		if (list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
