ContentMapper.xml 4.02 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.ContentMapper">
    <update id="updateContent" parameterType="com.hui.iqiyi.entity.Content">
        update iqiyi_content
        <include refid="Set_Cloumn"></include>
        <include refid="Where_Cloumn"> </include>
    </update>


    <select id="selectAllSingle" resultType="com.hui.iqiyi.entity.Content">
        select b.*,c.bitrate,c.local_path from iqiyi_content as a
        LEFT JOIN iqiyi_program as b on a.id =b.iqiyi_content_id
        LEFT JOIN iqiyi_movie as c  on b.id=c.iqiyi_program_id
        <where>
           <if test="param1.SeriesFlag !=null and param1.SeriesFlag !='' ">
              series_flag=1
           </if>
           <if test="param2 !=null and param2 !='' ">
            a.id=#{param2}
          </if>
        </where>
    </select>


    <select id="selectAllType" resultType="com.hui.iqiyi.response.ContentResponse" parameterType="com.hui.iqiyi.response.ContentResponse">

        select  contentType,cname,count(id) as num from (
        select cname,'1' as contentType,id from iqiyi_content
        union select cname, '0' as contentType,id from iqiyi_program where series_flag = 0 ) as m
        group by contentType,cname order by contentType,cname
    </select>
    <select id="selectAllCont" resultType="java.lang.Integer">
        select count(1)  from iqiyi_content where platform_info like '%1%'
        union
        select count(1) from iqiyi_program where series_flag = 0 and platform_info like '%1%'

    </select>
    <select id="selectAllContenten" resultType="com.hui.iqiyi.entity.Content" parameterType="com.hui.iqiyi.request.ContentRequest">

        select a.*
        from iqiyi_content as a
        where 1=1
        <if test="id != null and  id != ''">
            and id = #{id}
        </if>
        <if test="cid != null and  cid != ''">
            and cid = #{cid}
        </if>
        <if test="name!= null and  name!= ''">
            AND name like CONCAT('%',CONCAT(#{name},'%'))
        </if>
        <if test="cname!= null and  cname!= ''">
            AND cname = #{cname}
        </if>
        <if test="beginTime != null">
            and create_time &gt;= #{beginTime}
        </if>
        <if test="EndTime != null">
            and create_time &lt;= #{EndTime}
        </if>
        <if test="score != null">
            and score = #{score}
        </if>
        <if test="year != null">
            and year = #{year}
        </if>
        <if test="platformInfo != null">
            and platform_info =  #{platformInfo}
        </if>
        <if test="downloadStatus !=null" >
            and local_status=#{downloadStatus}
        </if>
        ORDER BY create_time,score desc

    </select>
    <select id="selectAllDramaExcel" resultType="com.hui.iqiyi.request.ProgramExcelRequest">
        select a.`name`,a.element_type,a.external_id,a.cname,a.`year`,a.publish_time,a.`desc`,a.tags,a.pic_url,a.directors,a.main_actors,a.writers,a.stars,a.search_name,a.score,a.country,a.`language`,a.total,b.sname,b.iqiyi_content_id,
               c.vid,c.bitrate,c.duration,c.file_size,c.local_status,c.local_path
        from iqiyi_content as a
         LEFT JOIN iqiyi_program as b on a.id =b.iqiyi_content_id
         LEFT JOIN iqiyi_movie as c on b.id =c.iqiyi_program_id
        where a.platform_info=1
        ORDER BY a.platform_info
    </select>

    <sql id="Where_Cloumn">
        <where>
            <if test="id != null and id != ''">
                id = #{id}
            </if>
            <if test="ContentIdList != null">
                id in
                <foreach collection="ContentIdList" index="i" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
        </where>
    </sql>
    <sql id="Set_Cloumn">
        <set>
            <if test="platformInfo != null" >
                platform_info = #{platformInfo},
            </if>
        </set>
    </sql>
</mapper>