package com.sonic.cow.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sonic.cow.domain.entity.GenImageTask;
import org.apache.ibatis.annotations.Param;

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

/**
 * @author code
 */
public interface GenImageTaskDao extends BaseMapper<GenImageTask> {

    /**
     * 更新任务的已完成数和执行状态
     * @param id
     * @param completedCount
     * @return
     */
    int updateCompletedCount(@Param("id") Long id, @Param("completedCount") Integer completedCount);

    /**
     * 更新心跳数据
     * @param batchNo
     * @return
     */
    int updateHeartBeat(@Param("batchNo") String batchNo);

    /**
     * 扫描心跳过期的是数据
     * @param startTime
     * @return
     */
    List<GenImageTask> scanHeartBeatExpTime(@Param("startTime") LocalDateTime startTime);

}