package org.cs.mgr.setting.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.setting.service.ISysAdvPositionService;
import org.cs.mgr.setting.dao.ISysAdvPositionDao;
import org.cs.mgr.setting.model.SysAdvPosition;

/**
 * 
 * @ClassName: ISysAdvPositionService
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:29:15
 */
@Service("sysAdvPositionService")
public class SysAdvPositionService extends BaseService<SysAdvPosition> implements ISysAdvPositionService{
	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private ISysAdvPositionDao sysAdvPositionDao;
	
	@Override
	@Transactional(readOnly = true)
	public Pager getSysAdvPositions(Pager page){
		return this.sysAdvPositionDao.querySysAdvPositions(page);
	}
	
	/**
	 * 自动生成
	 * @Title: delSysAdvPosition 
	 * @Description: TODO
	 * @param id						主键id
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean delSysAdvPosition(Integer id){
	
		SysAdvPosition sysAdvPosition = this.sysAdvPositionDao.findById(id);
		if(sysAdvPosition != null){
			sysAdvPosition.setIsDelete(true);				
			this.sysAdvPositionDao.update(sysAdvPosition);
		}
		return true;
	}
	
	
	/**
	 * 自动生成
	 * @Title: addSysAdvPosition 
	 * @Description: TODO
	 * @param sysAdvPosition						对象
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean addSysAdvPosition(SysAdvPosition sysAdvPosition){
	
		if(sysAdvPosition != null){
			this.sysAdvPositionDao.insert(sysAdvPosition);
		}
		return true;
	}
	
	
	/**
	 *  自动生成
	 * @Title: updateSysAdvPosition 
	 * @Description: TODO
	 * @param sysAdvPosition						对象
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean updateSysAdvPosition(SysAdvPosition sysAdvPosition){
	
		SysAdvPosition sysAdvPosition2 = this.sysAdvPositionDao.findById(sysAdvPosition.getId());
		if(sysAdvPosition2 != null){
			sysAdvPosition.mergeTo(sysAdvPosition2);
			this.sysAdvPositionDao.update(sysAdvPosition2);
		}
		
		return true;
	}
	
	
	
	
}
