123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper">
- <delete id="deleteByDateStrGreaterThanEqual">
- delete from datastat_sort_strategy where date_str >= #{dateStr}
- </delete>
- <delete id="deleteByDateStrBetween">
- delete from datastat_sort_strategy where date_str between #{dateStrBegin} and #{dateStrEnd} and type = #{type}
- </delete>
- <select id="countGetOffVideos" resultType="java.lang.Long">
- select count(1) from get_off_videos limit #{offset}, #{pageSize}
- </select>
- <insert id="batchInsertDatastatSortStrategy">
- INSERT INTO datastat_sort_strategy
- (date_str, publish_time, account_mode, account_source, account_type, account_status, bussiness_type,
- account_name, strategy, fans, view_count, avg_view_count, first_view_count, first_avg_view_count,
- first_level, fission0, fission0_head, fission0_recommend, fission1, fission1_head, fission1_recommend, fission2,
- fission2_head, fission2_recommend, second_first_level, second_fission0, second_fission0_head,
- second_fission0_recommend, second_fission1, second_fission1_head, second_fission1_recommend,
- second_fission2, second_fission2_head, second_fission2_recommend, third_first_level, third_fission0,
- third_fission0_head, third_fission0_recommend, third_fission1, third_fission1_head, third_fission1_recommend,
- third_fission2,third_fission2_head, third_fission2_recommend,
- read_rate, read_fans_rate, first_read_rate, fission0_first_rate, fission0_head_first_rate, fission0_recommend_first_rate, fission1_fission0_rate,
- fission0_read_avg_rate, his_read_rate, his_first_read_rate, his_fission0_first_rate, position, gh_id, title,
- link, wx_sn, fission0_read_avg_100_rate, fission0_read_avg_500_rate, fission0_read_avg_1000_rate,
- crawler_plan_name, crawler_plan_tag, produce_plan_name, produce_plan_tag, publish_plan_name,
- publish_mini_program_insert_strategy, publish_mini_program_insert_use_type, publish_mini_program_num,
- source_produce_plan_name, account_create_timestamp, publish_timestamp, type, source_type, source_id)
- VALUES
- <foreach collection="list" item="item" separator=",">
- (#{item.dateStr}, #{item.publishTime}, #{item.accountMode}, #{item.accountSource}, #{item.accountType},
- #{item.accountStatus}, #{item.businessType}, #{item.accountName}, #{item.strategy}, #{item.fans},
- #{item.viewCount}, #{item.avgViewCount}, #{item.firstViewCount}, #{item.firstAvgViewCount},
- #{item.firstLevel}, #{item.fission0},#{item.fission0Head},#{item.fission0Recommend}, #{item.fission1},
- #{item.fission1Head},#{item.fission1Recommend}, #{item.fission2},#{item.fission2Head},
- #{item.fission2Recommend}, #{item.secondFirstLevel}, #{item.secondFission0},
- #{item.secondFission0Head}, #{item.secondFission0Recommend}, #{item.secondFission1},
- #{item.secondFission1Head}, #{item.secondFission1Recommend}, #{item.secondFission2},
- #{item.secondFission2Head}, #{item.secondFission2Recommend}, #{item.thirdFirstLevel},
- #{item.thirdFission0}, #{item.thirdFission0Head}, #{item.thirdFission0Recommend},
- #{item.thirdFission1}, #{item.thirdFission1Head}, #{item.thirdFission1Recommend},
- #{item.thirdFission2}, #{item.thirdFission2Head}, #{item.thirdFission2Recommend}, #{item.readRate},
- #{item.readFansRate}, #{item.firstReadRate}, #{item.fission0FirstRate}, #{item.fission0HeadFirstRate},
- #{item.fission0RecommendFirstRate}, #{item.fission1Fission0Rate},
- #{item.fission0ReadAvgRate}, #{item.hisReadRate}, #{item.hisFirstReadRate}, #{item.hisFission0FirstRate},
- #{item.position}, #{item.ghId}, #{item.title}, #{item.link},
- #{item.wxSn}, #{item.fission0ReadAvg100Rate}, #{item.fission0ReadAvg500Rate},
- #{item.fission0ReadAvg1000Rate}, #{item.crawlerPlanName}, #{item.crawlerPlanTag},
- #{item.producePlanName}, #{item.producePlanTag}, #{item.publishPlanName},
- #{item.publishMiniProgramInsertStrategy}, #{item.publishMiniProgramInsertUseType},
- #{item.publishMiniProgramNum}, #{item.sourceProducePlanName}, #{item.accountCreateTimestamp},
- #{item.publishTimestamp}, #{item.type}, #{item.sourceType}, #{item.sourceId})
- </foreach>
- </insert>
- <insert id="batchInsertArticlePoolPromotionSource">
- insert into article_pool_promotion_source
- (channel_content_id, source_publish_content_id, root_publish_content_id, root_produce_content_id, title,
- title_md5, level, status, deleted, create_timestamp, update_timestamp)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.channelContentId}, #{item.sourcePublishContentId}, #{item.rootPublishContentId},
- #{item.rootProduceContentId}, #{item.title}, #{item.titleMd5}, #{item.level}, #{item.status},
- #{item.deleted}, #{item.createTimestamp}, #{item.updateTimestamp})
- </foreach>
- </insert>
- <update id="updateRootProduceContentLevel">
- update article_pool_promotion_source set level = #{level} where root_produce_content_id = #{rootProduceContentId}
- </update>
- <delete id="deleteDatastatScoreByDtIn">
- delete from datastat_score where dt in
- <foreach collection="dateStrList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </delete>
- <insert id="batchInsertDatastatScore">
- INSERT INTO datastat_score
- (dt, gh_id, account_name, `index`, title, strategy, score, similarity, view_count_rate,
- his_fission_avg_read_rate_rate, his_fission_avg_read_sum_rate, his_fission_de_weight_avg_read_sum_rate,
- read_count, read_avg, read_avg_rate, category, category_score, first_pub_interval, publish_content_id,
- crawler_channel_content_id, source_id, publish_timestamp)
- VALUES
- <foreach collection="list" item="item" separator=",">
- (#{item.dt}, #{item.ghId}, #{item.accountName}, #{item.index}, #{item.title}, #{item.strategy},
- #{item.score}, #{item.similarity}, #{item.viewCountRate}, #{item.hisFissionAvgReadRateRate},
- #{item.hisFissionAvgReadSumRate}, #{item.hisFissionDeWeightAvgReadSumRate}, #{item.readCount},
- #{item.readAvg}, #{item.readAvgRate}, #{item.category}, #{item.categoryScore}, #{item.firstPubInterval},
- #{item.publishContentId}, #{item.crawlerChannelContentId}, #{item.sourceId}, #{item.publishTimestamp})
- </foreach>
- </insert>
- <select id="getArticlePromotion"
- resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy">
- select *
- from datastat_sort_strategy
- where view_count >= #{viewCount}
- and type = 9
- and read_rate >= #{viewCountRate}
- and fans > #{fans}
- and date_str > #{dateStr}
- and position in
- <foreach collection="positions" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getArticlePromotionCandidates"
- resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy">
- select *
- from datastat_sort_strategy
- where type = 9
- and fans > #{fans}
- and date_str > #{dateStr}
- and position in
- <foreach collection="positions" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <insert id="batchInsertLongArticlesRootSourceId">
- INSERT INTO long_articles_root_source_id (root_source_id, account_name, gh_id, article_title, request_time,
- trace_id, push_type, video_id)
- VALUES
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.rootSourceId}, #{item.accountName}, #{item.ghId}, #{item.articleTitle}, #{item.requestTime},
- #{item.traceId}, #{item.pushType}, #{item.videoId})
- </foreach>
- </insert>
- <select id="getGetOffVideos" resultType="com.tzld.longarticle.recommend.server.model.dto.GetOffVideos">
- select * from get_off_videos where video_id in
- <foreach collection="videoIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <insert id="batchInsertGetOffVideos">
- INSERT INTO get_off_videos (video_id, publish_time, video_status, trace_id, get_off_time, check_status)
- VALUES
- <foreach collection="list" item="item" separator=",">
- (#{item.videoId}, #{item.publishTime}, #{item.videoStatus}, #{item.traceId}, #{item.getOffTime}, #{item.checkStatus})
- </foreach>
- </insert>
- <insert id="batchInsertLongArticlesCrawlerVideos" parameterType="list">
- INSERT INTO long_articles_crawler_videos (content_id, out_video_id, platform, video_title, play_count,
- like_count, share_count, publish_time, crawler_time, duration,
- video_url, cover_url, download_status, video_oss_path, cover_oss_path,
- user_id, trace_id, score)
- VALUES
- <foreach collection="list" item="item" separator=",">
- (#{item.contentId}, #{item.outVideoId}, #{item.platform}, #{item.videoTitle}, #{item.playCount},
- #{item.likeCount}, #{item.shareCount}, #{item.publishTime}, #{item.crawlerTime}, #{item.duration},
- #{item.videoUrl}, #{item.coverUrl}, #{item.downloadStatus}, #{item.videoOssPath}, #{item.coverOssPath},
- #{item.userId}, #{item.traceId}, #{item.score})
- </foreach>
- </insert>
- <insert id="batchInsertLongArticlesText" parameterType="list">
- INSERT INTO long_articles_text (content_id, article_title, article_text, kimi_title, kimi_summary,
- kimi_keys, kimi_status)
- VALUES
- <foreach collection="list" item="item" separator=",">
- (#{item.contentId}, #{item.articleTitle}, #{item.articleText}, #{item.kimiTitle}, #{item.kimiSummary},
- #{item.kimiKeys}, #{item.kimiStatus})
- </foreach>
- </insert>
- <select id="getLongArticlesTextByContentIds" resultType="java.lang.String">
- select content_id from long_articles_text where content_id in
- <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getNeedUpdateRecords"
- resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesText">
- select * from long_articles_text where kimi_title is null
- </select>
- <select id="getLongArticlesRootSourceId"
- resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesRootSourceId">
- select * from long_articles_root_source_id where root_source_id in
- <foreach collection="rootSourceIdList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <update id="updateLongArticlesText">
- update long_articles_text
- set kimi_title = #{kimiTitle},
- kimi_summary = #{kimiSummary},
- kimi_keys = #{kimiKeys}
- where content_id = #{contentId}
- </update>
- <update id="updateLongArticleMatchVideosResponse">
- update long_articles_match_videos
- set response = #{response}
- where trace_id = #{traceId}
- </update>
- <select id="getLongArticlesMatchVideos"
- resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesMatchVideos">
- select * from long_articles_match_videos where trace_id in
- <foreach collection="traceIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getLongArticlesCrawlerVideos"
- resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesCrawlerVideos">
- select * from long_articles_crawler_videos where content_id in
- <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- and download_status = 2
- </select>
- <select id="getNeedMatchVideos"
- resultType="com.tzld.longarticle.recommend.server.model.dto.LongArticlesMatchVideos">
- select * from long_articles_match_videos where flow_pool_level is null and id > #{id} order by id limit #{pageSize}
- </select>
- <select id="countNeedMatchVideos" resultType="java.lang.Integer">
- select count(1) from long_articles_match_videos where id > 3962393 and flow_pool_level is null
- </select>
- <insert id="batchInsertLongArticlesMatchVideos" parameterType="list">
- INSERT INTO long_articles_match_videos (trace_id, content_id, flow_pool_level, gh_id, account_name,
- content_status, success_status, request_timestamp, response,
- process_times)
- VALUES
- <foreach collection="list" item="item" separator=",">
- (#{item.traceId}, #{item.contentId}, #{item.flowPoolLevel}, #{item.ghId}, #{item.accountName},
- #{item.contentStatus}, #{item.successStatus}, #{item.requestTimestamp}, #{item.response},
- #{item.processTimes})
- </foreach>
- </insert>
- <select id="getPublishSingleVideoSource"
- resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
- select content_trace_id, article_title, cover_url, flow_pool_level
- from publish_single_video_source
- where bad_status = 0 and audit_status = 1 and status = 2
- <if test="flowPoolLevel!= null ">
- and flow_pool_level = #{flowPoolLevel}
- </if>
- </select>
- <select id="getFilterColdLongArticleTitle" resultType="java.lang.String">
- select title from cold_start_title_pool where status in (-1, 1)
- </select>
- <insert id="batchInsertArticleTitleHisCache">
- insert into article_title_his_cache
- (source_id, type, title, title_md5, kimi_safe_score, channel_content_id, root_publish_timestamp, crawler_title,
- category, his_publish_article_list, create_timestamp, plan_id)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.sourceId}, #{item.type}, #{item.title}, #{item.titleMd5}, #{item.kimiSafeScore},
- #{item.channelContentId}, #{item.rootPublishTimestamp}, #{item.crawlerTitle}, #{item.category},
- #{item.hisPublishArticleList}, #{item.createTimestamp}, #{item.planId})
- </foreach>
- </insert>
- <select id="getExistsOssPath" resultType="java.lang.String">
- select distinct oss_path from long_articles_video_audit where type = #{type}
- </select>
- <select id="getExistsVideoId" resultType="java.lang.Long">
- select video_id from long_articles_video_audit where type = #{type} and create_timestamp > #{todayStart}
- </select>
- <update id="updateVideoPoolContentBad">
- update publish_single_video_source set bad_status = 1 where content_trace_id = #{contentTraceId};
- </update>
- <insert id="batchInsertArticleReMatchRecord">
- insert into article_re_match_record
- (trace_id, content_id, oss_path, status, old_response, create_timestamp)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.traceId}, #{item.contentId}, #{item.ossPath}, #{item.status}, #{item.oldResponse},
- #{item.createTimestamp})
- </foreach>
- </insert>
- <select id="getDisAuditDeleteGhid" resultType="java.lang.String">
- 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%'
- </select>
- <select id="countMatchSuccessCount" resultType="java.lang.Long">
- select count(content_id)
- from long_articles_text
- where start_processing_time between #{start} and #{end} and result_status = 1
- </select>
- <select id="getMatchSuccessContentId" resultType="java.lang.String">
- select content_id
- from long_articles_text
- where start_processing_time between #{start} and #{end} and result_status = 1
- </select>
- <select id="countMatchCount" resultType="java.lang.Long">
- select count(content_id)
- from long_articles_text
- where start_processing_time between #{start} and #{end}
- </select>
- <select id="getMatchContentId" resultType="java.lang.String">
- select content_id
- from long_articles_text
- where start_processing_time between #{start} and #{end}
- </select>
- <select id="getPassContentIds" resultType="java.lang.String">
- select content_id from long_articles_title_audit where status = 1 limit 100
- </select>
- <insert id="batchInsertLongArticleAuditDelete">
- insert into long_article_audit_delete
- (gh_id, msg_id, `index`, push_id, push_type, publish_content_id, status, delete_reason, create_timestamp)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.ghId}, #{item.msgId}, #{item.index}, #{item.pushId}, #{item.pushType}, #{item.publishContentId},
- #{item.status}, #{item.deleteReason}, #{item.createTimestamp})
- </foreach>
- </insert>
- <select id="getTopContent"
- resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy">
- select dss.*
- from datastat_sort_strategy dss
- join (select title, max(read_rate) as read_rate
- from datastat_sort_strategy
- where date_str < #{dateStr}
- and type = 9
- and read_rate > 1
- and view_count > 10000
- and position in (1, 2)
- and title not in (select title from article_unsafe_title where status = 1)
- and first_level is not null
- and strategy is not null
- GROUP BY title) top on dss.title = top.title and dss.read_rate = top.read_rate
- </select>
- <select id="getVideoEndScreenTransformationTask"
- resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoEndScreenTransformationTask">
- select * from video_end_screen_transformation_task where video_origin_id = #{videoOriginId}
- </select>
- <insert id="saveVideoEndScreenTransformationTask">
- insert into video_end_screen_transformation_task
- (video_origin_id, title, oss_path)
- values
- (#{videoOriginId}, #{title}, #{ossPath})
- </insert>
- <select id="getAccountDailyVideoAuditCount"
- resultType="com.tzld.longarticle.recommend.server.model.vo.DailyAuditProduceExport">
- select audit.audit_account as name, audit.cnt as auditCount, auditPass.cnt as auditPassCount,
- videoAudit.cnt as videoAuditCount, videoAuditPass.cnt as videoAuditPassCount
- from (select audit_account, count(1) as cnt
- from long_articles_title_audit
- where audit_timestamp between #{startTimeStamp} and #{endTimeStamp}
- group by audit_account) audit
- left join (select audit_account, count(1) as cnt
- from long_articles_title_audit
- where audit_timestamp between #{startTimeStamp} and #{endTimeStamp}
- and status = 1
- group by audit_account) auditPass
- on audit.audit_account = auditPass.audit_account
- left join (select audit_account, count(1) as cnt
- from long_articles_crawler_videos
- where audit_timestamp between #{startTimeStamp} and #{endTimeStamp}
- group by audit_account) videoAudit
- on audit.audit_account = videoAudit.audit_account
- left join (select audit_account, count(1) as cnt
- from long_articles_crawler_videos
- where audit_timestamp between #{startTimeStamp} and #{endTimeStamp}
- and status = 1
- group by audit_account) videoAuditPass
- on audit.audit_account = videoAuditPass.audit_account
- </select>
- <select id="getCategoryMatchCount"
- resultType="com.tzld.longarticle.recommend.server.model.vo.CategoryGroupFunnelExport">
- select success.category, success.cnt as matchSuccessCount, total.cnt as matchCount
- from (select ac.category, count(1) as cnt
- from long_articles_text lat
- join article_category ac on lat.content_id = ac.produce_content_id
- where lat.start_processing_time between #{start} and #{end}
- and lat.result_status = 1
- group by ac.category) success
- left join (select ac.category, count(1) as cnt
- from long_articles_text lat
- join article_category ac on lat.content_id = ac.produce_content_id
- where lat.start_processing_time between #{start} and #{end}
- and lat.result_status in (1, 2)
- group by ac.category) total on total.category = success.category
- </select>
- <select id="getCategoryTitleAuditCount"
- resultType="com.tzld.longarticle.recommend.server.model.vo.CategoryGroupFunnelExport">
- select success.category, success.cnt as videoAuditPassCount, total.cnt as videoAuditCount
- from (select ac.category, count(1) as cnt
- from long_articles_title_audit lata
- join article_category ac on lata.content_id = ac.produce_content_id
- where lata.audit_timestamp between #{start} and #{end}
- and lata.`status` = 1
- group by ac.category) success
- left join (select ac.category, count(1) as cnt
- from long_articles_title_audit lata
- join article_category ac on lata.content_id = ac.produce_content_id
- where lata.audit_timestamp between #{start} and #{end}
- and lata.`status` in (1, 2)
- group by ac.category) total on total.category = success.category
- </select>
- <insert id="batchInsertPublishContentGzhWaiting">
- insert into publish_content_gzh_waiting
- (id, plan_id, publish_account_id, source_type, source_id, title, create_timestamp, content_pool_type,
- crawler_channel_content_id, crawler_link, crawler_title, crawler_view_count, crawler_timestamp, status,
- update_timestamp)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.id}, #{item.planId}, #{item.publishAccountId}, #{item.sourceType}, #{item.sourceId}, #{item.title},
- #{item.createTimestamp}, #{item.contentPoolType}, #{item.crawlerChannelContentId}, #{item.crawlerLink},
- #{item.crawlerTitle}, #{item.crawlerViewCount}, #{item.crawlerTimestamp}, #{item.status}, #{item.updateTimestamp})
- </foreach>
- </insert>
- <update id="updatePublishContentGzhWaitingStatus">
- update publish_content_gzh_waiting
- set status = #{status},
- update_timestamp = #{updateTimestamp}
- where plan_id = #{planId}
- and publish_account_id = #{accountId}
- and id not in
- <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </update>
- <update id="updatePublishContentGzhWaitingStatusByIds">
- update publish_content_gzh_waiting
- set status = #{status},
- update_timestamp = #{updateTimestamp}
- where id in
- <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </update>
- <select id="getGroupPublishPlanAccounts"
- resultType="com.tzld.longarticle.recommend.server.model.dto.aigc.PublishPlanAccountDTO">
- select plan_id as planId, publish_account_id as accountId, count(1) as cnt
- from publish_content_gzh_waiting
- GROUP BY plan_id, publish_account_id
- </select>
- <select id="getMinGzhWaitingPublishContent" resultType="java.lang.Long">
- select min(update_timestamp)
- from publish_content_gzh_waiting
- where plan_id = #{planId}
- and publish_account_id = #{accountId}
- and status = 1
- </select>
- <select id="getPublishContentGzhWaiting"
- resultType="com.tzld.longarticle.recommend.server.model.dto.Content">
- select id, source_type, source_id, title, content_pool_type
- from publish_content_gzh_waiting
- where plan_id = #{planId}
- and publish_account_id = #{accountId}
- and status = 1
- </select>
- </mapper>
|