ContentPlatformPlanMapperExt.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.ContentPlatformPlanMapperExt">
  4. <insert id="insertGzhPlanReturnId" useGeneratedKeys="true" keyProperty="id">
  5. insert into content_platform_gzh_plan (publish_stage, account_id,
  6. scene, external_id, create_account_id,
  7. create_timestamp, update_timestamp)
  8. values (#{record.publishStage}, #{record.accountId}, #{record.scene}, #{record.externalId},
  9. #{record.createAccountId}, #{record.createTimestamp}, #{record.updateTimestamp})
  10. </insert>
  11. <select id="getGzhPlanCount" resultType="java.lang.Integer">
  12. select count(*)
  13. from content_platform_gzh_plan
  14. where create_account_id = #{createAccountId}
  15. <if test="param.accountId != null and param.accountId != ''">
  16. and account_id = #{param.accountId}
  17. </if>
  18. <if test="param.publishStage != null and param.publishStage != ''">
  19. and publish_stage = #{param.publishStage}
  20. </if>
  21. <if test="param.createTimestampStart != null and param.createTimestampStart != ''">
  22. and create_timestamp > #{param.createTimestampStart}
  23. </if>
  24. <if test="param.createTimestampEnd != null and param.createTimestampEnd != ''">
  25. and create_timestamp &lt; #{param.createTimestampEnd}
  26. </if>
  27. <if test="param.title != null and param.title != ''">
  28. and id in (select plan_id from content_platform_gzh_plan_video where title like concat('%', #{param.title},
  29. '%'))
  30. </if>
  31. </select>
  32. <select id="getGzhPlanList"
  33. resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlan">
  34. select *
  35. from content_platform_gzh_plan
  36. where create_account_id = #{createAccountId}
  37. <if test="param.accountId != null and param.accountId != ''">
  38. and account_id = #{param.accountId}
  39. </if>
  40. <if test="param.publishStage != null and param.publishStage != ''">
  41. and publish_stage = #{param.publishStage}
  42. </if>
  43. <if test="param.createTimestampStart != null and param.createTimestampStart != ''">
  44. and create_timestamp > #{param.createTimestampStart}
  45. </if>
  46. <if test="param.createTimestampEnd != null and param.createTimestampEnd != ''">
  47. and create_timestamp &lt; #{param.createTimestampEnd}
  48. </if>
  49. <if test="param.title != null and param.title != ''">
  50. and id in (select plan_id from content_platform_gzh_plan_video where title like concat('%', #{param.title},
  51. '%'))
  52. </if>
  53. order by create_timestamp desc
  54. limit #{offset}, #{pageSize}
  55. </select>
  56. <select id="getGzhPlanExists"
  57. resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlan">
  58. select *
  59. from content_platform_gzh_plan
  60. where account_id = #{accountId}
  61. and scene = #{scene}
  62. <if test="id != null">
  63. and id != #{id}
  64. </if>
  65. limit 1
  66. </select>
  67. <select id="getVideoMaxDt" resultType="java.lang.String">
  68. select max(dt)
  69. from content_platform_video
  70. </select>
  71. <select id="getVideoCount" resultType="java.lang.Integer">
  72. select count(1)
  73. from content_platform_video
  74. where dt = #{dt}
  75. <if test="param.title!= null and param.title!= ''">
  76. and title like concat('%', #{param.title}, '%')
  77. </if>
  78. <if test="param.category!= null and param.category!= ''">
  79. and category = #{param.category}
  80. </if>
  81. </select>
  82. <select id="getVideoList" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideo">
  83. select *
  84. from content_platform_video
  85. where dt = #{dt}
  86. <if test="param.title!= null and param.title!= ''">
  87. and title like concat('%', #{param.title}, '%')
  88. </if>
  89. <if test="param.category!= null and param.category!= ''">
  90. and category = #{param.category}
  91. </if>
  92. order by score desc
  93. limit #{offset}, #{pageSize}
  94. </select>
  95. <select id="getVideoCategoryList" resultType="java.lang.String">
  96. select distinct category
  97. from content_platform_video
  98. where dt = #{dt}
  99. </select>
  100. <insert id="batchInsertContentPlatformVideo">
  101. insert into content_platform_video (dt, video_id, category, title, video, score, create_timestamp)
  102. values
  103. <foreach collection="records" item="item" separator=",">
  104. (#{item.dt}, #{item.videoId}, #{item.category}, #{item.title}, #{item.video}, #{item.score},
  105. #{item.createTimestamp})
  106. </foreach>
  107. </insert>
  108. <select id="getQwPlanCount" resultType="java.lang.Integer">
  109. select count(*)
  110. from content_platform_qw_plan
  111. where create_account_id = #{createAccountId}
  112. and type = #{param.type}
  113. <if test="param.scene != null">
  114. and scene &lt; #{param.scene}
  115. </if>
  116. <if test="param.title != null and param.title != ''">
  117. and id in (select plan_id from content_platform_qw_plan_video where title like concat('%', #{param.title},
  118. '%'))
  119. </if>
  120. </select>
  121. <select id="getQwPlanList"
  122. resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwPlan">
  123. select *
  124. from content_platform_qw_plan
  125. where create_account_id = #{createAccountId}
  126. and type = #{param.type}
  127. <if test="param.scene != null">
  128. and scene &lt; #{param.scene}
  129. </if>
  130. <if test="param.title != null and param.title != ''">
  131. and id in (select plan_id from content_platform_qw_plan_video where title like concat('%', #{param.title},
  132. '%'))
  133. </if>
  134. order by create_timestamp desc
  135. limit #{offset}, #{pageSize}
  136. </select>
  137. <insert id="batchInsertQwPlan">
  138. insert into content_platform_qw_plan (`type`, scene, page_url, root_source_id,
  139. create_account_id, create_timestamp, update_timestamp
  140. )
  141. values
  142. <foreach collection="records" item="item" separator=",">
  143. (#{item.type}, #{item.scene}, #{item.pageUrl}, #{item.rootSourceId},
  144. #{item.createAccountId}, #{item.createTimestamp}, #{item.updateTimestamp}
  145. )
  146. </foreach>
  147. </insert>
  148. <insert id="insertQwPlanReturnId" useGeneratedKeys="true" keyProperty="id">
  149. insert into content_platform_qw_plan (`type`, scene, page_url, root_source_id, create_account_id,
  150. create_timestamp, update_timestamp)
  151. values ( #{record.type}, #{record.scene}, #{record.pageUrl}, #{record.rootSourceId},
  152. #{record.createAccountId}, #{record.createTimestamp}, #{record.updateTimestamp})
  153. </insert>
  154. <select id="getGzhPlanVideoListByCooperateAccountId"
  155. resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideo">
  156. select cpgpv.*
  157. from content_platform_gzh_plan_video cpgpv
  158. join content_platform_gzh_plan cpgp on cpgp.id = cpgpv.plan_id
  159. join content_platform_gzh_account cpgac on cpgac.id = cpgp.account_id
  160. where cpgac.gh_id = #{ghId}
  161. and cpgac.status = 1
  162. and cpgp.scene = 0
  163. </select>
  164. </mapper>