MovieMapper.xml 2.22 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.hui.iqiyi.mapper.MovieMapper">

    <update id="updateMoviePriority" parameterType="com.hui.iqiyi.request.MovieRequest">
        update iqiyi_movie as im,(
            select id
            from iqiyi_program
            <where>
                <if test="contentId != null and contentId != ''">
                    iqiyi_content_id = #{contentId}
                </if>
                <if test="contentIdList != null">
                    iqiyi_content_id in
                    <foreach collection="contentIdList" index="i" item="id" open="(" separator="," close=")">
                        #{id}
                    </foreach>
                </if>
            </where>
        ) as ip
        set priority = #{priority}
        where im.iqiyi_program_id = ip.id
    </update>


    <select id="selectAllPopulation" resultType="com.hui.iqiyi.entity.Movie" parameterType="com.hui.iqiyi.entity.Movie">
        select local_status, count(1) as'number',sum(file_size)/1024/1024/1024 as'capacity', sum(duration)/60/60 as'duration'
        from iqiyi_movie where local_status >= 0
        GROUP BY  local_status;
    </select>


    <select id="selectAllSevenxz" resultType="com.hui.iqiyi.response.MovieResponse" parameterType="com.hui.iqiyi.request.ProRequest">
        SELECT DATE_FORMAT(p.update_time,"%Y-%m-%d")as day1 ,count(p.id) as TotlFee3 ,
        sum(m.file_size)/1024/1024/1024 as TotlSize2,sum(m.duration)/60/60 as TotlDuration4
        FROM iqiyi_program p left join iqiyi_movie m on p.id = m.iqiyi_program_id
        <where>
            <if test="proRequest.startTime != null">
                and UNIX_TIMESTAMP(p.update_time) &gt;= UNIX_TIMESTAMP(#{proRequest.startTime})
            </if>
            <if test="proRequest.endTime != null">
                and UNIX_TIMESTAMP(p.update_time) &lt;= UNIX_TIMESTAMP(#{proRequest.endTime})
            </if>
               and date_sub(curdate(), interval 7 day) &lt;date(p.update_time)

        </where>
        GROUP BY DATE_FORMAT(p.update_time,"%Y-%m-%d")
        order by DATE_FORMAT(p.update_time,"%Y-%m-%d") desc



    </select>
</mapper>