package cn.edu.whu.boot.allocation.mapper;

import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface SimpleTaskMapper {
    @Update("UPDATE task SET is_allocation_optional = #{optional} WHERE id = #{taskId}")
    @Options(flushCache = Options.FlushCachePolicy.TRUE)
    void updateTaskAllocationOptional(@Param("taskId") int taskId, @Param("optional") int optional);

    @Select("SELECT is_allocation_optional FROM task WHERE id = #{taskId}")
    Integer isTaskAllocationOptional(@Param("taskId") int taskId);
}
