<?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.CgiReplyBucketDataMapper">
  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="strategy" jdbcType="VARCHAR" property="strategy" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="strategy_dt" jdbcType="VARCHAR" property="strategyDt" />
    <result column="gh_id" jdbcType="VARCHAR" property="ghId" />
    <result column="msg_type" jdbcType="INTEGER" property="msgType" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="cover_url" jdbcType="VARCHAR" property="coverUrl" />
    <result column="mini_app_id" jdbcType="VARCHAR" property="miniAppId" />
    <result column="mini_page_path" jdbcType="VARCHAR" property="miniPagePath" />
    <result column="mini_video_id" jdbcType="BIGINT" property="miniVideoId" />
    <result column="root_source_id" jdbcType="VARCHAR" property="rootSourceId" />
    <result column="page_path_url_id" jdbcType="BIGINT" property="pagePathUrlId" />
    <result column="news_publish_content_id" jdbcType="VARCHAR" property="newsPublishContentId" />
    <result column="plan_id" jdbcType="VARCHAR" property="planId" />
    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, strategy, sort, strategy_dt, gh_id, msg_type, title, cover_url, mini_app_id, 
    mini_page_path, mini_video_id, root_source_id, page_path_url_id, news_publish_content_id, 
    plan_id, is_delete, create_time, update_time
  </sql>
  <select id="selectByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketDataExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from cgi_reply_bucket_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="page != null">
      limit #{page.offset} , #{page.pageSize}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from cgi_reply_bucket_data
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from cgi_reply_bucket_data
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketDataExample">
    delete from cgi_reply_bucket_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData">
    insert into cgi_reply_bucket_data (id, strategy, sort, 
      strategy_dt, gh_id, msg_type, 
      title, cover_url, mini_app_id, 
      mini_page_path, mini_video_id, root_source_id, 
      page_path_url_id, news_publish_content_id, plan_id, 
      is_delete, create_time, update_time
      )
    values (#{id,jdbcType=BIGINT}, #{strategy,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, 
      #{strategyDt,jdbcType=VARCHAR}, #{ghId,jdbcType=VARCHAR}, #{msgType,jdbcType=INTEGER}, 
      #{title,jdbcType=VARCHAR}, #{coverUrl,jdbcType=VARCHAR}, #{miniAppId,jdbcType=VARCHAR}, 
      #{miniPagePath,jdbcType=VARCHAR}, #{miniVideoId,jdbcType=BIGINT}, #{rootSourceId,jdbcType=VARCHAR}, 
      #{pagePathUrlId,jdbcType=BIGINT}, #{newsPublishContentId,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, 
      #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into cgi_reply_bucket_data
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="strategy != null">
        strategy,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="strategyDt != null">
        strategy_dt,
      </if>
      <if test="ghId != null">
        gh_id,
      </if>
      <if test="msgType != null">
        msg_type,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="coverUrl != null">
        cover_url,
      </if>
      <if test="miniAppId != null">
        mini_app_id,
      </if>
      <if test="miniPagePath != null">
        mini_page_path,
      </if>
      <if test="miniVideoId != null">
        mini_video_id,
      </if>
      <if test="rootSourceId != null">
        root_source_id,
      </if>
      <if test="pagePathUrlId != null">
        page_path_url_id,
      </if>
      <if test="newsPublishContentId != null">
        news_publish_content_id,
      </if>
      <if test="planId != null">
        plan_id,
      </if>
      <if test="isDelete != null">
        is_delete,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="strategy != null">
        #{strategy,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="strategyDt != null">
        #{strategyDt,jdbcType=VARCHAR},
      </if>
      <if test="ghId != null">
        #{ghId,jdbcType=VARCHAR},
      </if>
      <if test="msgType != null">
        #{msgType,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="coverUrl != null">
        #{coverUrl,jdbcType=VARCHAR},
      </if>
      <if test="miniAppId != null">
        #{miniAppId,jdbcType=VARCHAR},
      </if>
      <if test="miniPagePath != null">
        #{miniPagePath,jdbcType=VARCHAR},
      </if>
      <if test="miniVideoId != null">
        #{miniVideoId,jdbcType=BIGINT},
      </if>
      <if test="rootSourceId != null">
        #{rootSourceId,jdbcType=VARCHAR},
      </if>
      <if test="pagePathUrlId != null">
        #{pagePathUrlId,jdbcType=BIGINT},
      </if>
      <if test="newsPublishContentId != null">
        #{newsPublishContentId,jdbcType=VARCHAR},
      </if>
      <if test="planId != null">
        #{planId,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        #{isDelete,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketDataExample" resultType="java.lang.Long">
    select count(*) from cgi_reply_bucket_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update cgi_reply_bucket_data
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.strategy != null">
        strategy = #{record.strategy,jdbcType=VARCHAR},
      </if>
      <if test="record.sort != null">
        sort = #{record.sort,jdbcType=INTEGER},
      </if>
      <if test="record.strategyDt != null">
        strategy_dt = #{record.strategyDt,jdbcType=VARCHAR},
      </if>
      <if test="record.ghId != null">
        gh_id = #{record.ghId,jdbcType=VARCHAR},
      </if>
      <if test="record.msgType != null">
        msg_type = #{record.msgType,jdbcType=INTEGER},
      </if>
      <if test="record.title != null">
        title = #{record.title,jdbcType=VARCHAR},
      </if>
      <if test="record.coverUrl != null">
        cover_url = #{record.coverUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.miniAppId != null">
        mini_app_id = #{record.miniAppId,jdbcType=VARCHAR},
      </if>
      <if test="record.miniPagePath != null">
        mini_page_path = #{record.miniPagePath,jdbcType=VARCHAR},
      </if>
      <if test="record.miniVideoId != null">
        mini_video_id = #{record.miniVideoId,jdbcType=BIGINT},
      </if>
      <if test="record.rootSourceId != null">
        root_source_id = #{record.rootSourceId,jdbcType=VARCHAR},
      </if>
      <if test="record.pagePathUrlId != null">
        page_path_url_id = #{record.pagePathUrlId,jdbcType=BIGINT},
      </if>
      <if test="record.newsPublishContentId != null">
        news_publish_content_id = #{record.newsPublishContentId,jdbcType=VARCHAR},
      </if>
      <if test="record.planId != null">
        plan_id = #{record.planId,jdbcType=VARCHAR},
      </if>
      <if test="record.isDelete != null">
        is_delete = #{record.isDelete,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update cgi_reply_bucket_data
    set id = #{record.id,jdbcType=BIGINT},
      strategy = #{record.strategy,jdbcType=VARCHAR},
      sort = #{record.sort,jdbcType=INTEGER},
      strategy_dt = #{record.strategyDt,jdbcType=VARCHAR},
      gh_id = #{record.ghId,jdbcType=VARCHAR},
      msg_type = #{record.msgType,jdbcType=INTEGER},
      title = #{record.title,jdbcType=VARCHAR},
      cover_url = #{record.coverUrl,jdbcType=VARCHAR},
      mini_app_id = #{record.miniAppId,jdbcType=VARCHAR},
      mini_page_path = #{record.miniPagePath,jdbcType=VARCHAR},
      mini_video_id = #{record.miniVideoId,jdbcType=BIGINT},
      root_source_id = #{record.rootSourceId,jdbcType=VARCHAR},
      page_path_url_id = #{record.pagePathUrlId,jdbcType=BIGINT},
      news_publish_content_id = #{record.newsPublishContentId,jdbcType=VARCHAR},
      plan_id = #{record.planId,jdbcType=VARCHAR},
      is_delete = #{record.isDelete,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData">
    update cgi_reply_bucket_data
    <set>
      <if test="strategy != null">
        strategy = #{strategy,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="strategyDt != null">
        strategy_dt = #{strategyDt,jdbcType=VARCHAR},
      </if>
      <if test="ghId != null">
        gh_id = #{ghId,jdbcType=VARCHAR},
      </if>
      <if test="msgType != null">
        msg_type = #{msgType,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="coverUrl != null">
        cover_url = #{coverUrl,jdbcType=VARCHAR},
      </if>
      <if test="miniAppId != null">
        mini_app_id = #{miniAppId,jdbcType=VARCHAR},
      </if>
      <if test="miniPagePath != null">
        mini_page_path = #{miniPagePath,jdbcType=VARCHAR},
      </if>
      <if test="miniVideoId != null">
        mini_video_id = #{miniVideoId,jdbcType=BIGINT},
      </if>
      <if test="rootSourceId != null">
        root_source_id = #{rootSourceId,jdbcType=VARCHAR},
      </if>
      <if test="pagePathUrlId != null">
        page_path_url_id = #{pagePathUrlId,jdbcType=BIGINT},
      </if>
      <if test="newsPublishContentId != null">
        news_publish_content_id = #{newsPublishContentId,jdbcType=VARCHAR},
      </if>
      <if test="planId != null">
        plan_id = #{planId,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        is_delete = #{isDelete,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData">
    update cgi_reply_bucket_data
    set strategy = #{strategy,jdbcType=VARCHAR},
      sort = #{sort,jdbcType=INTEGER},
      strategy_dt = #{strategyDt,jdbcType=VARCHAR},
      gh_id = #{ghId,jdbcType=VARCHAR},
      msg_type = #{msgType,jdbcType=INTEGER},
      title = #{title,jdbcType=VARCHAR},
      cover_url = #{coverUrl,jdbcType=VARCHAR},
      mini_app_id = #{miniAppId,jdbcType=VARCHAR},
      mini_page_path = #{miniPagePath,jdbcType=VARCHAR},
      mini_video_id = #{miniVideoId,jdbcType=BIGINT},
      root_source_id = #{rootSourceId,jdbcType=VARCHAR},
      page_path_url_id = #{pagePathUrlId,jdbcType=BIGINT},
      news_publish_content_id = #{newsPublishContentId,jdbcType=VARCHAR},
      plan_id = #{planId,jdbcType=VARCHAR},
      is_delete = #{isDelete,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>

  <select id="selectVideoId" resultType="java.lang.Long">
    select distinct mini_video_id
    from cgi_reply_bucket_data
    where is_delete = 0 and create_time > #{createTime,jdbcType=TIMESTAMP};
  </select>
</mapper>