package net.educoder.ecsonar.dao;

import net.educoder.ecsonar.model.TaskInfo;
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/1/18
 * @Description:
 */
public interface TaskInfoDao {

    @Insert("insert into task_info(id,language,homework_id,people_number) values(#{id},#{language},#{homeworkId},#{peopleNumber}  )")
    void insertTaskInfo(TaskInfo taskInfo);


    @Update("update task_info set status=#{status},update_time=current_timestamp where id=#{id}")
    void updateTaskInfoStatus(@Param("id") String id, @Param("status") Integer status);


    @Select("select id,homework_id homeworkId,status,people_number peopleNumber,create_time createTime,update_time updateTime from task_info where id=#{id}")
    TaskInfo selectById(String id);
}
