AigcBaseMapper.xml 16 KB

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