<?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.api.dao.mapper.contentplatform.ContentPlatformVideoDataStatAggMapper">
  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="dt" jdbcType="VARCHAR" property="dt" />
    <result column="video_id" jdbcType="BIGINT" property="videoId" />
    <result column="type" jdbcType="VARCHAR" property="type" />
    <result column="channel" jdbcType="VARCHAR" property="channel" />
    <result column="strategy" jdbcType="VARCHAR" property="strategy" />
    <result column="first_level" jdbcType="BIGINT" property="firstLevel" />
    <result column="fission0" jdbcType="BIGINT" property="fission0" />
    <result column="fission_rate" jdbcType="DOUBLE" property="fissionRate" />
    <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
  </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, dt, video_id, `type`, channel, strategy, first_level, fission0, fission_rate, 
    create_timestamp
  </sql>
  <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAggExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from content_platform_video_datastat_agg
    <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 content_platform_video_datastat_agg
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from content_platform_video_datastat_agg
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAggExample">
    delete from content_platform_video_datastat_agg
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
    insert into content_platform_video_datastat_agg (id, dt, video_id, 
      `type`, channel, strategy, 
      first_level, fission0, fission_rate, 
      create_timestamp)
    values (#{id,jdbcType=BIGINT}, #{dt,jdbcType=VARCHAR}, #{videoId,jdbcType=BIGINT}, 
      #{type,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{strategy,jdbcType=VARCHAR}, 
      #{firstLevel,jdbcType=BIGINT}, #{fission0,jdbcType=BIGINT}, #{fissionRate,jdbcType=DOUBLE}, 
      #{createTimestamp,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
    insert into content_platform_video_datastat_agg
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="dt != null">
        dt,
      </if>
      <if test="videoId != null">
        video_id,
      </if>
      <if test="type != null">
        `type`,
      </if>
      <if test="channel != null">
        channel,
      </if>
      <if test="strategy != null">
        strategy,
      </if>
      <if test="firstLevel != null">
        first_level,
      </if>
      <if test="fission0 != null">
        fission0,
      </if>
      <if test="fissionRate != null">
        fission_rate,
      </if>
      <if test="createTimestamp != null">
        create_timestamp,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="dt != null">
        #{dt,jdbcType=VARCHAR},
      </if>
      <if test="videoId != null">
        #{videoId,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        #{type,jdbcType=VARCHAR},
      </if>
      <if test="channel != null">
        #{channel,jdbcType=VARCHAR},
      </if>
      <if test="strategy != null">
        #{strategy,jdbcType=VARCHAR},
      </if>
      <if test="firstLevel != null">
        #{firstLevel,jdbcType=BIGINT},
      </if>
      <if test="fission0 != null">
        #{fission0,jdbcType=BIGINT},
      </if>
      <if test="fissionRate != null">
        #{fissionRate,jdbcType=DOUBLE},
      </if>
      <if test="createTimestamp != null">
        #{createTimestamp,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAggExample" resultType="java.lang.Long">
    select count(*) from content_platform_video_datastat_agg
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update content_platform_video_datastat_agg
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.dt != null">
        dt = #{record.dt,jdbcType=VARCHAR},
      </if>
      <if test="record.videoId != null">
        video_id = #{record.videoId,jdbcType=BIGINT},
      </if>
      <if test="record.type != null">
        `type` = #{record.type,jdbcType=VARCHAR},
      </if>
      <if test="record.channel != null">
        channel = #{record.channel,jdbcType=VARCHAR},
      </if>
      <if test="record.strategy != null">
        strategy = #{record.strategy,jdbcType=VARCHAR},
      </if>
      <if test="record.firstLevel != null">
        first_level = #{record.firstLevel,jdbcType=BIGINT},
      </if>
      <if test="record.fission0 != null">
        fission0 = #{record.fission0,jdbcType=BIGINT},
      </if>
      <if test="record.fissionRate != null">
        fission_rate = #{record.fissionRate,jdbcType=DOUBLE},
      </if>
      <if test="record.createTimestamp != null">
        create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update content_platform_video_datastat_agg
    set id = #{record.id,jdbcType=BIGINT},
      dt = #{record.dt,jdbcType=VARCHAR},
      video_id = #{record.videoId,jdbcType=BIGINT},
      `type` = #{record.type,jdbcType=VARCHAR},
      channel = #{record.channel,jdbcType=VARCHAR},
      strategy = #{record.strategy,jdbcType=VARCHAR},
      first_level = #{record.firstLevel,jdbcType=BIGINT},
      fission0 = #{record.fission0,jdbcType=BIGINT},
      fission_rate = #{record.fissionRate,jdbcType=DOUBLE},
      create_timestamp = #{record.createTimestamp,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
    update content_platform_video_datastat_agg
    <set>
      <if test="dt != null">
        dt = #{dt,jdbcType=VARCHAR},
      </if>
      <if test="videoId != null">
        video_id = #{videoId,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        `type` = #{type,jdbcType=VARCHAR},
      </if>
      <if test="channel != null">
        channel = #{channel,jdbcType=VARCHAR},
      </if>
      <if test="strategy != null">
        strategy = #{strategy,jdbcType=VARCHAR},
      </if>
      <if test="firstLevel != null">
        first_level = #{firstLevel,jdbcType=BIGINT},
      </if>
      <if test="fission0 != null">
        fission0 = #{fission0,jdbcType=BIGINT},
      </if>
      <if test="fissionRate != null">
        fission_rate = #{fissionRate,jdbcType=DOUBLE},
      </if>
      <if test="createTimestamp != null">
        create_timestamp = #{createTimestamp,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoDataStatAgg">
    update content_platform_video_datastat_agg
    set dt = #{dt,jdbcType=VARCHAR},
      video_id = #{videoId,jdbcType=BIGINT},
      `type` = #{type,jdbcType=VARCHAR},
      channel = #{channel,jdbcType=VARCHAR},
      strategy = #{strategy,jdbcType=VARCHAR},
      first_level = #{firstLevel,jdbcType=BIGINT},
      fission0 = #{fission0,jdbcType=BIGINT},
      fission_rate = #{fissionRate,jdbcType=DOUBLE},
      create_timestamp = #{createTimestamp,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>