package com.foreverwin.mesnac.equip.mapper;

import com.foreverwin.mesnac.equip.dto.ResourceInspectTaskDto;
import com.foreverwin.mesnac.equip.model.ResourceInspectTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 设备点检任务表 Mapper 接口
 * </p>
 *
 * @author pavel_liu
 * @since 2021-07-20
 */
@Repository
public interface ResourceInspectTaskMapper extends BaseMapper<ResourceInspectTask> {

    /**
     * 自定义方法：查询检验任务---检验任务总览
     * @param resourceInspectTaskDto
     * @return
     */
    List<ResourceInspectTaskDto> findResourceInspectTaskList(ResourceInspectTaskDto resourceInspectTaskDto);

    /**
     * 根据点检计划handle、设备handle，查询处理中DOING、新建NEW的点检任务
     * @param resourceInspectTask
     * @return
     */
    List<ResourceInspectTask> getInspectTaskList(ResourceInspectTask resourceInspectTask);

    List<ResourceInspectTask> getInspectTaskListByCondition(ResourceInspectTask resourceInspectTask);

    /**
     * 查找最新的任务创建时间
     * @param resourceInspectTask
     * @return
     */
    LocalDateTime selectMaxCreateTimeByPlanBoAnd(ResourceInspectTask resourceInspectTask);

    /**
     * 查询处理中的点检任务的最新创建时间
     * @param resourceInspectTask
     * @return
     */
    LocalDateTime getMaxCreateTimeByStatus(ResourceInspectTask resourceInspectTask);

    Integer findResourceTaskByResrceAndCategory(@Param("site") String site,@Param("category") String category, @Param("resrce") String resrce,@Param("planHandle") String planHandle);

}