ProgramMapper.xml
6.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?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.ProgramMapper">
<update id="updateFilm">
UPDATE iqiyi_program as a
LEFT JOIN iqiyi_movie as c on c.iqiyi_program_id=a.id
set a.platform_info=1,c.priority=10
where a.id = #{id}
</update>
<update id="updatePla">
UPDATE iqiyi_content AS b
set b.platform_info=1
where b.id = #{id}
</update>
<update id="updateTeleplay">
UPDATE iqiyi_program as a
LEFT JOIN iqiyi_movie as c on c.iqiyi_program_id=a.id
set a.platform_info=1,c.priority=10
where a.iqiyi_content_id = #{id}
</update>
<select id="selectDownload" parameterType="com.hui.iqiyi.request.ProgramRequest" resultType="com.hui.iqiyi.request.ProgramRequest">
select ip.iqiyi_content_id,count(ip.id) as downloadCount
from iqiyi_movie as io left join iqiyi_program as ip
on ip.id = io.iqiyi_program_id
where io.local_status = '100' and ip.iqiyi_content_id in
<foreach collection="contentIdList" index="i" item="id" open="(" separator="," close=")">
#{id}
</foreach>
GROUP BY ip.iqiyi_content_id
</select>
<select id="selectProgramList" parameterType="com.hui.iqiyi.request.ProgramRequest" resultType="com.hui.iqiyi.request.ProgramRequest">
select
<include refid="Pro_Cloumn"></include>
from iqiyi_program
<include refid="Where_Cloumn"></include>
</select>
<select id="selectProgramDloadList" parameterType="com.hui.iqiyi.request.ProgramRequest" resultType="com.hui.iqiyi.response.ProgramResponse">
select
<include refid="Pro_Cloumn"></include>
,( select
local_status
from iqiyi_movie m where iqiyi_program_id =p.id ORDER BY create_time desc limit 1 ) as 'localStatus'
from iqiyi_program p
<include refid="Where_Cloumn"></include>
</select>
<select id="selectAllSeven" parameterType="com.hui.iqiyi.request.ProRequest" resultType="com.hui.iqiyi.response.ProgramXRespone">
SELECT DATE_FORMAT(update_time,"%Y-%m-%d")as day ,count(1) as TotlFee ,
sum(file_size)/1024/1024/1024 as TotlSize,sum(duration)/60/60 as TotlDuration
FROM iqiyi_movie
<where>
<if test="proRequest.startTime != null">
and UNIX_TIMESTAMP(update_time) >= UNIX_TIMESTAMP(#{proRequest.startTime})
</if>
<if test="proRequest.endTime != null">
and UNIX_TIMESTAMP(update_time) <= UNIX_TIMESTAMP(#{proRequest.endTime})
</if>
and date_sub(curdate(), interval 7 day) < date(update_time)
and local_status = 100
</where>
GROUP BY DATE_FORMAT(update_time,"%Y-%m-%d")
order by DATE_FORMAT(update_time,"%Y-%m-%d") desc
</select>
<select id="selectAllProgramCount" resultType="com.hui.iqiyi.response.ProgramQBRequest">
select local_status,count(p.id) as total_fee , sum(m.file_size)/1024/1024/1024 as totle_size,sum(m.duration)/60/60 as total_duration
from iqiyi_program p left join iqiyi_movie m on p.id = m.iqiyi_program_id
where p.platform_info like '%1%'
group by local_status
</select>
<select id="selectAllPrograms" resultType="java.lang.Integer">
select count(1) from iqiyi_content
union
select count(1) from iqiyi_program where series_flag = 0
</select>
<select id="selectAllProgra" resultType="com.hui.iqiyi.entity.Program" parameterType="com.hui.iqiyi.request.ProgramRequest">
select a.*
from iqiyi_program as a
LEFT JOIN iqiyi_movie as b on a.id=b.iqiyi_program_id
<where>
<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 #{name}
</if>
<if test="cname!= null and cname!= ''">
AND cname = #{cname}
</if>
<if test="beginTime != null">
and create_time >= #{beginTime}
</if>
<if test="EndTime != null">
and create_time <= #{EndTime}
</if>
<if test="score != null">
and score = #{score}
</if>
<if test="platformInfo != null">
and platform_info = #{platformInfo}
</if>
<if test="downloadStatus !=null" >
and local_status=#{downloadStatus}
</if>
and series_flag=0
</where>
ORDER BY create_time desc
</select>
<sql id="Pro_Cloumn">
id,external_id,content_id,element_type,parent_id,iqiyi_content_id,
series_flag,`name`,country,`language`,`year`,publish_time,`desc`,`status`,tags,focus,`length`,pic_url,
img_pod,cid,cname,excl,type3d,content_type,persons,composers,hosters,dubbers,makers,stars,producers,
song_writers,guesters,writers,directors,main_actors,actors,sname,is_charge,vip_info,is_vip,is_tvod,
is_coupon,is_pkg,org_prc,valid_time,support_prob,prob_duration,search_name,multi_order,volumn_count,
score,sync_status,platform_info,file_status,create_time,update_time
</sql>
<sql id="Where_Cloumn">
<where>
1=1
<if test="iqiyiContentId != null">
and iqiyi_content_id = #{iqiyiContentId}
</if>
<if test="id != null ">
and id = #{id}
</if>
<if test="name != null ">
and name like "%"#{name}"%"
</if>
<if test="localStatus != null">
and local_status = #{localStatus}
</if>
<if test="contentIdList != null">
and ip.iqiyi_content_id in
<foreach collection="contentIdList" index="i" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</sql>
</mapper>