PushVodDataMapper.xml 1.25 KB
<?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.subsidy.mapper.PushVodDataMapper">

    <insert id="insertData">
        insert into push_vod_data (class_id,vod_id,member_id,play_length,suspend_length,play_record,create_date,ip_address)
        VALUES (#{classId}, #{vodId}, #{memberId}, #{playLength},#{suspendLength},#{playRecord},#{createDate},#{ipAddress})
    </insert>

    <select id="vodIds" resultType="long">
        SELECT
            t2.id as 视频id
        FROM
            vod_play_history t2
            left join class_dict t3 on t2.class_id = t3.id
            LEFT JOIN push_vod_data t1 ON t1.class_id = t2.class_id
            AND t1.vod_id = t2.vod_id
            AND t1.member_id = t2.member_id
            AND t1.play_length = t2.play_length + t2.suspend_length
            AND t1.suspend_length = t2.suspend_length
            AND t1.create_date = t2.create_date
        WHERE
            t2.delete_date IS NULL
            AND DATE_FORMAT( DATE_ADD( t2.create_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
            AND t1.create_date IS NULL
            and t3.class_type = 0
    </select>

</mapper>