/***文档注释***********************************************
 * 作者               :                   易鑫
 * 创建日期      :                   2016.03.12
 * 描述               :                  公告附件信息
 * 注意事项      :                   无
 * 遗留BUG :                      无
 * 修改日期      :                   
 * 修改人员      :                   
 * 修改内容      :                   
 ***********************************************************/

package market.Slm.Notice.impl;

import java.util.List;

import market.Com.pb.SpeOptBaseService;
import market.Com.vo.ResultModel;
import market.Slm.Notice.mapper.SlmNoticeAnnexMapper;
import market.Slm.Notice.service.SlmNoticeAnnexService;
import market.Slm.Notice.vo.SlmNoticeAnnex;

import com.hnshituo.basic.service.impl.BaseServiceImpl;
import com.hnshituo.basic.spring.remoting.annotation.RemoteService;

@RemoteService(path="SlmNoticeAnnexService")
public class SlmNoticeAnnexServiceImpl extends BaseServiceImpl<SlmNoticeAnnex,Object> implements SlmNoticeAnnexService {

	//查询公告附件信息
	public List<SlmNoticeAnnex> doQuery(SlmNoticeAnnex ona){
		return this.getMapper(SlmNoticeAnnexMapper.class).doQuery(ona);
	}

	//新增公告附件信息
	public ResultModel doAdd(SlmNoticeAnnex ona){
		ResultModel rm = new ResultModel();
		try{
			String true_path=this.getBean(SpeOptBaseService.class).doAdd(ona.getAnnex_path());
			if(!"".equals(true_path)&&true_path!=null)
				ona.setAnnex_path(true_path);
			//-------若无附件type----2018.06.12-------
			if(ona.getAnnex_type()==null||"".equals(ona.getAnnex_type())){
				if(ona.getAnnex_name()!=null){
					int point=ona.getAnnex_name().lastIndexOf('.');
					String type=ona.getAnnex_name().substring(point);
					ona.setAnnex_type(type);
				}
			}
			//-------若无附件type----2018.06.12-------
			this.getMapper(SlmNoticeAnnexMapper.class).insert(ona);
			rm.setState("200");
		}catch (Exception e) {
			rm.setState("500");
			rm.setMsgInfo("新增失败"+e.getMessage());
		}
		return rm;
	}

}