ContentPlatformDemandVideoMapperExt.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformDemandVideoMapperExt">
  4. <insert id="batchInsert" parameterType="java.util.List">
  5. INSERT INTO content_platform_demand_video
  6. (dt, channel_name, crowd_segment, dimension, point_type, standard_element, element_dimension,
  7. category_name, category, demand_id, crowd_package, conversion_target, partner, account, scene_value,
  8. demand_strategy, drive_dimension_time, demand_filter_sort_strategy, demand_type,
  9. demand_content_id, demand_content_title, demand_content_topic,
  10. crowd_count, video_count, visit_uv, uv_ratio, total_rov, online_action, match_experiment_id,
  11. match_method, match_video_filter, match_sort,
  12. video_id, config_code, score, sim, rov,
  13. match_text, title, cover, video, experiment_id, scene_sum_rov, channel_level3, status, create_timestamp, update_timestamp)
  14. VALUES
  15. <foreach collection="list" item="item" separator=",">
  16. (#{item.dt}, #{item.channelName}, #{item.crowdSegment}, #{item.dimension}, #{item.pointType}, #{item.standardElement}, #{item.elementDimension},
  17. #{item.categoryName}, #{item.category}, #{item.demandId}, #{item.crowdPackage}, #{item.conversionTarget}, #{item.partner}, #{item.account}, #{item.sceneValue},
  18. #{item.demandStrategy}, #{item.driveDimensionTime}, #{item.demandFilterSortStrategy}, #{item.demandType},
  19. #{item.demandContentId}, #{item.demandContentTitle}, #{item.demandContentTopic},
  20. #{item.crowdCount}, #{item.videoCount}, #{item.visitUv}, #{item.uvRatio}, #{item.totalRov}, #{item.onlineAction}, #{item.matchExperimentId},
  21. #{item.matchMethod}, #{item.matchVideoFilter}, #{item.matchSort},
  22. #{item.videoId}, #{item.configCode}, #{item.score}, #{item.sim}, #{item.rov},
  23. #{item.matchText}, #{item.title}, #{item.cover}, #{item.video}, #{item.experimentId}, #{item.sceneSumRov}, #{item.channelLevel3}, #{item.status}, #{item.createTimestamp}, #{item.updateTimestamp})
  24. </foreach>
  25. </insert>
  26. <delete id="deleteByDt">
  27. DELETE FROM content_platform_demand_video WHERE dt = #{dt}
  28. </delete>
  29. <delete id="deleteByDtLessThan">
  30. DELETE FROM content_platform_demand_video WHERE dt &lt; #{dt}
  31. </delete>
  32. <delete id="deleteByDtAndChannelName">
  33. DELETE FROM content_platform_demand_video WHERE dt = #{dt} AND channel_name = #{channelName}
  34. </delete>
  35. <select id="selectByCondition" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  36. SELECT id, dt, channel_name, channel_level3, crowd_segment, dimension, point_type, standard_element, element_dimension,
  37. category_name, category, demand_id, crowd_package, conversion_target, partner, account, scene_value,
  38. demand_strategy, drive_dimension_time, demand_filter_sort_strategy, demand_type,
  39. demand_content_id, demand_content_title, demand_content_topic,
  40. crowd_count, video_count, visit_uv, uv_ratio, total_rov, online_action, match_experiment_id,
  41. match_method, match_video_filter, match_sort,
  42. video_id, config_code, score, sim, rov,
  43. match_text, title, cover, video, experiment_id, scene_sum_rov, channel_level3, status, create_timestamp, update_timestamp
  44. FROM content_platform_demand_video
  45. WHERE dt = #{dt} AND status = 1
  46. <if test="channelName != null and channelName != ''">
  47. AND channel_name = #{channelName}
  48. </if>
  49. <if test="pointType != null and pointType != ''">
  50. AND point_type = #{pointType}
  51. </if>
  52. <if test="title != null and title != ''">
  53. AND title LIKE CONCAT('%', #{title}, '%')
  54. </if>
  55. <if test="crowdSegment != null and crowdSegment != ''">
  56. AND crowd_segment = #{crowdSegment}
  57. </if>
  58. ORDER BY score DESC
  59. LIMIT #{offset}, #{pageSize}
  60. </select>
  61. <select id="countByCondition" resultType="int">
  62. SELECT COUNT(*) FROM content_platform_demand_video
  63. WHERE dt = #{dt} AND status = 1
  64. <if test="channelName != null and channelName != ''">
  65. AND channel_name = #{channelName}
  66. </if>
  67. <if test="pointType != null and pointType != ''">
  68. AND point_type = #{pointType}
  69. </if>
  70. <if test="title != null and title != ''">
  71. AND title LIKE CONCAT('%', #{title}, '%')
  72. </if>
  73. <if test="crowdSegment != null and crowdSegment != ''">
  74. AND crowd_segment = #{crowdSegment}
  75. </if>
  76. </select>
  77. <select id="getMaxDt" resultType="java.lang.String">
  78. SELECT MAX(dt)
  79. FROM content_platform_demand_video
  80. WHERE status = 1
  81. <if test="channelName != null and channelName != ''">
  82. AND channel_name = #{channelName}
  83. </if>
  84. </select>
  85. <select id="selectChannelNameByGh" resultType="java.lang.String">
  86. SELECT channel_name
  87. FROM content_platform_demand_video
  88. WHERE dt = #{dt}
  89. AND channel_level3 = #{ghName}
  90. AND status = 1
  91. LIMIT 1
  92. </select>
  93. <select id="selectForRecommend" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  94. SELECT id, dt, channel_name, channel_level3, crowd_segment, dimension, point_type, standard_element,
  95. category_name, category, demand_id, crowd_package, conversion_target, partner, account, scene_value,
  96. demand_strategy, drive_dimension_time, demand_filter_sort_strategy, demand_type,
  97. demand_content_id, demand_content_title, demand_content_topic,
  98. crowd_count, video_count, visit_uv, uv_ratio, total_rov, online_action, match_experiment_id,
  99. match_method, match_video_filter, match_sort,
  100. video_id, config_code, score, sim, rov,
  101. match_text, title, cover, video, experiment_id, scene_sum_rov, status, create_timestamp, update_timestamp
  102. FROM content_platform_demand_video
  103. WHERE dt = #{dt} AND status = 1
  104. <if test="excludeCategories != null and excludeCategories.size() > 0">
  105. AND (category IS NULL OR category NOT IN
  106. <foreach collection="excludeCategories" item="c" open="(" close=")" separator=",">
  107. #{c}
  108. </foreach>
  109. )
  110. </if>
  111. <if test="channelName != null and channelName != ''">
  112. AND channel_name = #{channelName}
  113. </if>
  114. <if test="crowdSegment != null and crowdSegment != ''">
  115. AND crowd_segment = #{crowdSegment}
  116. </if>
  117. <if test="demandStrategy != null and demandStrategy != ''">
  118. AND demand_strategy = #{demandStrategy}
  119. </if>
  120. <if test="dimension != null and dimension != ''">
  121. AND dimension = #{dimension}
  122. </if>
  123. <if test="dimensionExclude != null and dimensionExclude != ''">
  124. AND (dimension IS NULL OR dimension &lt;&gt; #{dimensionExclude})
  125. </if>
  126. <if test="demandFilterSortStrategyLike != null and demandFilterSortStrategyLike != ''">
  127. AND demand_filter_sort_strategy LIKE #{demandFilterSortStrategyLike}
  128. </if>
  129. <if test="channelLevel3 != null and channelLevel3 != ''">
  130. AND channel_level3 = #{channelLevel3}
  131. </if>
  132. <if test="driveDimensionTime != null and driveDimensionTime != ''">
  133. AND drive_dimension_time = #{driveDimensionTime}
  134. </if>
  135. <if test="category != null and category != ''">
  136. AND category = #{category}
  137. </if>
  138. <if test="matchMethod != null and matchMethod != ''">
  139. AND match_method = #{matchMethod}
  140. </if>
  141. <if test="crowdPackage != null and crowdPackage != ''">
  142. <choose>
  143. <when test='crowdPackage == "泛人群"'>
  144. AND (crowd_segment IS NULL OR crowd_segment = '' OR crowd_segment = '-' OR crowd_segment = 'null')
  145. </when>
  146. <otherwise>
  147. AND crowd_segment = #{crowdPackage}
  148. </otherwise>
  149. </choose>
  150. </if>
  151. <if test="excludeSelfTitle">
  152. AND (title IS NULL OR demand_content_title IS NULL OR title &lt;&gt; demand_content_title)
  153. </if>
  154. ORDER BY total_rov DESC, score DESC
  155. LIMIT #{limit}
  156. </select>
  157. <select id="selectSearchWhitelist" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  158. SELECT id, dt, channel_name, channel_level3, crowd_segment, dimension, point_type, standard_element,
  159. category_name, category, demand_id, crowd_package, conversion_target, partner, account, scene_value,
  160. demand_strategy, drive_dimension_time, demand_filter_sort_strategy, demand_type,
  161. demand_content_id, demand_content_title, demand_content_topic,
  162. crowd_count, video_count, visit_uv, uv_ratio, total_rov, online_action, match_experiment_id,
  163. match_method, match_video_filter, match_sort,
  164. video_id, config_code, score, sim, rov,
  165. match_text, title, cover, video, experiment_id, scene_sum_rov, status, create_timestamp, update_timestamp
  166. FROM content_platform_demand_video
  167. WHERE dt = #{dt} AND status = 1
  168. AND channel_name = #{channelName}
  169. AND demand_strategy IN ('人群需求', '优质相似')
  170. AND video_id IS NOT NULL
  171. AND rov IS NOT NULL
  172. AND rov &gt;= 0.03
  173. <if test="crowdSegment != null and crowdSegment != ''">
  174. <choose>
  175. <when test='crowdSegment == "泛人群"'>
  176. AND (crowd_segment IS NULL OR crowd_segment = '' OR crowd_segment = '-' OR crowd_segment = 'null')
  177. </when>
  178. <otherwise>
  179. AND crowd_segment = #{crowdSegment}
  180. </otherwise>
  181. </choose>
  182. </if>
  183. <if test="channelLevel3 != null and channelLevel3 != ''">
  184. AND channel_level3 = #{channelLevel3}
  185. </if>
  186. ORDER BY rov DESC, id ASC
  187. </select>
  188. <select id="selectDistinctCrowdPackages" resultType="java.lang.String">
  189. SELECT DISTINCT
  190. CASE
  191. WHEN crowd_segment IS NULL
  192. OR crowd_segment = ''
  193. OR crowd_segment = '-'
  194. OR crowd_segment = 'null'
  195. THEN '泛人群'
  196. ELSE crowd_segment
  197. END AS cp
  198. FROM content_platform_demand_video
  199. WHERE dt = #{dt} AND status = 1
  200. <if test="channelName != null and channelName != ''">
  201. AND channel_name = #{channelName}
  202. </if>
  203. ORDER BY cp
  204. </select>
  205. <select id="selectActiveVideos" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  206. SELECT DISTINCT video_id
  207. FROM content_platform_demand_video
  208. WHERE dt = #{dt} AND status = 1 AND video_id IS NOT NULL
  209. </select>
  210. <update id="updateStatusByVideoId">
  211. UPDATE content_platform_demand_video
  212. SET status = #{status}, update_timestamp = #{updateTimestamp}
  213. WHERE video_id = #{videoId} AND dt = #{dt} AND status = 1
  214. </update>
  215. </mapper>