<?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.ContentPlatformQwPlanMapper">
  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwPlan">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="sub_channel" jdbcType="VARCHAR" property="subChannel" />
    <result column="scene" jdbcType="INTEGER" property="scene" />
    <result column="page_url" jdbcType="VARCHAR" property="pageUrl" />
    <result column="root_source_id" jdbcType="VARCHAR" property="rootSourceId" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="create_account_id" jdbcType="BIGINT" property="createAccountId" />
    <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
    <result column="update_timestamp" jdbcType="BIGINT" property="updateTimestamp" />
  </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, `type`, sub_channel, scene, page_url, root_source_id, `status`, create_account_id, 
    create_timestamp, update_timestamp
  </sql>
  <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwPlanExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from content_platform_qw_plan
    <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_qw_plan
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from content_platform_qw_plan
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwPlanExample">
    delete from content_platform_qw_plan
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwPlan">
    insert into content_platform_qw_plan (id, `type`, sub_channel, 
      scene, page_url, root_source_id, 
      `status`, create_account_id, create_timestamp, 
      update_timestamp)
    values (#{id,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, #{subChannel,jdbcType=VARCHAR}, 
      #{scene,jdbcType=INTEGER}, #{pageUrl,jdbcType=VARCHAR}, #{rootSourceId,jdbcType=VARCHAR}, 
      #{status,jdbcType=INTEGER}, #{createAccountId,jdbcType=BIGINT}, #{createTimestamp,jdbcType=BIGINT}, 
      #{updateTimestamp,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwPlan">
    insert into content_platform_qw_plan
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="type != null">
        `type`,
      </if>
      <if test="subChannel != null">
        sub_channel,
      </if>
      <if test="scene != null">
        scene,
      </if>
      <if test="pageUrl != null">
        page_url,
      </if>
      <if test="rootSourceId != null">
        root_source_id,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="createAccountId != null">
        create_account_id,
      </if>
      <if test="createTimestamp != null">
        create_timestamp,
      </if>
      <if test="updateTimestamp != null">
        update_timestamp,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="subChannel != null">
        #{subChannel,jdbcType=VARCHAR},
      </if>
      <if test="scene != null">
        #{scene,jdbcType=INTEGER},
      </if>
      <if test="pageUrl != null">
        #{pageUrl,jdbcType=VARCHAR},
      </if>
      <if test="rootSourceId != null">
        #{rootSourceId,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="createAccountId != null">
        #{createAccountId,jdbcType=BIGINT},
      </if>
      <if test="createTimestamp != null">
        #{createTimestamp,jdbcType=BIGINT},
      </if>
      <if test="updateTimestamp != null">
        #{updateTimestamp,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwPlanExample" resultType="java.lang.Long">
    select count(*) from content_platform_qw_plan
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update content_platform_qw_plan
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.type != null">
        `type` = #{record.type,jdbcType=INTEGER},
      </if>
      <if test="record.subChannel != null">
        sub_channel = #{record.subChannel,jdbcType=VARCHAR},
      </if>
      <if test="record.scene != null">
        scene = #{record.scene,jdbcType=INTEGER},
      </if>
      <if test="record.pageUrl != null">
        page_url = #{record.pageUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.rootSourceId != null">
        root_source_id = #{record.rootSourceId,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null">
        `status` = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.createAccountId != null">
        create_account_id = #{record.createAccountId,jdbcType=BIGINT},
      </if>
      <if test="record.createTimestamp != null">
        create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
      </if>
      <if test="record.updateTimestamp != null">
        update_timestamp = #{record.updateTimestamp,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_qw_plan
    set id = #{record.id,jdbcType=BIGINT},
      `type` = #{record.type,jdbcType=INTEGER},
      sub_channel = #{record.subChannel,jdbcType=VARCHAR},
      scene = #{record.scene,jdbcType=INTEGER},
      page_url = #{record.pageUrl,jdbcType=VARCHAR},
      root_source_id = #{record.rootSourceId,jdbcType=VARCHAR},
      `status` = #{record.status,jdbcType=INTEGER},
      create_account_id = #{record.createAccountId,jdbcType=BIGINT},
      create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
      update_timestamp = #{record.updateTimestamp,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.ContentPlatformQwPlan">
    update content_platform_qw_plan
    <set>
      <if test="type != null">
        `type` = #{type,jdbcType=INTEGER},
      </if>
      <if test="subChannel != null">
        sub_channel = #{subChannel,jdbcType=VARCHAR},
      </if>
      <if test="scene != null">
        scene = #{scene,jdbcType=INTEGER},
      </if>
      <if test="pageUrl != null">
        page_url = #{pageUrl,jdbcType=VARCHAR},
      </if>
      <if test="rootSourceId != null">
        root_source_id = #{rootSourceId,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=INTEGER},
      </if>
      <if test="createAccountId != null">
        create_account_id = #{createAccountId,jdbcType=BIGINT},
      </if>
      <if test="createTimestamp != null">
        create_timestamp = #{createTimestamp,jdbcType=BIGINT},
      </if>
      <if test="updateTimestamp != null">
        update_timestamp = #{updateTimestamp,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwPlan">
    update content_platform_qw_plan
    set `type` = #{type,jdbcType=INTEGER},
      sub_channel = #{subChannel,jdbcType=VARCHAR},
      scene = #{scene,jdbcType=INTEGER},
      page_url = #{pageUrl,jdbcType=VARCHAR},
      root_source_id = #{rootSourceId,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=INTEGER},
      create_account_id = #{createAccountId,jdbcType=BIGINT},
      create_timestamp = #{createTimestamp,jdbcType=BIGINT},
      update_timestamp = #{updateTimestamp,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>