package org.cs.mgr.user.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.user.service.ISysLogService;
import org.cs.mgr.user.dao.ISysLogDao;
import org.cs.mgr.user.model.SysLog;

/**
 * 
 * @ClassName: ISysLogService
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:28:56
 */
@Service("sysLogService")
public class SysLogService extends BaseService<SysLog> implements ISysLogService{
	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private ISysLogDao sysLogDao;
	
	@Override
	@Transactional(readOnly = true)
	public Pager getSysLogs(Pager page){
		return this.sysLogDao.querySysLogs(page);
	}
	
	/**
	 * 自动生成
	 * @Title: delSysLog 
	 * @Description: TODO
	 * @param id						主键id
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean delSysLog(Integer id){
	
		SysLog sysLog = this.sysLogDao.findById(id);
		if(sysLog != null){
			sysLog.setIsDelete(true);				
			this.sysLogDao.update(sysLog);
		}
		return true;
	}
	
	
	/**
	 * 自动生成
	 * @Title: addSysLog 
	 * @Description: TODO
	 * @param sysLog						对象
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean addSysLog(SysLog sysLog){
	
		if(sysLog != null){
			this.sysLogDao.insert(sysLog);
		}
		return true;
	}
	
	
	/**
	 *  自动生成
	 * @Title: updateSysLog 
	 * @Description: TODO
	 * @param sysLog						对象
	 * @return
	 * @return: boolean
	 */
	@Override
	@Transactional(readOnly = false)
	public boolean updateSysLog(SysLog sysLog){
	
		SysLog sysLog2 = this.sysLogDao.findById(sysLog.getId());
		if(sysLog2 != null){
			sysLog.mergeTo(sysLog2);
			this.sysLogDao.update(sysLog2);
		}
		
		return true;
	}
	
	
	
	
}
