package com.palmnest.service.notice.impl;

import com.palmnest.application.bean.Page;
import com.palmnest.dao.notice.WxpubLibOrgDao;
import com.palmnest.model.estateserve.WxPublicnoOrgRelation;
import com.palmnest.service.impl.GenericManagerImpl;
import com.palmnest.service.notice.WxpubLibOrgManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("wxpubLibOrgManager")
public class WxpubLibOrgManagerImpl extends GenericManagerImpl<WxPublicnoOrgRelation, Integer> implements WxpubLibOrgManager {

	private WxpubLibOrgDao wxpubLibOrgDao;

	@Autowired
	public void setRoomInfoDao(WxpubLibOrgDao wxpubLibOrgDao) {
		this.wxpubLibOrgDao = wxpubLibOrgDao;
		this.dao = wxpubLibOrgDao;
	}

	@Override
	public String saveOrUpdate(WxPublicnoOrgRelation wxPubLibOrg) {

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

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

	@Override
	public Page getByOrId(int orId)
			throws Exception {

		return wxpubLibOrgDao.getByOrId(orId);
	}


}
