ContentPlatformDemandVideoMapperExt.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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,
  7. category_name, visit_uv, total_rov, video_id, config_code, score, sim, rov,
  8. match_text, title, cover, video, status, create_timestamp, update_timestamp)
  9. VALUES
  10. <foreach collection="list" item="item" separator=",">
  11. (#{item.dt}, #{item.channelName}, #{item.crowdSegment}, #{item.dimension}, #{item.pointType}, #{item.standardElement},
  12. #{item.categoryName}, #{item.visitUv}, #{item.totalRov}, #{item.videoId}, #{item.configCode}, #{item.score}, #{item.sim}, #{item.rov},
  13. #{item.matchText}, #{item.title}, #{item.cover}, #{item.video}, #{item.status}, #{item.createTimestamp}, #{item.updateTimestamp})
  14. </foreach>
  15. </insert>
  16. <delete id="deleteByDt">
  17. DELETE FROM content_platform_demand_video WHERE dt = #{dt}
  18. </delete>
  19. <select id="selectByCondition" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  20. SELECT id, dt, channel_name, crowd_segment, dimension, point_type, standard_element,
  21. category_name, visit_uv, total_rov, video_id, config_code, score, sim, rov,
  22. match_text, title, cover, video, status, create_timestamp, update_timestamp
  23. FROM content_platform_demand_video
  24. WHERE dt = #{dt} AND status = 1
  25. <if test="channelName != null and channelName != ''">
  26. AND channel_name = #{channelName}
  27. </if>
  28. <if test="pointType != null and pointType != ''">
  29. AND point_type = #{pointType}
  30. </if>
  31. <if test="title != null and title != ''">
  32. AND title LIKE CONCAT('%', #{title}, '%')
  33. </if>
  34. <if test="crowdSegment != null and crowdSegment != ''">
  35. AND crowd_segment = #{crowdSegment}
  36. </if>
  37. ORDER BY score DESC
  38. LIMIT #{offset}, #{pageSize}
  39. </select>
  40. <select id="countByCondition" resultType="int">
  41. SELECT COUNT(*) FROM content_platform_demand_video
  42. WHERE dt = #{dt} AND status = 1
  43. <if test="channelName != null and channelName != ''">
  44. AND channel_name = #{channelName}
  45. </if>
  46. <if test="pointType != null and pointType != ''">
  47. AND point_type = #{pointType}
  48. </if>
  49. <if test="title != null and title != ''">
  50. AND title LIKE CONCAT('%', #{title}, '%')
  51. </if>
  52. <if test="crowdSegment != null and crowdSegment != ''">
  53. AND crowd_segment = #{crowdSegment}
  54. </if>
  55. </select>
  56. <select id="getMaxDt" resultType="java.lang.String">
  57. SELECT MAX(dt) FROM content_platform_demand_video WHERE status = 1
  58. </select>
  59. <select id="selectActiveVideos" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformDemandVideo">
  60. SELECT DISTINCT video_id
  61. FROM content_platform_demand_video
  62. WHERE dt = #{dt} AND status = 1
  63. </select>
  64. <update id="updateStatusByVideoId">
  65. UPDATE content_platform_demand_video
  66. SET status = #{status}, update_timestamp = #{updateTimestamp}
  67. WHERE video_id = #{videoId} AND dt = #{dt} AND status = 1
  68. </update>
  69. </mapper>