package com.palmnest.dao.notice.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.palmnest.application.bean.Page;
import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.dao.notice.PhoneMessageDao;
import com.palmnest.dao.notice.WxpubDao;
import com.palmnest.model.estateserve.WxPublicno;
import com.palmnest.model.notice.PhoneMessageModel;
import com.palmnest.model.repair.RepairBill;

@Repository("WxpubDao")
public class WxpubDaoImpl extends GenericDaoHibernate<WxPublicno, Integer> implements WxpubDao {
	public WxpubDaoImpl() {
		super(WxPublicno.class);

	}

	@Override
	public WxPublicno getPublicByOrgId(String orgId) {
		StringBuffer sbf = new StringBuffer();
		sbf.append("SELECT DISTINCT p.* FROM tb_wxpublicno p LEFT JOIN tr_wxpublicno_org wpo ON wpo.publicNoId = p.id WHERE wpo.organizationId = " + orgId + " and p.serviceType<>3 LIMIT 1");
		List<WxPublicno> list = getSession().createSQLQuery(sbf.toString()).addEntity(WxPublicno.class).list();
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
