package org.cs.mgr.order.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Map;
import org.cs.core.service.impl.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.cs.util.Pager;
import org.cs.mgr.order.service.IMgmOrderTransferService;
import org.cs.mgr.order.dao.IMgmOrderTransferDao;
import org.cs.mgr.order.model.MgmOrderTransfer;

/**
 * 
 * @ClassName: IMgmOrderTransferService
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:29:03
 */
@Service("mgmOrderTransferService")
public class MgmOrderTransferService extends BaseService<MgmOrderTransfer> implements IMgmOrderTransferService{
	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private IMgmOrderTransferDao mgmOrderTransferDao;
	
	@Override
	@Transactional(readOnly = true)
	public Pager getMgmOrderTransfers(Pager page){
		return this.mgmOrderTransferDao.queryMgmOrderTransfers(page);
	}
	
	/**
	 * 自动生成
	 * @Title: delMgmOrderTransfer 
	 * @Description: TODO
	 * @param id						主键id
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean delMgmOrderTransfer(Integer id){
	
		MgmOrderTransfer mgmOrderTransfer = this.mgmOrderTransferDao.findById(id);
		if(mgmOrderTransfer != null){
			mgmOrderTransfer.setIsDelete(true);				
			this.mgmOrderTransferDao.update(mgmOrderTransfer);
		}
		return true;
	}
	
	
	/**
	 * 自动生成
	 * @Title: addMgmOrderTransfer 
	 * @Description: TODO
	 * @param mgmOrderTransfer						对象
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean addMgmOrderTransfer(MgmOrderTransfer mgmOrderTransfer){
	
		if(mgmOrderTransfer != null){
			this.mgmOrderTransferDao.insert(mgmOrderTransfer);
		}
		return true;
	}
	
	
	/**
	 *  自动生成
	 * @Title: updateMgmOrderTransfer 
	 * @Description: TODO
	 * @param mgmOrderTransfer						对象
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean updateMgmOrderTransfer(MgmOrderTransfer mgmOrderTransfer){
	
		MgmOrderTransfer mgmOrderTransfer2 = this.mgmOrderTransferDao.findById(mgmOrderTransfer.getId());
		if(mgmOrderTransfer2 != null){
			mgmOrderTransfer.mergeTo(mgmOrderTransfer2);
			this.mgmOrderTransferDao.update(mgmOrderTransfer2);
		}
		
		return true;
	}
	
	
	
	
}
