CrawlerBaseMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.entity.longArticle.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. <select id="getAllByWxSnIn"
  65. resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.ArticleDetailInfo">
  66. select wx_sn, recall_dt, first_level, fission_0, fission_0_head, fission_0_recommend, fission_1, fission_1_head,
  67. fission_1_recommend, fission_2, fission_2_head, fission_2_recommend
  68. from long_articles_detail_info
  69. where wx_sn in
  70. <foreach collection="wxSnList" item="item" separator="," open="(" close=")">
  71. #{item}
  72. </foreach>
  73. </select>
  74. <select id="getAllByGhIdIn"
  75. resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo">
  76. select gh_id, position, update_time, fans, read_avg, read_avg_ci_upper
  77. from account_avg_info_v3
  78. where gh_id in
  79. <foreach collection="ghIdList" item="item" separator="," open="(" close=")">
  80. #{item}
  81. </foreach>
  82. </select>
  83. <select id="getByGhIdInAndPublishTimestampLessThanAndTypeEquals"
  84. resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.Article">
  85. select ghId, accountName, ItemIndex, title, ContentUrl, wx_sn, publish_timestamp, show_view_count
  86. from official_articles_v2
  87. where ghId in
  88. <foreach collection="ghIds" item="item" separator="," open="(" close=")">
  89. #{item}
  90. </foreach>
  91. and publish_timestamp &lt; #{publishTimestamp}
  92. and type = #{type}
  93. </select>
  94. </mapper>