AigcBaseMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.*, output.output as title
  11. from publish_content content
  12. join publish_content_output output
  13. on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
  14. where content.status = 2
  15. and (content.publish_account_id, output.output) in
  16. <foreach collection="list" item="item" open="(" close=")" separator=",">
  17. (#{item.publishAccountId}, #{item.title})
  18. </foreach>
  19. </select>
  20. <select id="getPublishPlanById"
  21. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishPlan">
  22. select * from publish_plan where id = #{planId}
  23. </select>
  24. <select id="getMiniProgramTask"
  25. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishPlanMiniprogramTask">
  26. select * from publish_plan_miniprogram_task where
  27. <foreach collection="list" item="item" open="(" close=")" separator=" or ">
  28. (plan_id = #{item.planId} and account_ids like CONCAT("%", #{item.accountId}, "%"))
  29. </foreach>
  30. </select>
  31. <select id="getProduceContent"
  32. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord">
  33. select * from produce_plan_exe_record where plan_exe_id = #{id}
  34. </select>
  35. <select id="getProducePlan"
  36. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlan">
  37. select * from produce_plan where id = #{id}
  38. </select>
  39. <select id="getProducePlanInputSources"
  40. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanInputSource">
  41. select * from produce_plan_input_source where plan_id = #{planId} and data_status = 1
  42. </select>
  43. <select id="getCrawlerPlanRelByChannelContentIds"
  44. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlanResultRel">
  45. select * from crawler_plan_result_rel where channel_source_id in
  46. <foreach collection="channelContentIds" item="item" open="(" close=")" separator=",">
  47. #{item}
  48. </foreach>
  49. </select>
  50. <select id="getCrawlerPlanByPlanIds"
  51. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlan">
  52. select * from crawler_plan where id in
  53. <foreach collection="planIds" item="item" open="(" close=")" separator=",">
  54. #{item}
  55. </foreach>
  56. </select>
  57. <select id="getNotPublishPlan" resultType="com.tzld.longarticle.recommend.server.model.dto.NotPublishPlan">
  58. SELECT
  59. plan.id as planId,
  60. plan.NAME as planName,
  61. plan.error_msg as errorMsg,
  62. stat.today_expect_publish_count as expectCount,
  63. stat.today_publish_count as publishCount,
  64. setting.publish_push_time as publishPushTime
  65. FROM publish_plan plan
  66. JOIN publish_plan_stat stat ON plan.id = stat.plan_id
  67. JOIN publish_plan_setting setting ON plan.id = setting.plan_id
  68. WHERE
  69. stat.today_expect_publish_count > stat.today_publish_count
  70. AND plan.plan_status = 1
  71. AND setting.push_type = 2
  72. and plan.create_timestamp &lt; #{todayStart}
  73. </select>
  74. <select id="getPublishPlanPushType" resultType="java.lang.Integer">
  75. select push_type from publish_plan_setting where plan_id = #{planId}
  76. </select>
  77. <select id="getPublishAccounts"
  78. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount">
  79. SELECT account.*
  80. FROM publish_plan_account planAccount
  81. join publish_account account on planAccount.account_id = account.id
  82. left join publish_content content
  83. on content.publish_account_id = planAccount.account_id
  84. and content.plan_id = planAccount.plan_id
  85. and content.publish_timestamp > #{todayStart}
  86. WHERE planAccount.plan_id = #{planId} and content.id is null and planAccount.publish_open_flag = 1
  87. </select>
  88. <select id="getSourceProduceContentByTitles"
  89. resultType="com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO">
  90. select record.plan_exe_id as contentId,
  91. output.output as title,
  92. record.produce_timestamp as produceTimestamp,
  93. record.plan_id as producePlanId
  94. from produce_plan_exe_record record
  95. join produce_plan_module_output output on record.plan_exe_id = output.plan_exe_id and output.produce_module_type = 3
  96. join publish_content pc on pc.source_id = record.plan_exe_id and pc.status = 2 and pc.channel = 5
  97. where output.output in
  98. <foreach collection="titleList" item="item" open="(" close=")" separator=",">
  99. #{item}
  100. </foreach>
  101. </select>
  102. <select id="getAccountTypeFans"
  103. resultType="com.tzld.longarticle.recommend.server.model.dto.AccountTypeFansDTO">
  104. SELECT distinct t3.`name`,
  105. t3.gh_id,
  106. t3.follower_count,
  107. t6.account_source_name,
  108. t6.mode_type,
  109. t6.account_type,
  110. t6.`status`
  111. FROM publish_plan t1
  112. JOIN publish_plan_account t2 ON t1.id = t2.plan_id
  113. JOIN publish_account t3 ON t2.account_id = t3.id
  114. LEFT JOIN publish_account_wx_type t4 on t3.id = t4.account_id
  115. LEFT JOIN wx_statistics_group_source_account t5 on t3.id = t5.account_id
  116. LEFT JOIN wx_statistics_group_source t6 on t5.group_source_name = t6.account_source_name
  117. WHERE t1.plan_status = 1
  118. AND t3.channel = 5
  119. </select>
  120. <select id="getHisPublishByTitles"
  121. resultType="com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO">
  122. select content.*, output.output as title
  123. from publish_content content
  124. join publish_content_output output
  125. on content.id = output.publish_content_id and output.content_type = 3 AND output.select_status = 1
  126. where content.status = 2
  127. and output.output in
  128. <foreach collection="titleList" item="item" open="(" close=")" separator=",">
  129. #{item}
  130. </foreach>
  131. </select>
  132. <select id="getNearestPublishContent"
  133. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent">
  134. select *
  135. from publish_content
  136. where publish_account_id = #{publishAccountId}
  137. and channel = 5
  138. and status = 2
  139. <if test="publishTimestamp != null">
  140. and publish_timestamp &lt;= (#{publishTimestamp} + 3600000)
  141. </if>
  142. order by publish_timestamp desc
  143. <if test="size != null">
  144. limit #{size}
  145. </if>
  146. </select>
  147. <select id="getCrawlerContentByChannelContentId"
  148. resultType="com.tzld.longarticle.recommend.server.model.dto.CrawlerContent">
  149. select cc.channel_content_id, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
  150. from crawler_content cc
  151. join crawler_account ca on cc.channel_account_id = ca.channel_account_id
  152. where cc.channel_content_id = #{channelContentId}
  153. </select>
  154. <select id="getProduceContentByPlanId" resultType="com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO">
  155. select distinct record.channel_content_id as contentId,
  156. output.output as title
  157. from produce_plan_exe_record record
  158. join produce_plan_module_output output
  159. on record.plan_exe_id = output.plan_exe_id and output.produce_module_type = 3
  160. where record.plan_id = #{planId} and record.status = 2 and audit_status = 1
  161. </select>
  162. <select id="getAllByProducePlanId"
  163. resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord">
  164. select *
  165. from produce_plan_exe_record
  166. where plan_id in
  167. <foreach collection="producePlanIds" item="item" open="(" close=")" separator=",">
  168. #{item}
  169. </foreach>
  170. and status = 2
  171. </select>
  172. <select id="getCrawlerContentByChannelContentIdIn"
  173. resultType="com.tzld.longarticle.recommend.server.model.dto.CrawlerContent">
  174. select cc.channel_content_id, cprr.plan_id as crawlerPlanId, ca.wx_gh as ghId, cc.title, cc.publish_timestamp
  175. from crawler_content cc
  176. join (select channel_source_id, max(plan_id) as plan_id from crawler_plan_result_rel group by channel_source_id) cprr
  177. on cc.channel_content_id = cprr.channel_source_id
  178. join crawler_account ca on cc.channel_account_id = ca.channel_account_id
  179. where cc.channel_content_id in
  180. <foreach collection="channelContentIds" item="item" open="(" close=")" separator=",">
  181. #{item}
  182. </foreach>
  183. </select>
  184. <select id="checkPublishPlanAccount" resultType="com.tzld.longarticle.recommend.server.model.dto.PublishPlanAccountNotifyDTO">
  185. select ppa.plan_id, pp.name as planName, pa.name as accountName
  186. from publish_plan_account ppa
  187. join publish_account pa on ppa.account_id = pa.id
  188. join publish_plan pp on ppa.plan_id = pp.id
  189. where pp.plan_status = 1 and pp.channel = 5 and pp.content_modal = 3 and ppa.publish_open_flag = 0
  190. </select>
  191. </mapper>