CrawlerBaseMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.crawler.CrawlerBaseMapper">
  4. <insert id="batchInsertAccountCorrelation">
  5. INSERT INTO account_correlation (date_str, gh_id, account_name, rel_gh_id, rel_account_name, status, correlation)
  6. VALUES
  7. <foreach collection="list" item="item" separator=",">
  8. (#{item.dateStr}, #{item.ghId}, #{item.accountName}, #{item.relGhId}, #{item.relAccountName}, #{item.status}, #{item.correlation})
  9. </foreach>
  10. </insert>
  11. <select id="countGetOffVideos" resultType="java.lang.Integer">
  12. select count(1) from get_off_videos where publish_time > 1727239202
  13. </select>
  14. <select id="pageGetOffVideos" resultType="com.tzld.longarticle.recommend.server.model.dto.GetOffVideos">
  15. select * from get_off_videos order by video_id limit #{offset}, #{pageSize}
  16. </select>
  17. <select id="countLongArticlesRootSourceId" resultType="java.lang.Integer">
  18. select count(1) from long_articles_root_source_id where requestTime > 1727192229
  19. </select>
  20. <select id="pageLongArticlesRootSourceId" resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesRootSourceId">
  21. select * from long_articles_root_source_id where requestTime > 1727192229 order by rootSourceId limit #{offset}, #{pageSize}
  22. </select>
  23. <select id="countArticleMatchVideos" resultType="java.lang.Integer">
  24. select count(1) from article_match_videos where DATE(update_time) &gt;= '2024-09-20'
  25. </select>
  26. <select id="pageArticleMatchVideos"
  27. resultType="com.tzld.longarticle.recommend.server.model.dto.ArticleMatchVideos">
  28. select * from article_match_videos order by video_id
  29. </select>
  30. <select id="countLongArticlesVideos" resultType="java.lang.Integer">
  31. select count(1) from long_articles_video where content_status = 2 and success = 0
  32. </select>
  33. <select id="pageLongArticlesVideos"
  34. resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesVideoDTO">
  35. select * from long_articles_video where content_status = 2 and success = 0 and id > #{id} order by id limit #{pageSize}
  36. </select>
  37. <select id="getLongArticlesText" resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesText">
  38. select content_id, kimi_title, kimi_summary, kimi_keys from long_articles_video where kimi_summary is not null group by content_id
  39. </select>
  40. <select id="getLongArticlesVideo"
  41. resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesVideoDTO">
  42. select * from long_articles_video where trace_id in
  43. <foreach collection="traceIds" item="item" open="(" close=")" separator=",">
  44. #{item}
  45. </foreach>
  46. </select>
  47. <insert id="batchInsertAccountAvgInfo">
  48. INSERT INTO account_avg_info_v3
  49. (gh_id, position, update_time, account_name, fans, read_avg, like_avg, status, account_type, account_mode,
  50. account_source, account_status, business_type, read_rate_avg)
  51. VALUES
  52. <foreach collection="list" item="item" separator=",">
  53. (#{item.ghId}, #{item.position}, #{item.updateTime}, #{item.accountName}, #{item.fans}, #{item.readAvg},
  54. #{item.likeAvg}, #{item.status}, #{item.accountType}, #{item.accountMode}, #{item.accountSource},
  55. #{item.accountStatus}, #{item.businessType}, #{item.readRateAvg})
  56. </foreach>
  57. </insert>
  58. <delete id="deleteAccountAvgInfoByGhIdAndUpdateTime">
  59. delete from account_avg_info_v3 where gh_id = #{ghId} and update_time = #{date}
  60. </delete>
  61. <update id="updateAccountAvgInfoStatus">
  62. update account_avg_info_v3 set status = 0 where gh_id = #{ghId} and update_time != #{date}
  63. </update>
  64. <update id="updateArticleAigcId">
  65. update official_articles_v2
  66. set publish_content_id = #{publishContentId},
  67. channel_content_id = #{channelContentId}
  68. where wx_sn = #{wxsn}
  69. </update>
  70. <update id="updateArticleSourceRootId">
  71. update official_articles_v2
  72. set source_publish_content_id = #{sourcePublishContentId},
  73. root_publish_content_id = #{rootPublishContentId},
  74. root_produce_content_id = #{rootProduceContentId}
  75. where wx_sn = #{wxsn}
  76. </update>
  77. <select id="getWaitingFindArticle"
  78. resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.Article">
  79. select * from official_articles_v2 where publish_timestamp > #{timestamp} order by publish_timestamp limit 100
  80. </select>
  81. <select id="getByTitleMd5InAndTypeEqualsAndStatusEquals"
  82. resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.Article">
  83. select wx_sn, ghId, appMsgId, title, ItemIndex, publish_timestamp, show_view_count
  84. from official_articles_v2
  85. where title_md5 in
  86. <foreach collection="titleMd5s" item="item" separator="," open="(" close=")">
  87. #{item}
  88. </foreach>
  89. and Type = #{type} and status = #{status}
  90. </select>
  91. <select id="getAllByWxSnIn"
  92. resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.ArticleDetailInfo">
  93. select wx_sn, recall_dt, first_level, fission_0
  94. from long_articles_detail_info
  95. where wx_sn in
  96. <foreach collection="wxSnList" item="item" separator="," open="(" close=")">
  97. #{item}
  98. </foreach>
  99. </select>
  100. <select id="getAllByGhIdIn"
  101. resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo">
  102. select gh_id, position, update_time, fans, read_avg
  103. from account_avg_info_v3
  104. where gh_id in
  105. <foreach collection="ghIdList" item="item" separator="," open="(" close=")">
  106. #{item}
  107. </foreach>
  108. </select>
  109. <select id="getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEqualsAndStatusEquals"
  110. resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.Article">
  111. select ghId, appMsgId, show_view_count
  112. from official_articles_v2
  113. where ghId in
  114. <foreach collection="ghIdList" item="item" separator="," open="(" close=")">
  115. #{item}
  116. </foreach>
  117. and appMsgId in
  118. <foreach collection="appMsgIdList" item="item" separator="," open="(" close=")">
  119. #{item}
  120. </foreach>
  121. and itemIndex = #{itemIndex}
  122. and Type = #{type}
  123. and status = #{status}
  124. </select>
  125. </mapper>