/**
 * 
 */
package com.huatek.busi.service.impl.job;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.huatek.busi.dto.ScheduleJobLogDto;
import com.huatek.busi.entity.ScheduleJobLog;
import com.huatek.busi.mapper.ScheduleJobLogMapper;
import com.huatek.busi.service.job.ScheduleJobLogService;
import com.huatek.busi.vo.ScheduleJobLogVo;
import com.huatek.torch.frame.tools.ConstantUtil;
import com.huatek.torch.frame.tools.ResultUtil;

/**
  * @ClassName: ScheduleJobLogServiceImpl
  * @FullClassPath: com.huatek.busi.service.impl.job.ScheduleJobLogServiceImpl
  * @Description: 定时任务日志
  * @author: Arno
  * @date: Jul 4, 2019 10:41:29 AM
  * @version: 1.0
  */
@Component
@Service(interfaceClass = ScheduleJobLogService.class)
@Transactional(rollbackFor = Exception.class)
public class ScheduleJobLogServiceImpl implements ScheduleJobLogService {
 
//	@Autowired
//	private ScheduleJobLogDao scheduleJobLogDao;
	
	@Autowired
	private ScheduleJobLogMapper scheduleJobLogMapper;

	@Override
	public void insertLog(ScheduleJobLog log) {
		
//		scheduleJobLogDao.add(log);
		scheduleJobLogMapper.insertScheduleJobLog(log);
		
	}
	
	/**
	 * 获取定时任务日志列表
	 */
	@Override
	public Map<String, Object> findScheduleJobLogPage(ScheduleJobLogDto scheduleJobLog) {
		// TODO Auto-generated method stub
		if (scheduleJobLog.getPage() != null && scheduleJobLog.getLimit() != null) {
            PageHelper.startPage(scheduleJobLog.getPage(), scheduleJobLog.getLimit());
        }
        Page<ScheduleJobLogVo> scheduleJobList = scheduleJobLogMapper.findScheduleJobLogPage(scheduleJobLog);
		return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, scheduleJobList.getTotal(), "", scheduleJobList.getResult());
	}
	
}
