<?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.piaoquan.growth.common.dao.mapper.ext.CgiReplyBucketDataMapperExt">

  <update id="updateBucketDataTitleCoverByGhId">
      update cgi_reply_bucket_data
      set title = #{title},
          cover_url = #{cover}
      where gh_id = #{ghId}
        and mini_video_id = #{videoId}
        and is_delete = 0
  </update>

  <update id="deleteBucketDataByGhId">
      update cgi_reply_bucket_data
      set is_delete = 1
      where gh_id = #{ghId}
        and is_delete = 0
  </update>

    <select id="getOldCgiReplyData" resultType="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData">
        select *
        from growth.cgi_reply_bucket_data
        where mini_video_id = #{videoId} and title is not null and cover_url is not null
        order by id desc limit 1
    </select>

    <select id="getRootSourceIdByPrefix" resultType="java.lang.String">
        select distinct root_source_id
        from cgi_reply_bucket_data
        where create_time > #{startDate}
          and root_source_id like concat(#{prefix}, '%')
    </select>

    <update id="updateDeleteStatus">
        update cgi_reply_bucket_data
        set is_delete = #{isDelete}
        where gh_id = #{ghId}
        and strategy = #{strategy}
        and msg_type = #{msgType}
    </update>

</mapper>