<?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.zhongzheng.modules.polyv.mapper.PolyvVideoMapper">

    <resultMap type="com.zhongzheng.modules.polyv.domain.PolyvVideo" id="PolyvVideoResult">
        <result property="polyvId" column="polyv_id"/>
        <result property="vid" column="vid"/>
        <result property="tag" column="tag"/>
        <result property="mp4" column="mp4"/>
        <result property="playerWidth" column="player_width"/>
        <result property="title" column="title"/>
        <result property="df" column="df"/>
        <result property="times" column="times"/>
        <result property="mp4_1" column="mp4_1"/>
        <result property="mp4_2" column="mp4_2"/>
        <result property="cataid" column="cataid"/>
        <result property="map4_3" column="map4_3"/>
        <result property="swfLink" column="swf_link"/>
        <result property="status" column="status"/>
        <result property="seed" column="seed"/>
        <result property="flv1" column="flv1"/>
        <result property="flv2" column="flv2"/>
        <result property="flv3" column="flv3"/>
        <result property="sourceFile" column="source_file"/>
        <result property="duration" column="duration"/>
        <result property="firstImage" column="first_image"/>
        <result property="originalDefinition" column="original_definition"/>
        <result property="context" column="context"/>
        <result property="playerheight" column="playerheight"/>
        <result property="ptime" column="ptime"/>
        <result property="sourceFilesize" column="source_filesize"/>
        <result property="md5checksum" column="md5checksum"/>
        <result property="tsfilesize1" column="tsfilesize1"/>
        <result property="tsfilesize2" column="tsfilesize2"/>
        <result property="tsfilesize3" column="tsfilesize3"/>
        <result property="previewVid" column="preview_vid"/>
        <result property="keepsource" column="keepsource"/>
        <result property="cataName" column="cata_name"/>
        <result property="defaultVideo" column="default_video"/>
        <result property="uploaderEmail" column="uploader_email"/>
        <result property="uploaderName" column="uploader_name"/>
        <result property="uploaderRole" column="uploader_role"/>
        <result property="hlsLevel" column="hls_level"/>
        <result property="imagesB" column="images_b"/>
        <result property="images" column="images"/>
        <result property="imageUrls" column="image_urls"/>
        <result property="fileSize" column="file_size"/>
        <result property="hls" column="hls"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <select id="selectByVID" parameterType="Long"  resultMap="PolyvVideoResult">
        select * from polyv_video where 1=1
        <if test="Vid != null and Vid != ''">
            AND vid = #{Vid}
        </if>
    </select>

    <select id="selectGoodsPlanCount" parameterType="map"  resultType="long">
        SELECT
            COUNT( 1 )
        FROM
            user_study_record usr
        WHERE
            usr.plan_id = #{planId}
          and usr.goods_id = #{goodsId}
    </select>
</mapper>