package com.saye.hrs.service.system.impl;

import com.saye.hrs.commons.date.DateDUtil;
import com.saye.hrs.mapper.system.LoggerMapper;
import com.saye.hrs.model.Logger;
import com.saye.hrs.service.system.LoggerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Service
@Transactional
public class LoggerServiceImpl implements LoggerService{

	@Autowired
	private LoggerMapper loggerMapper;
	
	/**
	 * @description 查询所有日志数据
	 * @author thuang       
	 * @created 2019年11月14日 下午1:22:00
	 */
	@Override
	public List<Logger> findLogger(HashMap<Object, Object> map) throws Exception {
		
		List<Logger> list = loggerMapper.findLoggers(map);
		return list;
	}

	@Override
	public void addHisLog(HashMap<Object, Object> map) {
		Date d = new Date();
		map.put("create_date", DateDUtil.DateToStr("yyyy-MM-dd", d));
		map.put("create_time", DateDUtil.DateToStr("yyyy-MM-dd HH:mm:ss", d));
		loggerMapper.addHisLog(map);
	}

	@Override
	public List<HashMap<Object, Object>> findHisLogList(HashMap<Object, Object> map) {
		
		return loggerMapper.findHisLogList(map);
	}

	
}
