AigcBaseMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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.aigc.AigcBaseMapper">
  4. <select id="getPublishAccountByGhId"
  5. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount">
  6. select * from publish_account where gh_id = #{ghId} limit 1
  7. </select>
  8. <select id="getPublishContentByTitle"
  9. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
  10. select content.id, content.plan_id, content.source_type, content.source_id, content.crawler_channel_content_id,
  11. content.publish_account_id, content.publish_timestamp, output.output as title
  12. from publish_content content
  13. join publish_content_output output
  14. on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
  15. where content.status = 2
  16. and content.publish_account_id in
  17. <foreach collection="list" item="item" open="(" close=")" separator=",">
  18. #{item.publishAccountId}
  19. </foreach>
  20. and output.output in
  21. <foreach collection="list" item="item" open="(" close=")" separator=",">
  22. #{item.title}
  23. </foreach>
  24. </select>
  25. <select id="getMiniProgramTask"
  26. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishPlanMiniprogramTask">
  27. select * from publish_plan_miniprogram_task where
  28. <foreach collection="list" item="item" open="(" close=")" separator=" or ">
  29. (plan_id = #{item.planId} and account_ids like CONCAT("%", #{item.accountId}, "%"))
  30. </foreach>
  31. </select>
  32. <select id="getProduceContent"
  33. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord">
  34. select * from produce_plan_exe_record where plan_exe_id = #{id}
  35. </select>
  36. <select id="getProducePlan"
  37. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlan">
  38. select * from produce_plan where id = #{id}
  39. </select>
  40. <select id="getProducePlanInputSources"
  41. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanInputSource">
  42. select * from produce_plan_input_source where plan_id = #{planId} and data_status = 1
  43. </select>
  44. <select id="getCrawlerPlanRelByChannelContentIds"
  45. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlanResultRel">
  46. select * from crawler_plan_result_rel where channel_source_id in
  47. <foreach collection="channelContentIds" item="item" open="(" close=")" separator=",">
  48. #{item}
  49. </foreach>
  50. </select>
  51. <select id="getCrawlerPlanByPlanIds"
  52. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlan">
  53. select * from crawler_plan where id in
  54. <foreach collection="planIds" item="item" open="(" close=")" separator=",">
  55. #{item}
  56. </foreach>
  57. </select>
  58. <select id="getNotPublishPlan" resultType="com.tzld.longarticle.recommend.server.model.dto.NotPublishPlan">
  59. SELECT
  60. plan.id as planId,
  61. plan.NAME as planName,
  62. plan.error_msg as errorMsg,
  63. stat.today_expect_publish_count as expectCount,
  64. stat.today_publish_count as publishCount,
  65. setting.publish_push_time as publishPushTime
  66. FROM publish_plan plan
  67. JOIN publish_plan_stat stat ON plan.id = stat.plan_id
  68. JOIN publish_plan_setting setting ON plan.id = setting.plan_id
  69. WHERE
  70. stat.today_expect_publish_count > stat.today_publish_count
  71. AND plan.plan_status = 1
  72. AND setting.push_type = 2
  73. and plan.create_timestamp &lt; #{todayStart}
  74. </select>
  75. <select id="getPublishPlanPushType" resultType="java.lang.Integer">
  76. select push_type from publish_plan_setting where plan_id = #{planId}
  77. </select>
  78. <select id="getPublishAccounts"
  79. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount">
  80. SELECT account.*
  81. FROM publish_plan_account planAccount
  82. join publish_account account on planAccount.account_id = account.id
  83. left join publish_content content
  84. on content.publish_account_id = planAccount.account_id
  85. and content.plan_id = planAccount.plan_id
  86. and content.publish_timestamp > #{todayStart}
  87. WHERE planAccount.plan_id = #{planId} and content.id is null and planAccount.publish_open_flag = 1
  88. </select>
  89. <select id="getSourceProduceContentByTitles"
  90. resultType="com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO">
  91. select record.plan_exe_id as contentId,
  92. output.output as title,
  93. record.produce_timestamp as produceTimestamp,
  94. record.plan_id as producePlanId
  95. from produce_plan_exe_record record
  96. join produce_plan_module_output output on record.plan_exe_id = output.plan_exe_id and output.produce_module_type = 3
  97. join publish_content pc on pc.source_id = record.plan_exe_id and pc.status = 2 and pc.channel = 5
  98. where output.output in
  99. <foreach collection="titleList" item="item" open="(" close=")" separator=",">
  100. #{item}
  101. </foreach>
  102. </select>
  103. <select id="getAccountTypeFans"
  104. resultType="com.tzld.longarticle.recommend.server.model.dto.AccountTypeFansDTO">
  105. SELECT distinct t3.`name`,
  106. t3.gh_id,
  107. t3.follower_count,
  108. t6.account_source_name,
  109. t6.mode_type,
  110. t6.account_type,
  111. t6.`status`
  112. FROM publish_plan t1
  113. JOIN publish_plan_account t2 ON t1.id = t2.plan_id
  114. JOIN publish_account t3 ON t2.account_id = t3.id
  115. LEFT JOIN publish_account_wx_type t4 on t3.id = t4.account_id
  116. LEFT JOIN wx_statistics_group_source_account t5 on t3.id = t5.account_id
  117. LEFT JOIN wx_statistics_group_source t6 on t5.group_source_name = t6.account_source_name
  118. WHERE t1.plan_status = 1
  119. AND t3.channel = 5
  120. </select>
  121. <select id="getHisPublishByTitles"
  122. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
  123. select content.*, output.output as title
  124. from publish_content content
  125. join publish_content_output output
  126. on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
  127. where content.status = 2
  128. and output.output in
  129. <foreach collection="titleList" item="item" open="(" close=")" separator=",">
  130. #{item}
  131. </foreach>
  132. </select>
  133. <select id="getNearestPublishContent"
  134. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent">
  135. select *
  136. from publish_content
  137. where publish_account_id = #{publishAccountId}
  138. and channel = 5
  139. and status = 2
  140. <if test="publishTimestamp != null">
  141. and publish_timestamp &lt;= (#{publishTimestamp} + 3600000)
  142. </if>
  143. order by publish_timestamp desc
  144. <if test="size != null">
  145. limit #{size}
  146. </if>
  147. </select>
  148. <select id="getLateNearestPublishContent"
  149. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent">
  150. select *
  151. from publish_content
  152. where publish_account_id = #{publishAccountId}
  153. and channel = 5
  154. and status = 2
  155. <if test="publishTimestamp != null">
  156. and publish_timestamp > (#{publishTimestamp})
  157. </if>
  158. order by publish_timestamp
  159. </select>
  160. <select id="getCrawlerContentByChannelContentId"
  161. resultType="com.tzld.longarticle.recommend.server.model.dto.CrawlerContent">
  162. select cc.channel_content_id, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
  163. from crawler_content cc
  164. join crawler_account ca on cc.channel_account_id = ca.channel_account_id
  165. where cc.channel_content_id = #{channelContentId}
  166. </select>
  167. <select id="getProduceContentByPlanId" resultType="com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO">
  168. select distinct record.channel_content_id as contentId,
  169. output.output as title
  170. from produce_plan_exe_record record
  171. join produce_plan_module_output output
  172. on record.plan_exe_id = output.plan_exe_id and output.produce_module_type = 3
  173. where record.plan_id = #{planId} and record.status = 2 and audit_status = 1
  174. </select>
  175. <select id="getAllByProducePlanId"
  176. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord">
  177. select *
  178. from produce_plan_exe_record
  179. where plan_id in
  180. <foreach collection="producePlanIds" item="item" open="(" close=")" separator=",">
  181. #{item}
  182. </foreach>
  183. and status = 2
  184. </select>
  185. <select id="getCrawlerContentByChannelContentIdIn"
  186. resultType="com.tzld.longarticle.recommend.server.model.dto.CrawlerContent">
  187. select cc.channel_content_id, cprr.plan_id as crawlerPlanId, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
  188. from crawler_content cc
  189. join (select channel_source_id, max(plan_id) as plan_id from crawler_plan_result_rel group by channel_source_id) cprr
  190. on cc.channel_content_id = cprr.channel_source_id
  191. join crawler_account ca on cc.channel_account_id = ca.channel_account_id
  192. where cc.channel_content_id in
  193. <foreach collection="channelContentIds" item="item" open="(" close=")" separator=",">
  194. #{item}
  195. </foreach>
  196. </select>
  197. <select id="checkPublishPlanAccount" resultType="com.tzld.longarticle.recommend.server.model.dto.PublishPlanAccountNotifyDTO">
  198. select ppa.plan_id, pp.name as planName, pa.name as accountName
  199. from publish_plan_account ppa
  200. join publish_account pa on ppa.account_id = pa.id
  201. join publish_plan pp on ppa.plan_id = pp.id
  202. where pp.plan_status = 1 and pp.channel = 5 and pp.content_modal = 3 and ppa.publish_open_flag = 0
  203. </select>
  204. <select id="getPublishContentByTraceIdIn"
  205. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentMiniprogramDTO">
  206. select * from publish_content_miniprogram where trace_id in
  207. <foreach collection="traceIds" item="item" open="(" close=")" separator=",">
  208. #{item}
  209. </foreach>
  210. </select>
  211. <select id="getPushContentRelByPublishContentIdIn"
  212. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishGzhPushContentRelDTO">
  213. select pgpcr.*
  214. from publish_gzh_push_content_rel pgpcr
  215. join publish_gzh_push pgp on pgpcr.push_id = pgp.push_id
  216. where pgpcr.publish_content_id in
  217. <foreach collection="publishContentIds" item="item" open="(" close=")" separator=",">
  218. #{item}
  219. </foreach>
  220. </select>
  221. <select id="getPushByPushIdIn"
  222. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishGzhPushDTO">
  223. select * from publish_gzh_push where push_id in
  224. <foreach collection="pushIds" item="item" open="(" close=")" separator=",">
  225. #{item}
  226. </foreach>
  227. </select>
  228. <select id="getGroupPushRelByPushIdIn"
  229. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishGzhPushContentRelDTO">
  230. select * from publish_gzh_push_content_rel where push_id in
  231. <foreach collection="pushIds" item="item" open="(" close=")" separator=",">
  232. #{item}
  233. </foreach>
  234. order by id
  235. </select>
  236. <select id="getPublishContentById"
  237. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
  238. select content.id, content.publish_timestamp, content.publish_account_id, output.output as title
  239. from publish_content content
  240. join publish_content_output output
  241. on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
  242. where content.id = #{publishContentId}
  243. </select>
  244. <select id="getPublishContentByIdIn"
  245. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
  246. select content.id, content.publish_timestamp, content.publish_account_id, output.output as title
  247. from publish_content content
  248. join publish_content_output output
  249. on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
  250. where content.id in
  251. <foreach collection="publishContentIds" item="item" open="(" close=")" separator=",">
  252. #{item}
  253. </foreach>
  254. </select>
  255. <select id="getPublishContentBySourceIdIn"
  256. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
  257. select id, plan_id, source_type, source_id, crawler_channel_content_id, publish_account_id, publish_timestamp
  258. from publish_content
  259. where status = 2 and source_id in
  260. <foreach collection="sourceIds" item="item" open="(" close=")" separator=",">
  261. #{item}
  262. </foreach>
  263. </select>
  264. <select id="getColdCrawlerPlan"
  265. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlan">
  266. select *
  267. from crawler_plan
  268. where plan_type = 2 and channel = 5 and content_modal = 3
  269. and create_timestamp between #{timeStart} and #{timeEnd}
  270. and plan_tag in
  271. <foreach collection="planTags" item="item" open="(" close=")" separator=",">
  272. #{item}
  273. </foreach>
  274. </select>
  275. <select id="getProducePlanAudit"
  276. resultType="com.tzld.longarticle.recommend.server.model.dto.ProducePlanAuditCheckDTO">
  277. select pper.plan_id, pper.audit_status as auditStatus, count(1) as num
  278. from produce_plan_exe_record pper
  279. join produce_review_record prr on prr.plan_exe_id = pper.plan_exe_id
  280. where pper.plan_id in
  281. <foreach collection="planIds" item="item" open="(" close=")" separator=",">
  282. #{item}
  283. </foreach>
  284. and ((pper.audit_status in (1, 2) and pper.audit_timestamp between #{timeStart} and #{timeEnd})
  285. or (prr.review_status = 0 and pper.create_timestamp &lt; #{timeStart} and pper.status = 6))
  286. GROUP BY pper.plan_id, pper.audit_status
  287. </select>
  288. <select id="getProducePlanProduce"
  289. resultType="com.tzld.longarticle.recommend.server.model.dto.ProducePlanAuditCheckDTO">
  290. select pper.plan_id, count(1) as num
  291. from produce_plan_exe_record pper
  292. where pper.plan_id in
  293. <foreach collection="planIds" item="item" open="(" close=")" separator=",">
  294. #{item}
  295. </foreach>
  296. and pper.status >= 2
  297. and pper.produce_timestamp between #{timeStart} and #{timeEnd}
  298. GROUP BY pper.plan_id
  299. </select>
  300. <select id="getAccountTypeList"
  301. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishAccountTypeDTO">
  302. SELECT DISTINCT t3.`name`, t3.gh_id, t3.follower_count, t6.account_source_name, t6.mode_type,
  303. t6.account_type, t6.`status`
  304. FROM publish_plan t1
  305. JOIN publish_plan_account t2 ON t1.id = t2.plan_id
  306. JOIN publish_account t3 ON t2.account_id = t3.id
  307. LEFT JOIN publish_account_wx_type t4 on t3.id = t4.account_id
  308. LEFT JOIN wx_statistics_group_source_account t5 on t3.id = t5.account_id
  309. LEFT JOIN wx_statistics_group_source t6 on t5.group_source_name = t6.account_source_name
  310. WHERE t1.plan_status = 1
  311. AND t3.channel = 5
  312. <if test="ghIds != null and ghIds.size() > 0">
  313. AND t3.gh_id in
  314. <foreach collection="ghIds" item="item" open="(" close=")" separator=",">
  315. #{item}
  316. </foreach>
  317. </if>
  318. GROUP BY t3.id;
  319. </select>
  320. <select id="getOnlyMiniprogramArticle" resultType="java.lang.String">
  321. select id
  322. from publish_content
  323. where gzh_only_miniprogram_flag = 1
  324. order by id
  325. limit #{offset}, #{pageSize}
  326. </select>
  327. <select id="getProduceScoreGreaterThan"
  328. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceTaskAtom">
  329. select atom.plan_exe_id, atom.input, atom.output, atom.create_timestamp
  330. from produce_task_atom atom
  331. join produce_plan_module_task_exe_record exe on exe.task_exe_id = atom.task_exe_id
  332. join produce_plan_exe_record record on exe.plan_exe_id = record.plan_exe_id
  333. join produce_plan_module_task task on task.task_id = exe.task_id
  334. where task.name in ('title 安全分', 'titile 安全分')
  335. and atom.create_timestamp between #{startTimeStamp} and #{endTimeStamp}
  336. and atom.output >= 7
  337. and record.status in (2, 6, 9)
  338. and record.audit_status in (1, 3)
  339. order by create_timestamp desc
  340. </select>
  341. </mapper>