package market.Lms.Consumable.impl;

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

import market.Com.pb.PbMethod;
import market.Lms.Consumable.mapper.LmsConsumableOverGoodInfoMapper;
import market.Lms.Consumable.service.LmsConsumableOverGoodInfoService;
import market.Lms.Consumable.vo.LmsConsumableOverGoodInfo;

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

@RemoteService(path="LmsConsumableOverGoodInfo")
public class LmsConsumableOverGoodInfoServiceImpl extends BaseServiceImpl<LmsConsumableOverGoodInfo,Object> implements LmsConsumableOverGoodInfoService{

	//新增
	public String doAdd(LmsConsumableOverGoodInfo overGood){
		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);
		overGood.setOver_good_no(id);
		overGood.setCreate_man_no(userId);
		overGood.setCreate_man_name(userName);
		overGood.setCreate_time(new Date());
		overGood.setValid_flag("1");
		this.getMapper(LmsConsumableOverGoodInfoMapper.class).insert(overGood);
		return id;
	}

	//删除
	public void doDelete(LmsConsumableOverGoodInfo overGood){
		this.getMapper(LmsConsumableOverGoodInfoMapper.class).delete(overGood.getOver_good_no());
	}

	//修改
	public void doUpdate(LmsConsumableOverGoodInfo overGood){
		this.getMapper(LmsConsumableOverGoodInfoMapper.class).update(overGood);
	}

	//查询
	public LmsConsumableOverGoodInfo doQuery(String overGoodNo){
		LmsConsumableOverGoodInfo overGood = new LmsConsumableOverGoodInfo();
		overGood = this.getMapper(LmsConsumableOverGoodInfoMapper.class).findById(overGoodNo);
		return overGood;
	}
}
