ContentPlatformDemandVideoMapperExt.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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, 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. video_id, config_code, score, sim, rov,
  12. match_text, title, cover, video, experiment_id, channel_level3, status, create_timestamp, update_timestamp)
  13. VALUES
  14. <foreach collection="list" item="item" separator=",">
  15. (#{item.dt}, #{item.channelName}, #{item.crowdSegment}, #{item.dimension}, #{item.pointType}, #{item.standardElement}, #{item.elementDimension},
  16. #{item.categoryName}, #{item.demandId}, #{item.crowdPackage}, #{item.conversionTarget}, #{item.partner}, #{item.account}, #{item.sceneValue},
  17. #{item.demandStrategy}, #{item.driveDimensionTime}, #{item.demandFilterSortStrategy}, #{item.demandType},
  18. #{item.demandContentId}, #{item.demandContentTitle}, #{item.demandContentTopic},
  19. #{item.crowdCount}, #{item.videoCount}, #{item.visitUv}, #{item.uvRatio}, #{item.totalRov}, #{item.onlineAction}, #{item.matchExperimentId},
  20. #{item.videoId}, #{item.configCode}, #{item.score}, #{item.sim}, #{item.rov},
  21. #{item.matchText}, #{item.title}, #{item.cover}, #{item.video}, #{item.experimentId}, #{item.channelLevel3}, #{item.status}, #{item.createTimestamp}, #{item.updateTimestamp})
  22. </foreach>
  23. </insert>
  24. <delete id="deleteByDt">
  25. DELETE FROM content_platform_demand_video WHERE dt = #{dt}
  26. </delete>
  27. <delete id="deleteByDtAndChannelName">
  28. DELETE FROM content_platform_demand_video WHERE dt = #{dt} AND channel_name = #{channelName}
  29. </delete>
  30. <select id="selectByCondition" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  31. SELECT id, dt, channel_name, channel_level3, crowd_segment, dimension, point_type, standard_element, element_dimension,
  32. category_name, demand_id, crowd_package, conversion_target, partner, account, scene_value,
  33. demand_strategy, drive_dimension_time, demand_filter_sort_strategy, demand_type,
  34. demand_content_id, demand_content_title, demand_content_topic,
  35. crowd_count, video_count, visit_uv, uv_ratio, total_rov, online_action, match_experiment_id,
  36. video_id, config_code, score, sim, rov,
  37. match_text, title, cover, video, experiment_id, channel_level3, status, create_timestamp, update_timestamp
  38. FROM content_platform_demand_video
  39. WHERE dt = #{dt} AND status = 1
  40. <if test="channelName != null and channelName != ''">
  41. AND channel_name = #{channelName}
  42. </if>
  43. <if test="pointType != null and pointType != ''">
  44. AND point_type = #{pointType}
  45. </if>
  46. <if test="title != null and title != ''">
  47. AND title LIKE CONCAT('%', #{title}, '%')
  48. </if>
  49. <if test="crowdSegment != null and crowdSegment != ''">
  50. AND crowd_segment = #{crowdSegment}
  51. </if>
  52. ORDER BY score DESC
  53. LIMIT #{offset}, #{pageSize}
  54. </select>
  55. <select id="countByCondition" resultType="int">
  56. SELECT COUNT(*) FROM content_platform_demand_video
  57. WHERE dt = #{dt} AND status = 1
  58. <if test="channelName != null and channelName != ''">
  59. AND channel_name = #{channelName}
  60. </if>
  61. <if test="pointType != null and pointType != ''">
  62. AND point_type = #{pointType}
  63. </if>
  64. <if test="title != null and title != ''">
  65. AND title LIKE CONCAT('%', #{title}, '%')
  66. </if>
  67. <if test="crowdSegment != null and crowdSegment != ''">
  68. AND crowd_segment = #{crowdSegment}
  69. </if>
  70. </select>
  71. <select id="getMaxDt" resultType="java.lang.String">
  72. SELECT MAX(dt) FROM content_platform_demand_video WHERE status = 1
  73. </select>
  74. <select id="selectForRecommend" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  75. SELECT id, dt, channel_name, channel_level3, crowd_segment, dimension, point_type, standard_element,
  76. category_name, demand_id, crowd_package, conversion_target, partner, account, scene_value,
  77. demand_strategy, drive_dimension_time, demand_filter_sort_strategy, demand_type,
  78. demand_content_id, demand_content_title, demand_content_topic,
  79. crowd_count, video_count, visit_uv, uv_ratio, total_rov, online_action, match_experiment_id,
  80. video_id, config_code, score, sim, rov,
  81. match_text, title, cover, video, experiment_id, status, create_timestamp, update_timestamp
  82. FROM content_platform_demand_video
  83. WHERE dt = #{dt} AND status = 1
  84. <if test="channelName != null and channelName != ''">
  85. AND channel_name = #{channelName}
  86. </if>
  87. <if test="crowdSegment != null and crowdSegment != ''">
  88. AND crowd_segment = #{crowdSegment}
  89. </if>
  90. <if test="demandStrategy != null and demandStrategy != ''">
  91. AND demand_strategy = #{demandStrategy}
  92. </if>
  93. <if test="dimension != null and dimension != ''">
  94. AND dimension = #{dimension}
  95. </if>
  96. <if test="dimensionExclude != null and dimensionExclude != ''">
  97. AND (dimension IS NULL OR dimension &lt;&gt; #{dimensionExclude})
  98. </if>
  99. <if test="demandFilterSortStrategyLike != null and demandFilterSortStrategyLike != ''">
  100. AND demand_filter_sort_strategy LIKE #{demandFilterSortStrategyLike}
  101. </if>
  102. <if test="channelLevel3 != null and channelLevel3 != ''">
  103. AND channel_level3 = #{channelLevel3}
  104. </if>
  105. <if test="driveDimensionTime != null and driveDimensionTime != ''">
  106. AND drive_dimension_time = #{driveDimensionTime}
  107. </if>
  108. <if test="excludeSelfTitle">
  109. AND (title IS NULL OR demand_content_title IS NULL OR title &lt;&gt; demand_content_title)
  110. </if>
  111. ORDER BY total_rov DESC, score DESC
  112. LIMIT #{limit}
  113. </select>
  114. <select id="selectActiveVideos" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  115. SELECT DISTINCT video_id
  116. FROM content_platform_demand_video
  117. WHERE dt = #{dt} AND status = 1
  118. </select>
  119. <update id="updateStatusByVideoId">
  120. UPDATE content_platform_demand_video
  121. SET status = #{status}, update_timestamp = #{updateTimestamp}
  122. WHERE video_id = #{videoId} AND dt = #{dt} AND status = 1
  123. </update>
  124. </mapper>