package market.Lms.FixedAssets.impl;

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

import market.Com.pb.PbMethod;
import market.Com.pb.SpeOptBaseService;
import market.Lms.FixedAssets.mapper.LmsFixedAssetsAnnexMapper;
import market.Lms.FixedAssets.service.LmsFixedAssetsAnnexService;
import market.Lms.FixedAssets.vo.LmsFixedAssetsAnnex;

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

@RemoteService(path="LmsFixedAssetsAnnex")
public class LmsFixedAssetsAnnexServiceImpl extends BaseServiceImpl<LmsFixedAssetsAnnex,Object> implements LmsFixedAssetsAnnexService{

	//新增
	public String doAdd(LmsFixedAssetsAnnex annex){
		String id = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())+PbMethod.RandomCreate(3);
		annex.setAnnex_no(id);
		if(!annex.getSave_path().contains("group1/M00")){
			annex.setSave_path(this.getBean(SpeOptBaseService.class).doAdd(annex.getSave_path()));			
		}
		this.getMapper(LmsFixedAssetsAnnexMapper.class).insert(annex);
		return id;
	}

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

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

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