<?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="cn.reghao.tnb.sb.multi.mybatis.mapper.two.VideoPostMapper">
    <update id="updateSetDelete">
        update vod_video_post
        set deleted=1
        where `status`=4
    </update>
    <update id="updatePublishBy">
        update vod_video_post
        set publish_by=#{newUser}
        where publish_by=#{oldUser}
    </update>

    <select id="findAll" resultType="cn.reghao.tnb.sb.multi.mybatis.model.two.VideoPost">
        select *
        from vod_video_post
        where `status`=4
    </select>
    <select id="findByVideoFileIds" resultType="cn.reghao.tnb.sb.multi.mybatis.model.two.VideoPost">
        select *
        from vod_video_post
        where video_file_id in
        <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
            #{id}
        </foreach>
    </select>
    <select id="findByVideoFileId" resultType="cn.reghao.tnb.sb.multi.mybatis.model.two.VideoPost">
        select *
        from vod_video_post
        where video_file_id=#{videoFileId}
    </select>
    <select id="findVideoPostByUserId" resultType="cn.reghao.tnb.sb.multi.mybatis.model.two.VideoPost">
        select *
        from vod_video_post
        where publish_by=#{userId}
    </select>
    <select id="findCamRecord" resultType="cn.reghao.tnb.sb.multi.mybatis.model.two.CamRecord">
        select cam_id,video_file_id,start_at
        from my_cam_record
        where cam_id=#{camId}
        order by start_at
        limit #{start},#{end}
    </select>
</mapper>
