package com.palmnest.dao.estateserve.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.palmnest.dao.estateserve.ScTextpicvoicetempDao;
import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.model.estateserve.Textpicvoicetemp;

/**
 * 报修图片信息管理实现DAO
 *
 * @author ldb
 */
@Repository("scTextpicvoicetempDao")
public class ScTextpicvoicetempDaoImpl extends GenericDaoHibernate<Textpicvoicetemp, Integer>
		implements ScTextpicvoicetempDao {
	public ScTextpicvoicetempDaoImpl() {
		super(Textpicvoicetemp.class);
	}

	@Override
	public Textpicvoicetemp save(Textpicvoicetemp scTextpicvoicetemp) {
		return super.save(scTextpicvoicetemp);
	}

	@Override
	public void delTextpicvoicetemp(final Integer... ids) {
		this.getSession().createQuery("delete from Textpicvoicetemp where replyKeywordsId in (:ids)")
				.setParameterList("ids", ids)
				.executeUpdate();
	}

	@Override
	public void delTextpicvoicetempByKeywordsId(Integer keywordId) {
		this.getSession().createQuery("delete from Textpicvoicetemp where replyKeywordsId=:id").setParameter("id", keywordId).executeUpdate();
	}

	@Override
	public Textpicvoicetemp gettextpicvoicetemp(Integer kId) {
		List<Textpicvoicetemp> list = this.getSession().createQuery("from Textpicvoicetemp where replyKeywordsId=:id").setParameter("id", kId).list();
		if (list != null && list.size() > 0) {
			return list.get(0);
		} else {
			return null;
		}
	}
}
