package market.Lms.Consumable.impl;

import java.text.SimpleDateFormat;
import java.util.Date;

import market.Com.pb.PbMethod;
import market.Com.pb.SpeOptBaseService;
import market.Lms.Consumable.mapper.LmsConsumableAnnexMapper;
import market.Lms.Consumable.service.LmsConsumableAnnexService;
import market.Lms.Consumable.vo.LmsConsumableAnnex;

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

@RemoteService(path="LmsConsumableAnnex")
public class LmsConsumableAnnexServiceImpl extends BaseServiceImpl<LmsConsumableAnnex,Object> implements LmsConsumableAnnexService{
	//新增
	public String doAdd(LmsConsumableAnnex annex){
		String id = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())+PbMethod.RandomCreate(3);
		annex.setAnnex_no(id);
		if(!annex.getAnnex_path().contains("group1/M00")){
			annex.setAnnex_path(this.getBean(SpeOptBaseService.class).doAdd(annex.getAnnex_path()));			
		}
		this.getMapper(LmsConsumableAnnexMapper.class).insert(annex);
		return id;
	}

	//删除
	public void doDelete(LmsConsumableAnnex annex){
		this.getMapper(LmsConsumableAnnexMapper.class).delete(annex.getAnnex_no());
	}

	//修改
	public void doUpdate(LmsConsumableAnnex annex){
		this.getMapper(LmsConsumableAnnexMapper.class).update(annex);
	}

	//查询
	public LmsConsumableAnnex doQuery(String annexNo){
		LmsConsumableAnnex annex = new LmsConsumableAnnex();
		annex = this.getMapper(LmsConsumableAnnexMapper.class).findById(annexNo);
		return annex;
	}
}
