<?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.xhkjedu.slive.mapper.liveplay.CourseSectionPlaybackMapper">
    <!--修改回放地址-->
    <update id="updatePlayback">
        update l_course_section_playback set endtime=#{playback.endtime},mc=#{playback.mc},
        pb=#{playback.pb},cover=#{playback.cover},duration=#{playback.duration}
        where sid=#{playback.sid}
    </update>

    <!--课节下所有回放-->
    <select id="listSectionPlaybacks" resultType="java.util.Map">
        select p.pbid,p.sectionid,p.begintime,p.endtime,p.mc,p.pb,p.cover,p.duration,p.rn,p.dn,s.teacherid,u.username
        from l_course_section_playback p
        left join l_course_section s on p.sectionid=s.sectionid
        left join t_user u on s.teacherid=u.userid
        where p.sectionid=#{sectionid} and p.pb is not null and p.pb!='' order by p.pbid
    </select>

    <!--修改观看次数-->
    <update id="updateReadnum">
        update l_course_section_playback set rn = rn+1 where pbid=#{pbid};
    </update>

    <!--修改下载次数-->
    <update id="updateDownnum">
        update l_course_section_playback set dn = dn+1 where pbid=#{pbid};
    </update>

</mapper>
