package com.palmnest.dao.virtfood.impl;

import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.dao.virtfood.VirtFoodPersonDao;
import com.palmnest.model.virtfood.VirtFoodPerson;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("virtFoodPersonDao")
public class VirtFoodPersonDaoImpl extends GenericDaoHibernate<VirtFoodPerson, Long> implements VirtFoodPersonDao {

	public VirtFoodPersonDaoImpl() {
		super(VirtFoodPerson.class);
	}

	@Override
	public VirtFoodPerson getByopenid(String openId) {

		String strHql = "from VirtFoodPerson where openid=?  ";

		List<VirtFoodPerson> list = getSession().createQuery(strHql).setString(0, openId).list();

		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}


}
