package com.palmnest.service.notice.impl;

import com.palmnest.dao.notice.WxpubDao;
import com.palmnest.model.estateserve.WxPublicno;
import com.palmnest.service.impl.GenericManagerImpl;
import com.palmnest.service.notice.WxPubManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("wxPubManager")
public class WxPubManagerImpl extends GenericManagerImpl<WxPublicno, Integer> implements WxPubManager {

	private WxpubDao wxpubDao;

	@Autowired
	public void setRoomInfoDao(WxpubDao wxpubDao) {
		this.wxpubDao = wxpubDao;
		this.dao = wxpubDao;
	}

	@Override
	public String saveOrUpdate(WxPublicno wxPublicno) {

		String isSuccess = "fail";
		if (wxPublicno.getId() == null) {
			WxPublicno model = wxpubDao.save(wxPublicno);
			if (model != null) {
				isSuccess = "success";
			}
		} else {
			try {
				wxpubDao.updateObj(wxPublicno);
				isSuccess = "success";
			} catch (Exception e) {

				isSuccess = "fail";
			}
		}
		return isSuccess;
	}

	@Override
	public WxPublicno getPublicByOrgId(String orgId) {
		return wxpubDao.getPublicByOrgId(orgId);
	}


}
