LongArticleBaseMapper.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper">
  4. <delete id="deleteByDateStrGreaterThanEqual">
  5. delete from datastat_sort_strategy where date_str >= #{dateStr}
  6. </delete>
  7. <delete id="deleteByDateStrBetween">
  8. delete from datastat_sort_strategy where date_str between #{dateStrBegin} and #{dateStrEnd} and type = #{type}
  9. </delete>
  10. <select id="countGetOffVideos" resultType="java.lang.Long">
  11. select count(1) from get_off_videos limit #{offset}, #{pageSize}
  12. </select>
  13. <insert id="batchInsertDatastatSortStrategy">
  14. INSERT INTO datastat_sort_strategy
  15. (date_str, publish_time, account_mode, account_source, account_type, account_status, bussiness_type,
  16. account_name, strategy, fans, view_count, avg_view_count, first_view_count, first_avg_view_count,
  17. first_level, fission0, fission0_head, fission0_recommend, fission1, fission1_head, fission1_recommend, fission2,
  18. fission2_head, fission2_recommend, second_first_level, second_fission0, second_fission0_head,
  19. second_fission0_recommend, second_fission1, second_fission1_head, second_fission1_recommend,
  20. second_fission2, second_fission2_head, second_fission2_recommend, third_first_level, third_fission0,
  21. third_fission0_head, third_fission0_recommend, third_fission1, third_fission1_head, third_fission1_recommend,
  22. third_fission2,third_fission2_head, third_fission2_recommend,
  23. read_rate, read_fans_rate, first_read_rate, fission0_first_rate, fission0_head_first_rate, fission0_recommend_first_rate, fission1_fission0_rate,
  24. fission0_read_avg_rate, his_read_rate, his_first_read_rate, his_fission0_first_rate, position, gh_id, title,
  25. link, wx_sn, fission0_read_avg_100_rate, fission0_read_avg_500_rate, fission0_read_avg_1000_rate,
  26. crawler_plan_name, crawler_plan_tag, produce_plan_name, produce_plan_tag, publish_plan_name,
  27. publish_mini_program_insert_strategy, publish_mini_program_insert_use_type, publish_mini_program_num,
  28. source_produce_plan_name, account_create_timestamp, publish_timestamp, type, source_type, source_id)
  29. VALUES
  30. <foreach collection="list" item="item" separator=",">
  31. (#{item.dateStr}, #{item.publishTime}, #{item.accountMode}, #{item.accountSource}, #{item.accountType},
  32. #{item.accountStatus}, #{item.businessType}, #{item.accountName}, #{item.strategy}, #{item.fans},
  33. #{item.viewCount}, #{item.avgViewCount}, #{item.firstViewCount}, #{item.firstAvgViewCount},
  34. #{item.firstLevel}, #{item.fission0},#{item.fission0Head},#{item.fission0Recommend}, #{item.fission1},
  35. #{item.fission1Head},#{item.fission1Recommend}, #{item.fission2},#{item.fission2Head},
  36. #{item.fission2Recommend}, #{item.secondFirstLevel}, #{item.secondFission0},
  37. #{item.secondFission0Head}, #{item.secondFission0Recommend}, #{item.secondFission1},
  38. #{item.secondFission1Head}, #{item.secondFission1Recommend}, #{item.secondFission2},
  39. #{item.secondFission2Head}, #{item.secondFission2Recommend}, #{item.thirdFirstLevel},
  40. #{item.thirdFission0}, #{item.thirdFission0Head}, #{item.thirdFission0Recommend},
  41. #{item.thirdFission1}, #{item.thirdFission1Head}, #{item.thirdFission1Recommend},
  42. #{item.thirdFission2}, #{item.thirdFission2Head}, #{item.thirdFission2Recommend}, #{item.readRate},
  43. #{item.readFansRate}, #{item.firstReadRate}, #{item.fission0FirstRate}, #{item.fission0HeadFirstRate},
  44. #{item.fission0RecommendFirstRate}, #{item.fission1Fission0Rate},
  45. #{item.fission0ReadAvgRate}, #{item.hisReadRate}, #{item.hisFirstReadRate}, #{item.hisFission0FirstRate},
  46. #{item.position}, #{item.ghId}, #{item.title}, #{item.link},
  47. #{item.wxSn}, #{item.fission0ReadAvg100Rate}, #{item.fission0ReadAvg500Rate},
  48. #{item.fission0ReadAvg1000Rate}, #{item.crawlerPlanName}, #{item.crawlerPlanTag},
  49. #{item.producePlanName}, #{item.producePlanTag}, #{item.publishPlanName},
  50. #{item.publishMiniProgramInsertStrategy}, #{item.publishMiniProgramInsertUseType},
  51. #{item.publishMiniProgramNum}, #{item.sourceProducePlanName}, #{item.accountCreateTimestamp},
  52. #{item.publishTimestamp}, #{item.type}, #{item.sourceType}, #{item.sourceId})
  53. </foreach>
  54. </insert>
  55. <insert id="batchInsertArticlePoolPromotionSource">
  56. insert into article_pool_promotion_source
  57. (channel_content_id, source_publish_content_id, root_publish_content_id, root_produce_content_id, title,
  58. title_md5, level, status, deleted, create_timestamp, update_timestamp)
  59. values
  60. <foreach collection="list" item="item" separator=",">
  61. (#{item.channelContentId}, #{item.sourcePublishContentId}, #{item.rootPublishContentId},
  62. #{item.rootProduceContentId}, #{item.title}, #{item.titleMd5}, #{item.level}, #{item.status},
  63. #{item.deleted}, #{item.createTimestamp}, #{item.updateTimestamp})
  64. </foreach>
  65. </insert>
  66. <update id="updateRootProduceContentLevel">
  67. update article_pool_promotion_source set level = #{level} where root_produce_content_id = #{rootProduceContentId}
  68. </update>
  69. <delete id="deleteDatastatScoreByDtIn">
  70. delete from datastat_score where dt in
  71. <foreach collection="dateStrList" item="item" open="(" close=")" separator=",">
  72. #{item}
  73. </foreach>
  74. </delete>
  75. <insert id="batchInsertDatastatScore">
  76. INSERT INTO datastat_score
  77. (dt, gh_id, account_name, `index`, title, category, strategy, score, similarity, category_score,
  78. view_count_rate, his_fission_avg_read_rate_rate, his_fission_avg_read_sum_rate,
  79. his_fission_de_weight_avg_read_sum_rate, account_pre_distribute, view_count_rate_v2, content_pool,
  80. flow_ctl_decrease, his_fission_open_rate, view_multiplier, crawler_days_decrease, read_count, read_avg,
  81. read_avg_rate, first_pub_interval, publish_content_id, crawler_channel_content_id, source_id,
  82. publish_timestamp)
  83. VALUES
  84. <foreach collection="list" item="item" separator=",">
  85. (#{item.dt}, #{item.ghId}, #{item.accountName}, #{item.index}, #{item.title}, #{item.category},
  86. #{item.strategy}, #{item.score}, #{item.similarity}, #{item.categoryScore}, #{item.viewCountRate},
  87. #{item.hisFissionAvgReadRateRate}, #{item.hisFissionAvgReadSumRate},
  88. #{item.hisFissionDeWeightAvgReadSumRate}, #{item.accountPreDistribute}, #{item.viewCountRateV2},
  89. #{item.contentPool}, #{item.flowCtlDecrease}, #{item.hisFissionOpenRate}, #{item.viewMultiplier},
  90. #{item.crawlerDaysDecrease}, #{item.readCount}, #{item.readAvg}, #{item.readAvgRate},
  91. #{item.firstPubInterval}, #{item.publishContentId}, #{item.crawlerChannelContentId},
  92. #{item.sourceId}, #{item.publishTimestamp})
  93. </foreach>
  94. </insert>
  95. <select id="getArticlePromotion"
  96. resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy">
  97. select *
  98. from datastat_sort_strategy
  99. where view_count >= #{viewCount}
  100. and type = 9
  101. and read_rate >= #{viewCountRate}
  102. and fans > #{fans}
  103. and date_str > #{dateStr}
  104. and position in
  105. <foreach collection="positions" item="item" open="(" close=")" separator=",">
  106. #{item}
  107. </foreach>
  108. </select>
  109. <select id="getArticlePromotionCandidates"
  110. resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy">
  111. select *
  112. from datastat_sort_strategy
  113. where type = 9
  114. and fans > #{fans}
  115. and date_str > #{dateStr}
  116. and position in
  117. <foreach collection="positions" item="item" open="(" close=")" separator=",">
  118. #{item}
  119. </foreach>
  120. </select>
  121. <insert id="batchInsertLongArticlesRootSourceId">
  122. INSERT INTO long_articles_root_source_id (root_source_id, account_name, gh_id, article_title, request_time,
  123. trace_id, push_type, video_id)
  124. VALUES
  125. <foreach collection="list" item="item" index="index" separator=",">
  126. (#{item.rootSourceId}, #{item.accountName}, #{item.ghId}, #{item.articleTitle}, #{item.requestTime},
  127. #{item.traceId}, #{item.pushType}, #{item.videoId})
  128. </foreach>
  129. </insert>
  130. <select id="getGetOffVideos" resultType="com.tzld.longarticle.recommend.server.model.dto.GetOffVideos">
  131. select * from get_off_videos where video_id in
  132. <foreach collection="videoIds" item="item" open="(" close=")" separator=",">
  133. #{item}
  134. </foreach>
  135. </select>
  136. <insert id="batchInsertGetOffVideos">
  137. INSERT INTO get_off_videos (video_id, publish_time, video_status, trace_id, get_off_time, check_status)
  138. VALUES
  139. <foreach collection="list" item="item" separator=",">
  140. (#{item.videoId}, #{item.publishTime}, #{item.videoStatus}, #{item.traceId}, #{item.getOffTime}, #{item.checkStatus})
  141. </foreach>
  142. </insert>
  143. <insert id="batchInsertLongArticlesCrawlerVideos" parameterType="list">
  144. INSERT INTO long_articles_crawler_videos (content_id, out_video_id, platform, video_title, play_count,
  145. like_count, share_count, publish_time, crawler_time, duration,
  146. video_url, cover_url, download_status, video_oss_path, cover_oss_path,
  147. user_id, trace_id, score)
  148. VALUES
  149. <foreach collection="list" item="item" separator=",">
  150. (#{item.contentId}, #{item.outVideoId}, #{item.platform}, #{item.videoTitle}, #{item.playCount},
  151. #{item.likeCount}, #{item.shareCount}, #{item.publishTime}, #{item.crawlerTime}, #{item.duration},
  152. #{item.videoUrl}, #{item.coverUrl}, #{item.downloadStatus}, #{item.videoOssPath}, #{item.coverOssPath},
  153. #{item.userId}, #{item.traceId}, #{item.score})
  154. </foreach>
  155. </insert>
  156. <insert id="batchInsertLongArticlesText" parameterType="list">
  157. INSERT INTO long_articles_text (content_id, article_title, article_text, kimi_title, kimi_summary,
  158. kimi_keys, kimi_status)
  159. VALUES
  160. <foreach collection="list" item="item" separator=",">
  161. (#{item.contentId}, #{item.articleTitle}, #{item.articleText}, #{item.kimiTitle}, #{item.kimiSummary},
  162. #{item.kimiKeys}, #{item.kimiStatus})
  163. </foreach>
  164. </insert>
  165. <select id="getLongArticlesTextByContentIds" resultType="java.lang.String">
  166. select content_id from long_articles_text where content_id in
  167. <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
  168. #{item}
  169. </foreach>
  170. </select>
  171. <select id="getNeedUpdateRecords"
  172. resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesText">
  173. select * from long_articles_text where kimi_title is null
  174. </select>
  175. <select id="getLongArticlesRootSourceId"
  176. resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesRootSourceId">
  177. select * from long_articles_root_source_id where root_source_id in
  178. <foreach collection="rootSourceIdList" item="item" open="(" close=")" separator=",">
  179. #{item}
  180. </foreach>
  181. </select>
  182. <update id="updateLongArticlesText">
  183. update long_articles_text
  184. set kimi_title = #{kimiTitle},
  185. kimi_summary = #{kimiSummary},
  186. kimi_keys = #{kimiKeys}
  187. where content_id = #{contentId}
  188. </update>
  189. <update id="updateLongArticleMatchVideosResponse">
  190. update long_articles_match_videos
  191. set response = #{response}
  192. where trace_id = #{traceId}
  193. </update>
  194. <select id="getLongArticlesMatchVideos"
  195. resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesMatchVideos">
  196. select * from long_articles_match_videos where trace_id in
  197. <foreach collection="traceIds" item="item" open="(" close=")" separator=",">
  198. #{item}
  199. </foreach>
  200. </select>
  201. <select id="getLongArticlesCrawlerVideos"
  202. resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesCrawlerVideos">
  203. select * from long_articles_crawler_videos where content_id in
  204. <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
  205. #{item}
  206. </foreach>
  207. and download_status = 2
  208. </select>
  209. <select id="getNeedMatchVideos"
  210. resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesMatchVideos">
  211. select * from long_articles_match_videos where flow_pool_level is null and id > #{id} order by id limit #{pageSize}
  212. </select>
  213. <select id="countNeedMatchVideos" resultType="java.lang.Integer">
  214. select count(1) from long_articles_match_videos where id > 3962393 and flow_pool_level is null
  215. </select>
  216. <insert id="batchInsertLongArticlesMatchVideos" parameterType="list">
  217. INSERT INTO long_articles_match_videos (trace_id, content_id, flow_pool_level, gh_id, account_name,
  218. content_status, success_status, request_timestamp, response,
  219. process_times)
  220. VALUES
  221. <foreach collection="list" item="item" separator=",">
  222. (#{item.traceId}, #{item.contentId}, #{item.flowPoolLevel}, #{item.ghId}, #{item.accountName},
  223. #{item.contentStatus}, #{item.successStatus}, #{item.requestTimestamp}, #{item.response},
  224. #{item.processTimes})
  225. </foreach>
  226. </insert>
  227. <select id="getPublishSingleVideoSource"
  228. resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
  229. select content_trace_id, article_title, cover_url, flow_pool_level
  230. from publish_single_video_source
  231. where bad_status = 0 and audit_status = 1 and status = 2
  232. <if test="flowPoolLevel!= null ">
  233. and flow_pool_level = #{flowPoolLevel}
  234. </if>
  235. </select>
  236. <select id="getFilterColdLongArticleTitle" resultType="java.lang.String">
  237. select title from cold_start_title_pool where status in (-1, 1)
  238. </select>
  239. <insert id="batchInsertArticleTitleHisCache">
  240. insert into article_title_his_cache
  241. (source_id, type, title, title_md5, kimi_safe_score, channel_content_id, root_publish_timestamp, crawler_title,
  242. category, his_publish_article_list, create_timestamp, plan_id)
  243. values
  244. <foreach collection="list" item="item" separator=",">
  245. (#{item.sourceId}, #{item.type}, #{item.title}, #{item.titleMd5}, #{item.kimiSafeScore},
  246. #{item.channelContentId}, #{item.rootPublishTimestamp}, #{item.crawlerTitle}, #{item.category},
  247. #{item.hisPublishArticleList}, #{item.createTimestamp}, #{item.planId})
  248. </foreach>
  249. </insert>
  250. <select id="getExistsOssPath" resultType="java.lang.String">
  251. select distinct oss_path from long_articles_video_audit where type = #{type}
  252. </select>
  253. <select id="getExistsVideoId" resultType="java.lang.Long">
  254. select video_id from long_articles_video_audit where type = #{type} and create_timestamp > #{todayStart}
  255. </select>
  256. <update id="updateVideoPoolContentBad">
  257. update publish_single_video_source set bad_status = 1 where content_trace_id = #{contentTraceId};
  258. </update>
  259. <insert id="batchInsertArticleReMatchRecord">
  260. insert into article_re_match_record
  261. (trace_id, content_id, oss_path, status, old_response, create_timestamp)
  262. values
  263. <foreach collection="list" item="item" separator=",">
  264. (#{item.traceId}, #{item.contentId}, #{item.ossPath}, #{item.status}, #{item.oldResponse},
  265. #{item.createTimestamp})
  266. </foreach>
  267. </insert>
  268. <select id="getDisAuditDeleteGhid" resultType="java.lang.String">
  269. select distinct gh_id from long_article_audit_delete where create_timestamp > 1736157600000 and status = 2 and fail_reason like 'reach max api daily quota%'
  270. </select>
  271. <select id="countMatchSuccessCount" resultType="java.lang.Long">
  272. select count(content_id)
  273. from long_articles_new_match_videos
  274. where update_time between #{start} and #{end} and content_status = 103
  275. </select>
  276. <select id="getMatchSuccessContentId" resultType="java.lang.String">
  277. select content_id
  278. from long_articles_new_match_videos
  279. where update_time between #{start} and #{end} and content_status = 103
  280. </select>
  281. <select id="countMatchCount" resultType="java.lang.Long">
  282. select count(content_id)
  283. from long_articles_new_match_videos
  284. where update_time between #{start} and #{end} and content_status in (103, 201, 202, 203)
  285. </select>
  286. <select id="getMatchContentId" resultType="java.lang.String">
  287. select content_id
  288. from long_articles_new_match_videos
  289. where update_time between #{start} and #{end} and content_status in (103, 201, 202, 203)
  290. </select>
  291. <select id="getPassContentIds" resultType="java.lang.String">
  292. select content_id from long_articles_title_audit where status = 1 limit 100
  293. </select>
  294. <insert id="batchInsertLongArticleAuditDelete">
  295. insert into long_article_audit_delete
  296. (gh_id, msg_id, `index`, push_id, push_type, publish_content_id, status, delete_reason, create_timestamp)
  297. values
  298. <foreach collection="list" item="item" separator=",">
  299. (#{item.ghId}, #{item.msgId}, #{item.index}, #{item.pushId}, #{item.pushType}, #{item.publishContentId},
  300. #{item.status}, #{item.deleteReason}, #{item.createTimestamp})
  301. </foreach>
  302. </insert>
  303. <select id="getTopContent"
  304. resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy">
  305. select dss.*
  306. from datastat_sort_strategy dss
  307. join (select title, max(read_rate) as read_rate
  308. from datastat_sort_strategy
  309. where date_str between #{lastPublishDateStr} and #{dateStr}
  310. and type = 9
  311. and read_rate > 1.3
  312. and view_count > 10000
  313. and position = 1
  314. and title not in (select title from article_unsafe_title where status = 1)
  315. and first_level is not null
  316. and strategy is not null
  317. GROUP BY title) top on dss.title = top.title and dss.read_rate = top.read_rate
  318. </select>
  319. <select id="getVideoEndScreenTransformationTask"
  320. resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoEndScreenTransformationTask">
  321. select * from video_end_screen_transformation_task where video_origin_id = #{videoOriginId}
  322. </select>
  323. <insert id="saveVideoEndScreenTransformationTask">
  324. insert into video_end_screen_transformation_task
  325. (video_origin_id, title, oss_path)
  326. values
  327. (#{videoOriginId}, #{title}, #{ossPath})
  328. </insert>
  329. <select id="getAccountDailyVideoAuditCount"
  330. resultType="com.tzld.longarticle.recommend.server.model.vo.DailyAuditProduceExport">
  331. select audit.audit_account as name, audit.cnt as auditCount, auditPass.cnt as auditPassCount,
  332. videoAudit.cnt as videoAuditCount, videoAuditPass.cnt as videoAuditPassCount
  333. from (select audit_account, count(1) as cnt
  334. from long_articles_title_audit
  335. where audit_timestamp between #{startTimeStamp} and #{endTimeStamp}
  336. group by audit_account) audit
  337. left join (select audit_account, count(1) as cnt
  338. from long_articles_title_audit
  339. where audit_timestamp between #{startTimeStamp} and #{endTimeStamp}
  340. and status = 1
  341. group by audit_account) auditPass
  342. on audit.audit_account = auditPass.audit_account
  343. left join (select audit_account, count(1) as cnt
  344. from long_articles_crawler_videos
  345. where audit_timestamp between #{startTimeStamp} and #{endTimeStamp}
  346. group by audit_account) videoAudit
  347. on audit.audit_account = videoAudit.audit_account
  348. left join (select audit_account, count(1) as cnt
  349. from long_articles_crawler_videos
  350. where audit_timestamp between #{startTimeStamp} and #{endTimeStamp}
  351. and status = 1
  352. group by audit_account) videoAuditPass
  353. on audit.audit_account = videoAuditPass.audit_account
  354. </select>
  355. <select id="getCategoryMatchCount"
  356. resultType="com.tzld.longarticle.recommend.server.model.vo.CategoryGroupFunnelExport">
  357. select success.category, success.cnt as matchSuccessCount, total.cnt as matchCount
  358. from (select ac.category, count(1) as cnt
  359. from long_articles_new_match_videos lanmv
  360. join article_category ac on lanmv.content_id = ac.produce_content_id
  361. where lanmv.update_time between #{start} and #{end}
  362. and lanmv.content_status = 103
  363. group by ac.category) success
  364. left join (select ac.category, count(1) as cnt
  365. from long_articles_new_match_videos lanmv
  366. join article_category ac on lanmv.content_id = ac.produce_content_id
  367. where lanmv.update_time between #{start} and #{end}
  368. and lanmv.content_status in (103, 201, 202, 203)
  369. group by ac.category) total on total.category = success.category
  370. </select>
  371. <select id="getCategoryTitleAuditCount"
  372. resultType="com.tzld.longarticle.recommend.server.model.vo.CategoryGroupFunnelExport">
  373. select success.category, success.cnt as videoAuditPassCount, total.cnt as videoAuditCount
  374. from (select ac.category, count(1) as cnt
  375. from long_articles_title_audit lata
  376. join article_category ac on lata.content_id = ac.produce_content_id
  377. where lata.audit_timestamp between #{start} and #{end}
  378. and lata.`status` = 1
  379. group by ac.category) success
  380. left join (select ac.category, count(1) as cnt
  381. from long_articles_title_audit lata
  382. join article_category ac on lata.content_id = ac.produce_content_id
  383. where lata.audit_timestamp between #{start} and #{end}
  384. and lata.`status` in (1, 2)
  385. group by ac.category) total on total.category = success.category
  386. </select>
  387. <insert id="batchInsertPublishContentGzhWaiting">
  388. insert into publish_content_gzh_waiting
  389. (id, plan_id, publish_account_id, source_type, source_id, title, create_timestamp, content_pool_type,
  390. crawler_channel_content_id, crawler_link, crawler_title, crawler_view_count, crawler_timestamp, status,
  391. update_timestamp)
  392. values
  393. <foreach collection="list" item="item" separator=",">
  394. (#{item.id}, #{item.planId}, #{item.publishAccountId}, #{item.sourceType}, #{item.sourceId}, #{item.title},
  395. #{item.createTimestamp}, #{item.contentPoolType}, #{item.crawlerChannelContentId}, #{item.crawlerLink},
  396. #{item.crawlerTitle}, #{item.crawlerViewCount}, #{item.crawlerTimestamp}, #{item.status}, #{item.updateTimestamp})
  397. </foreach>
  398. </insert>
  399. <update id="updatePublishContentGzhWaitingStatus">
  400. update publish_content_gzh_waiting
  401. set status = #{status},
  402. update_timestamp = #{updateTimestamp}
  403. where plan_id = #{planId}
  404. and publish_account_id = #{accountId}
  405. and id not in
  406. <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
  407. #{item}
  408. </foreach>
  409. </update>
  410. <update id="updatePublishContentGzhWaitingStatusByIds">
  411. update publish_content_gzh_waiting
  412. set status = #{status},
  413. update_timestamp = #{updateTimestamp}
  414. where id in
  415. <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
  416. #{item}
  417. </foreach>
  418. </update>
  419. <select id="getGroupPublishPlanAccounts"
  420. resultType="com.tzld.longarticle.recommend.server.model.dto.aigc.PublishPlanAccountDTO">
  421. select plan_id as planId, publish_account_id as accountId, count(1) as cnt
  422. from publish_content_gzh_waiting
  423. GROUP BY plan_id, publish_account_id
  424. </select>
  425. <select id="getMinGzhWaitingPublishContent" resultType="java.lang.Long">
  426. select min(update_timestamp)
  427. from publish_content_gzh_waiting
  428. where plan_id = #{planId}
  429. and publish_account_id = #{accountId}
  430. and status = 1
  431. </select>
  432. <select id="getPublishContentGzhWaiting"
  433. resultType="com.tzld.longarticle.recommend.server.model.dto.Content">
  434. select id, source_type, source_id, title, content_pool_type, create_timestamp, crawler_channel_content_id, crawler_timestamp
  435. from publish_content_gzh_waiting
  436. where plan_id = #{planId}
  437. and publish_account_id = #{accountId}
  438. and status = 1
  439. </select>
  440. <select id="getPublishedTopContent"
  441. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishedTopContentDTO">
  442. select title, round(avg(read_rate), 4) as readRate, count(1) as publishNum
  443. from (SELECT *
  444. FROM (
  445. SELECT
  446. t.*,
  447. @rn := IF(@current_title = t.title, @rn + 1, 1) AS rn,
  448. @current_title := t.title
  449. FROM datastat_sort_strategy t
  450. CROSS JOIN (SELECT @rn := 0, @current_title := '') AS vars
  451. WHERE t.date_str > #{lastPublishDateStr} and t.produce_plan_name = 'TOP100'
  452. ORDER BY t.title, STR_TO_DATE(t.date_str, '%Y-%m-%d') DESC
  453. ) AS ranked_data
  454. ORDER BY title, date_str DESC) t
  455. GROUP BY t.title
  456. </select>
  457. <update id="updateContentStatusBySourceId">
  458. update publish_content_gzh_waiting set status = 0 where source_id = #{sourceId}
  459. </update>
  460. <delete id="deleteGzhWaitingByPlanIdAccountId">
  461. delete from publish_content_gzh_waiting where plan_id = #{planId} and publish_account_id = #{accountId}
  462. </delete>
  463. </mapper>