123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- <?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.aigc.AigcBaseMapper">
- <select id="getPublishAccountByGhId"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount">
- select * from publish_account where gh_id = #{ghId} limit 1
- </select>
- <select id="getPublishContentByTitle"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
- select content.id, content.plan_id, content.source_type, content.source_id, content.crawler_channel_content_id,
- content.publish_account_id, content.publish_timestamp, output.output as title
- from publish_content content
- join publish_content_output output
- on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
- where content.status = 2
- and content.publish_account_id in
- <foreach collection="list" item="item" open="(" close=")" separator=",">
- #{item.publishAccountId}
- </foreach>
- and output.output in
- <foreach collection="list" item="item" open="(" close=")" separator=",">
- #{item.title}
- </foreach>
- </select>
- <select id="getMiniProgramTask"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishPlanMiniprogramTask">
- select * from publish_plan_miniprogram_task where
- <foreach collection="list" item="item" open="(" close=")" separator=" or ">
- (plan_id = #{item.planId} and account_ids like CONCAT("%", #{item.accountId}, "%"))
- </foreach>
- </select>
- <select id="getProduceContent"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord">
- select * from produce_plan_exe_record where plan_exe_id = #{id}
- </select>
- <select id="getProducePlan"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlan">
- select * from produce_plan where id = #{id}
- </select>
- <select id="getProducePlanInputSources"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanInputSource">
- select * from produce_plan_input_source where plan_id = #{planId} and data_status = 1
- </select>
- <select id="getCrawlerPlanRelByChannelContentIds"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlanResultRel">
- select * from crawler_plan_result_rel where channel_source_id in
- <foreach collection="channelContentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getCrawlerPlanByPlanIds"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlan">
- select * from crawler_plan where id in
- <foreach collection="planIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getNotPublishPlan" resultType="com.tzld.longarticle.recommend.server.model.dto.NotPublishPlan">
- SELECT
- plan.id as planId,
- plan.NAME as planName,
- plan.error_msg as errorMsg,
- stat.today_expect_publish_count as expectCount,
- stat.today_publish_count as publishCount,
- setting.publish_push_time as publishPushTime
- FROM publish_plan plan
- JOIN publish_plan_stat stat ON plan.id = stat.plan_id
- JOIN publish_plan_setting setting ON plan.id = setting.plan_id
- WHERE
- stat.today_expect_publish_count > stat.today_publish_count
- AND plan.plan_status = 1
- AND setting.push_type = 2
- and plan.create_timestamp < #{todayStart}
- </select>
- <select id="getPublishPlanPushType" resultType="java.lang.Integer">
- select push_type from publish_plan_setting where plan_id = #{planId}
- </select>
- <select id="getPublishAccounts"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount">
- SELECT account.*
- FROM publish_plan_account planAccount
- join publish_account account on planAccount.account_id = account.id
- left join publish_content content
- on content.publish_account_id = planAccount.account_id
- and content.plan_id = planAccount.plan_id
- and content.publish_timestamp > #{todayStart}
- WHERE planAccount.plan_id = #{planId} and content.id is null and planAccount.publish_open_flag = 1
- </select>
- <select id="getSourceProduceContentByTitles"
- resultType="com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO">
- select record.plan_exe_id as contentId,
- output.output as title,
- record.produce_timestamp as produceTimestamp,
- record.plan_id as producePlanId
- from produce_plan_exe_record record
- join produce_plan_module_output output on record.plan_exe_id = output.plan_exe_id and output.produce_module_type = 3
- join publish_content pc on pc.source_id = record.plan_exe_id and pc.status = 2 and pc.channel = 5
- where output.output in
- <foreach collection="titleList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getAccountTypeFans"
- resultType="com.tzld.longarticle.recommend.server.model.dto.AccountTypeFansDTO">
- SELECT distinct t3.`name`,
- t3.gh_id,
- t3.follower_count,
- t6.account_source_name,
- t6.mode_type,
- t6.account_type,
- t6.`status`
- FROM publish_plan t1
- JOIN publish_plan_account t2 ON t1.id = t2.plan_id
- JOIN publish_account t3 ON t2.account_id = t3.id
- LEFT JOIN publish_account_wx_type t4 on t3.id = t4.account_id
- LEFT JOIN wx_statistics_group_source_account t5 on t3.id = t5.account_id
- LEFT JOIN wx_statistics_group_source t6 on t5.group_source_name = t6.account_source_name
- WHERE t1.plan_status = 1
- AND t3.channel = 5
- </select>
- <select id="getHisPublishByTitles"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
- select content.*, output.output as title
- from publish_content content
- join publish_content_output output
- on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
- where content.status = 2
- and output.output in
- <foreach collection="titleList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getNearestPublishContent"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent">
- select *
- from publish_content
- where publish_account_id = #{publishAccountId}
- and channel = 5
- and status = 2
- <if test="publishTimestamp != null">
- and publish_timestamp <= (#{publishTimestamp} + 3600000)
- </if>
- order by publish_timestamp desc
- <if test="size != null">
- limit #{size}
- </if>
- </select>
- <select id="getLateNearestPublishContent"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent">
- select *
- from publish_content
- where publish_account_id = #{publishAccountId}
- and channel = 5
- and status = 2
- <if test="publishTimestamp != null">
- and publish_timestamp > (#{publishTimestamp})
- </if>
- order by publish_timestamp
- </select>
- <select id="getCrawlerContentByChannelContentId"
- resultType="com.tzld.longarticle.recommend.server.model.dto.CrawlerContent">
- select cc.channel_content_id, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
- from crawler_content cc
- join crawler_account ca on cc.channel_account_id = ca.channel_account_id
- where cc.channel_content_id = #{channelContentId}
- </select>
- <select id="getProduceContentByPlanId" resultType="com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO">
- select distinct record.channel_content_id as contentId,
- output.output as title
- from produce_plan_exe_record record
- join produce_plan_module_output output
- on record.plan_exe_id = output.plan_exe_id and output.produce_module_type = 3
- where record.plan_id = #{planId} and record.status = 2 and audit_status = 1
- </select>
- <select id="getAllByProducePlanId"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord">
- select *
- from produce_plan_exe_record
- where plan_id in
- <foreach collection="producePlanIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- and status = 2
- </select>
- <select id="getCrawlerContentByChannelContentIdIn"
- resultType="com.tzld.longarticle.recommend.server.model.dto.CrawlerContent">
- select cc.channel_content_id, cprr.plan_id as crawlerPlanId, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
- from crawler_content cc
- join (select channel_source_id, max(plan_id) as plan_id from crawler_plan_result_rel group by channel_source_id) cprr
- on cc.channel_content_id = cprr.channel_source_id
- join crawler_account ca on cc.channel_account_id = ca.channel_account_id
- where cc.channel_content_id in
- <foreach collection="channelContentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="checkPublishPlanAccount" resultType="com.tzld.longarticle.recommend.server.model.dto.PublishPlanAccountNotifyDTO">
- select ppa.plan_id, pp.name as planName, pa.name as accountName
- from publish_plan_account ppa
- join publish_account pa on ppa.account_id = pa.id
- join publish_plan pp on ppa.plan_id = pp.id
- where pp.plan_status = 1 and pp.channel = 5 and pp.content_modal = 3 and ppa.publish_open_flag = 0
- </select>
- <select id="getPublishContentByTraceIdIn"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentMiniprogramDTO">
- select * from publish_content_miniprogram where trace_id in
- <foreach collection="traceIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getPushContentRelByPublishContentIdIn"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishGzhPushContentRelDTO">
- select pgpcr.*
- from publish_gzh_push_content_rel pgpcr
- join publish_gzh_push pgp on pgpcr.push_id = pgp.push_id
- where pgpcr.publish_content_id in
- <foreach collection="publishContentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getPushByPushIdIn"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishGzhPushDTO">
- select * from publish_gzh_push where push_id in
- <foreach collection="pushIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getGroupPushRelByPushIdIn"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishGzhPushContentRelDTO">
- select * from publish_gzh_push_content_rel where push_id in
- <foreach collection="pushIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- order by id
- </select>
- <select id="getPublishContentById"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
- select content.id, content.publish_timestamp, content.publish_account_id, output.output as title
- from publish_content content
- join publish_content_output output
- on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
- where content.id = #{publishContentId}
- </select>
- <select id="getPublishContentByIdIn"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
- select content.id, content.publish_timestamp, content.publish_account_id, output.output as title
- from publish_content content
- join publish_content_output output
- on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
- where content.id in
- <foreach collection="publishContentIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getPublishContentBySourceIdIn"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
- select id, plan_id, source_type, source_id, crawler_channel_content_id, publish_account_id, publish_timestamp
- from publish_content
- where status = 2 and source_id in
- <foreach collection="sourceIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getColdCrawlerPlan"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlan">
- select *
- from crawler_plan
- where plan_type = 2 and channel = 5 and content_modal = 3
- and create_timestamp between #{timeStart} and #{timeEnd}
- and plan_tag in
- <foreach collection="planTags" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getProducePlanAudit"
- resultType="com.tzld.longarticle.recommend.server.model.dto.ProducePlanAuditCheckDTO">
- select pper.plan_id, pper.audit_status as auditStatus, count(1) as num
- from produce_plan_exe_record pper
- join produce_review_record prr on prr.plan_exe_id = pper.plan_exe_id
- where pper.plan_id in
- <foreach collection="planIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- and ((pper.audit_status in (1, 2) and pper.audit_timestamp between #{timeStart} and #{timeEnd})
- or (prr.review_status = 0 and pper.create_timestamp < #{timeStart} and pper.status = 6))
- GROUP BY pper.plan_id, pper.audit_status
- </select>
- <select id="getProducePlanProduce"
- resultType="com.tzld.longarticle.recommend.server.model.dto.ProducePlanAuditCheckDTO">
- select pper.plan_id, count(1) as num
- from produce_plan_exe_record pper
- where pper.plan_id in
- <foreach collection="planIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- and pper.status >= 2
- and pper.produce_timestamp between #{timeStart} and #{timeEnd}
- GROUP BY pper.plan_id
- </select>
- <select id="getAccountTypeList"
- resultType="com.tzld.longarticle.recommend.server.model.dto.PublishAccountTypeDTO">
- SELECT DISTINCT t3.`name`, t3.gh_id, t3.follower_count, t6.account_source_name, t6.mode_type,
- t6.account_type, t6.`status`
- FROM publish_plan t1
- JOIN publish_plan_account t2 ON t1.id = t2.plan_id
- JOIN publish_account t3 ON t2.account_id = t3.id
- LEFT JOIN publish_account_wx_type t4 on t3.id = t4.account_id
- LEFT JOIN wx_statistics_group_source_account t5 on t3.id = t5.account_id
- LEFT JOIN wx_statistics_group_source t6 on t5.group_source_name = t6.account_source_name
- WHERE t1.plan_status = 1
- AND t3.channel = 5
- <if test="ghIds != null and ghIds.size() > 0">
- AND t3.gh_id in
- <foreach collection="ghIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- GROUP BY t3.id;
- </select>
- <select id="getOnlyMiniprogramArticle" resultType="java.lang.String">
- select id
- from publish_content
- where gzh_only_miniprogram_flag = 1
- order by id
- limit #{offset}, #{pageSize}
- </select>
- <select id="getProduceScoreGreaterThan"
- resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceTaskAtom">
- select atom.plan_exe_id, atom.input, atom.output, atom.create_timestamp
- from produce_task_atom atom
- join produce_plan_module_task_exe_record exe on exe.task_exe_id = atom.task_exe_id
- join produce_plan_exe_record record on exe.plan_exe_id = record.plan_exe_id
- join produce_plan_module_task task on task.task_id = exe.task_id
- where task.name in ('title 安全分', 'titile 安全分')
- and atom.create_timestamp between #{startTimeStamp} and #{endTimeStamp}
- and atom.output >= 7
- and record.status in (2, 6, 9)
- and record.audit_status in (1, 3)
- order by create_timestamp desc
- </select>
- </mapper>
|