package market.Lms.Consumable.impl;

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

import market.Com.pb.PbMethod;
import market.Lms.Consumable.mapper.LmsConsumableOffGoodInfoMapper;
import market.Lms.Consumable.service.LmsConsumableOffGoodInfoService;
import market.Lms.Consumable.vo.LmsConsumableOffGoodInfo;

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

@RemoteService(path="LmsConsumableOffGoodInfo")
public class LmsConsumableOffGoodInfoServiceImpl extends BaseServiceImpl<LmsConsumableOffGoodInfo,Object> implements LmsConsumableOffGoodInfoService{

	//新增
	public String doAdd(LmsConsumableOffGoodInfo offGood){
		String id = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())+PbMethod.RandomCreate(3);
		String userId = (String) this.getSession().getAttribute(HomeService.SESSION_USER_ID);
		String userName=(String) this.getSession().getAttribute(HomeService.SESSION_USER_NAME);
		offGood.setOff_good(id);
		offGood.setCreate_man_no(userId);
		offGood.setCreate_man_name(userName);
		offGood.setCreate_time(new Date());
		offGood.setValid_flag("1");
		this.getMapper(LmsConsumableOffGoodInfoMapper.class).insert(offGood);
		return id;
	}

	//删除
	public void doDelete(LmsConsumableOffGoodInfo offGood){
		this.getMapper(LmsConsumableOffGoodInfoMapper.class).delete(offGood.getOff_good());
	}

	//修改
	public void doUpdate(LmsConsumableOffGoodInfo offGood){
		this.getMapper(LmsConsumableOffGoodInfoMapper.class).update(offGood);
	}

	//查询
	public LmsConsumableOffGoodInfo doQuery(String offGoodNo){
		LmsConsumableOffGoodInfo offGood = new LmsConsumableOffGoodInfo();
		offGood = this.getMapper(LmsConsumableOffGoodInfoMapper.class).findById(offGoodNo);
		return offGood;
	}
}
