package net.educoder.ecsonar.dao;

import net.educoder.ecsonar.model.CloudTaskInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @Author: youys
 * @Date: 2022/7/5
 * @Description:
 */
public interface CloudTaskInfoDao {

    /**
     * 插入云脑扫描任务信息
     * @param cloudTaskInfo
     */
    @Insert("insert into cloud_task_info(id, people_number) values(#{id},#{peopleNumber})")
    void insertCloudTaskInfo(CloudTaskInfo cloudTaskInfo);


    /**
     * 查询任务信息
     * @param id
     * @return
     */
    @Select("select id,status,people_number peopleNumber from cloud_task_info where id=#{id}")
    CloudTaskInfo queryById(String id);

    /**
     * 更新任务状态
     * @param id
     * @param status
     */
    @Update("update cloud_task_info set status=#{status},update_time=current_timestamp where id=#{id}")
    void updateCloudTaskInfoStatus(@Param("id") String id, @Param("status") Integer status);
}
