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.IMgmOrderBreakService;
import org.cs.mgr.order.dao.IMgmOrderBreakDao;
import org.cs.mgr.order.model.MgmOrderBreak;

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

	@Autowired
	private IMgmOrderBreakDao mgmOrderBreakDao;
	
	@Override
	@Transactional(readOnly = true)
	public Pager getMgmOrderBreaks(Pager page){
		return this.mgmOrderBreakDao.queryMgmOrderBreaks(page);
	}
	
	/**
	 * 自动生成
	 * @Title: delMgmOrderBreak 
	 * @Description: TODO
	 * @param id						主键id
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean delMgmOrderBreak(Integer id){
	
		MgmOrderBreak mgmOrderBreak = this.mgmOrderBreakDao.findById(id);
		if(mgmOrderBreak != null){
			mgmOrderBreak.setIsDelete(true);				
			this.mgmOrderBreakDao.update(mgmOrderBreak);
		}
		return true;
	}
	
	
	/**
	 * 自动生成
	 * @Title: addMgmOrderBreak 
	 * @Description: TODO
	 * @param mgmOrderBreak						对象
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean addMgmOrderBreak(MgmOrderBreak mgmOrderBreak){
	
		if(mgmOrderBreak != null){
			this.mgmOrderBreakDao.insert(mgmOrderBreak);
		}
		return true;
	}
	
	
	/**
	 *  自动生成
	 * @Title: updateMgmOrderBreak 
	 * @Description: TODO
	 * @param mgmOrderBreak						对象
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean updateMgmOrderBreak(MgmOrderBreak mgmOrderBreak){
	
		MgmOrderBreak mgmOrderBreak2 = this.mgmOrderBreakDao.findById(mgmOrderBreak.getId());
		if(mgmOrderBreak2 != null){
			mgmOrderBreak.mergeTo(mgmOrderBreak2);
			this.mgmOrderBreakDao.update(mgmOrderBreak2);
		}
		
		return true;
	}

	@Override
	public Pager getMgmOrderBreaksByS(Pager page, Map<String, String> map) {
		// TODO Auto-generated method stub
		return this.mgmOrderBreakDao.getMgmOrderBreaksByS(page,map);
	}

	@Override
	public Pager queryMgmOrderBreaksById(Pager page, Map<String, String> map) {
		// TODO Auto-generated method stub
		return this.mgmOrderBreakDao.queryMgmOrderBreaksById(page, map);
	}
	
	
	
	
}
