package com.ruoyi.robot.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.robot.mapper.LdTaskExecutionLogMapper;
import com.ruoyi.robot.domain.LdTaskExecutionLog;
import com.ruoyi.robot.service.ILdTaskExecutionLogService;

/**
 * 任务执行记录Service接口实现
 * 
 * @author ruoyi
 */
@Service
public class LdTaskExecutionLogServiceImpl implements ILdTaskExecutionLogService
{
    @Autowired
    private LdTaskExecutionLogMapper ldTaskExecutionLogMapper;

    /**
     * 查询执行记录
     * 
     * @param id 执行记录主键
     * @return 执行记录
     */
    @Override
    public LdTaskExecutionLog selectLdTaskExecutionLogById(Long id)
    {
        return ldTaskExecutionLogMapper.selectLdTaskExecutionLogById(id);
    }

    /**
     * 查询执行记录列表
     * 
     * @param log 执行记录
     * @return 执行记录
     */
    @Override
    public List<LdTaskExecutionLog> selectLdTaskExecutionLogList(LdTaskExecutionLog log)
    {
        return ldTaskExecutionLogMapper.selectLdTaskExecutionLogList(log);
    }

    /**
     * 根据任务ID查询执行记录
     * 
     * @param taskId 任务ID
     * @return 执行记录列表
     */
    @Override
    public List<LdTaskExecutionLog> selectLdTaskExecutionLogByTaskId(Long taskId)
    {
        return ldTaskExecutionLogMapper.selectLdTaskExecutionLogByTaskId(taskId);
    }

    /**
     * 查询某设备今日的执行记录
     * 
     * @param deviceId 设备ID
     * @return 执行记录列表
     */
    @Override
    public List<LdTaskExecutionLog> selectTodayExecutionLogsByDeviceId(String deviceId)
    {
        return ldTaskExecutionLogMapper.selectTodayExecutionLogsByDeviceId(deviceId, 
            new java.text.SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date()));
    }

    /**
     * 新增执行记录
     * 
     * @param log 执行记录
     * @return 结果
     */
    @Override
    public int insertLdTaskExecutionLog(LdTaskExecutionLog log)
    {
        return ldTaskExecutionLogMapper.insertLdTaskExecutionLog(log);
    }

    /**
     * 修改执行记录
     * 
     * @param log 执行记录
     * @return 结果
     */
    @Override
    public int updateLdTaskExecutionLog(LdTaskExecutionLog log)
    {
        return ldTaskExecutionLogMapper.updateLdTaskExecutionLog(log);
    }

    /**
     * 删除执行记录
     * 
     * @param id 执行记录主键
     * @return 结果
     */
    @Override
    public int deleteLdTaskExecutionLogById(Long id)
    {
        return ldTaskExecutionLogMapper.deleteLdTaskExecutionLogById(id);
    }

    /**
     * 批量删除执行记录
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int deleteLdTaskExecutionLogByIds(Long[] ids)
    {
        return ldTaskExecutionLogMapper.deleteLdTaskExecutionLogByIds(ids);
    }

    /**
     * 根据任务ID删除执行记录
     * 
     * @param taskId 任务ID
     * @return 结果
     */
    @Override
    public int deleteLdTaskExecutionLogByTaskId(Long taskId)
    {
        return ldTaskExecutionLogMapper.deleteLdTaskExecutionLogByTaskId(taskId);
    }
}
