/**
 * Copyright &copy; 2012-2013 <a href="httparamMap://github.com/lightinit/hsdatagateway">JeeSite</a> All rights reserved.
 */
package com.lightinit.hsdatagateway.modules.sys.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lightinit.hsdatagateway.common.persistence.Page;
import com.lightinit.hsdatagateway.common.service.CrudService;
import com.lightinit.hsdatagateway.common.utils.DateUtils;
import com.lightinit.hsdatagateway.modules.sys.dao.LogDao;
import com.lightinit.hsdatagateway.modules.sys.entity.Log;

/**
 * 日志Service
 * @Author yangrui
 * @version 2014-05-16
 */
@Service
@Transactional(readOnly = true)
public class LogService extends CrudService<LogDao, Log> {

	public Page<Log> findPage(Page<Log> page, Log log) {
		
		// 设置默认时间范围，默认当前月
		if (log.getBeginDate() == null){
			log.setBeginDate(DateUtils.setDays(DateUtils.parseDate(DateUtils.getDate()), 1));
		}
		if (log.getEndDate() == null){
			log.setEndDate(DateUtils.addMonths(log.getBeginDate(), 1));
		}
		
		return super.findPage(page, log);
		
	}
	
}
