<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yx.face.dao.FaceTaskDao">
    <update id="updateFaceTaskStatus">
        UPDATE face_task SET status=1
        WHERE device_sn = #{deviceSn}
        AND user_id IN
        <foreach collection="userIds" index="index" item="userId" open="(" close=")" separator=",">
            #{userId}
        </foreach>
    </update>


    <select id="getFaceTaskId" resultType="java.lang.Long">
        SELECT id
        FROM face_task
        WHERE device_sn = #{deviceSn}
          AND user_id = #{userId}
        LIMIT 0,1
    </select>
    <select id="getFaceTaskList" resultType="com.yx.face.model.entity.FaceTask">
        SELECT device_sn,
               user_id
        FROM face_task
        WHERE
           <![CDATA[ task_time <= #{now} ]]>
          AND status = 0
    </select>


</mapper>

