package com.gonghang.h5clientapp.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gonghang.h5clientapp.beans.dto.CheckTaskDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * Created by shiwn on 2022/8/3 15:33
 */
@Component
public interface CheckTaskMapper extends BaseMapper<CheckTaskDTO> {
    /**
     * @Description: 查询最新状态的任务
     * @Date: 2021/6/30 15:50
     * @Author: shiwn
     * @Param: taskStatus：状态(等待执行0、正在执行1、执行中断2、执行完毕3、超期4、暂停5)
     * @Return:
     */
    @Select("select * from check_task where task_status = #{taskStatus} and robot_id = #{robotId} order by id desc limit 1")
    CheckTaskDTO selectByTaskStatus(@Param("robotId") Integer robotId, @Param("taskStatus") Integer taskStatus);

    @Select("select * from check_task where robot_id = #{robotId} order by id desc limit 1")
    CheckTaskDTO selectNewByRobotId(@Param("robotId") Integer robotId);

    /**
     * @Description: 上海工行 掌上运维——查询任务列表
     * @Author: shiwn
     * @Param: [robotId]
     * @Return:
     */
    List<Map> selectTaskList(@Param("robotId") Integer robotId);
}
