package com.palmnest.dao.dinner.impl;

import java.util.List;

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

import com.palmnest.dao.dinner.RechargeSetDao;
import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.model.dinner.RechargeSet;

@Repository("rechargeSetDao")
public class RechargeSetDaoImpl extends GenericDaoHibernate<RechargeSet, Long> implements RechargeSetDao {

	private static Logger LOG = LoggerFactory.getLogger(RechargeSetDaoImpl.class);

	public RechargeSetDaoImpl() {
		super(RechargeSet.class);
	}

	@Override
	public RechargeSet findByOrgId(String orgId) {
		String sql = "from RechargeSet where isEnabled='1' and orgId=? ";
		List<RechargeSet> list = getSession().createQuery(sql).setString(0, orgId).list();
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}
}
