<?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.goafanti.common.dao.PolicyPublishMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.PolicyPublish">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="policy_id" jdbcType="VARCHAR" property="policyId" />
    <result column="publish_platform" jdbcType="VARCHAR" property="publishPlatform" />
    <result column="publish_client" jdbcType="INTEGER" property="publishClient" />
    <result column="publish_page" jdbcType="VARCHAR" property="publishPage" />
    <result column="if_top" jdbcType="INTEGER" property="ifTop" />
    <result column="top_number" jdbcType="INTEGER" property="topNumber" />
    <result column="show_number" jdbcType="INTEGER" property="showNumber" />
    <result column="publisher" jdbcType="VARCHAR" property="publisher" />
    <result column="publish_time" jdbcType="TIMESTAMP" property="publishTime" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    id, policy_id, publish_platform, publish_client, publish_page, if_top, top_number, 
    show_number, publisher, publish_time
  </sql>
  <select id="selectByExample" parameterType="com.goafanti.common.model.PolicyPublishExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from policy_publish
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    select 
    <include refid="Base_Column_List" />
    from policy_publish
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    delete from policy_publish
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.PolicyPublishExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    delete from policy_publish
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.PolicyPublish">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    insert into policy_publish (id, policy_id, publish_platform, 
      publish_client, publish_page, if_top, 
      top_number, show_number, publisher, 
      publish_time)
    values (#{id,jdbcType=VARCHAR}, #{policyId,jdbcType=VARCHAR}, #{publishPlatform,jdbcType=VARCHAR}, 
      #{publishClient,jdbcType=INTEGER}, #{publishPage,jdbcType=VARCHAR}, #{ifTop,jdbcType=INTEGER}, 
      #{topNumber,jdbcType=INTEGER}, #{showNumber,jdbcType=INTEGER}, #{publisher,jdbcType=VARCHAR}, 
      #{publishTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.PolicyPublish">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    insert into policy_publish
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="policyId != null">
        policy_id,
      </if>
      <if test="publishPlatform != null">
        publish_platform,
      </if>
      <if test="publishClient != null">
        publish_client,
      </if>
      <if test="publishPage != null">
        publish_page,
      </if>
      <if test="ifTop != null">
        if_top,
      </if>
      <if test="topNumber != null">
        top_number,
      </if>
      <if test="showNumber != null">
        show_number,
      </if>
      <if test="publisher != null">
        publisher,
      </if>
      <if test="publishTime != null">
        publish_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="policyId != null">
        #{policyId,jdbcType=VARCHAR},
      </if>
      <if test="publishPlatform != null">
        #{publishPlatform,jdbcType=VARCHAR},
      </if>
      <if test="publishClient != null">
        #{publishClient,jdbcType=INTEGER},
      </if>
      <if test="publishPage != null">
        #{publishPage,jdbcType=VARCHAR},
      </if>
      <if test="ifTop != null">
        #{ifTop,jdbcType=INTEGER},
      </if>
      <if test="topNumber != null">
        #{topNumber,jdbcType=INTEGER},
      </if>
      <if test="showNumber != null">
        #{showNumber,jdbcType=INTEGER},
      </if>
      <if test="publisher != null">
        #{publisher,jdbcType=VARCHAR},
      </if>
      <if test="publishTime != null">
        #{publishTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.PolicyPublishExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    select count(*) from policy_publish
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    update policy_publish
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.policyId != null">
        policy_id = #{record.policyId,jdbcType=VARCHAR},
      </if>
      <if test="record.publishPlatform != null">
        publish_platform = #{record.publishPlatform,jdbcType=VARCHAR},
      </if>
      <if test="record.publishClient != null">
        publish_client = #{record.publishClient,jdbcType=INTEGER},
      </if>
      <if test="record.publishPage != null">
        publish_page = #{record.publishPage,jdbcType=VARCHAR},
      </if>
      <if test="record.ifTop != null">
        if_top = #{record.ifTop,jdbcType=INTEGER},
      </if>
      <if test="record.topNumber != null">
        top_number = #{record.topNumber,jdbcType=INTEGER},
      </if>
      <if test="record.showNumber != null">
        show_number = #{record.showNumber,jdbcType=INTEGER},
      </if>
      <if test="record.publisher != null">
        publisher = #{record.publisher,jdbcType=VARCHAR},
      </if>
      <if test="record.publishTime != null">
        publish_time = #{record.publishTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    update policy_publish
    set id = #{record.id,jdbcType=VARCHAR},
      policy_id = #{record.policyId,jdbcType=VARCHAR},
      publish_platform = #{record.publishPlatform,jdbcType=VARCHAR},
      publish_client = #{record.publishClient,jdbcType=INTEGER},
      publish_page = #{record.publishPage,jdbcType=VARCHAR},
      if_top = #{record.ifTop,jdbcType=INTEGER},
      top_number = #{record.topNumber,jdbcType=INTEGER},
      show_number = #{record.showNumber,jdbcType=INTEGER},
      publisher = #{record.publisher,jdbcType=VARCHAR},
      publish_time = #{record.publishTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PolicyPublish">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    update policy_publish
    <set>
      <if test="policyId != null">
        policy_id = #{policyId,jdbcType=VARCHAR},
      </if>
      <if test="publishPlatform != null">
        publish_platform = #{publishPlatform,jdbcType=VARCHAR},
      </if>
      <if test="publishClient != null">
        publish_client = #{publishClient,jdbcType=INTEGER},
      </if>
      <if test="publishPage != null">
        publish_page = #{publishPage,jdbcType=VARCHAR},
      </if>
      <if test="ifTop != null">
        if_top = #{ifTop,jdbcType=INTEGER},
      </if>
      <if test="topNumber != null">
        top_number = #{topNumber,jdbcType=INTEGER},
      </if>
      <if test="showNumber != null">
        show_number = #{showNumber,jdbcType=INTEGER},
      </if>
      <if test="publisher != null">
        publisher = #{publisher,jdbcType=VARCHAR},
      </if>
      <if test="publishTime != null">
        publish_time = #{publishTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PolicyPublish">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 28 10:40:11 CST 2018.
    -->
    update policy_publish
    set policy_id = #{policyId,jdbcType=VARCHAR},
      publish_platform = #{publishPlatform,jdbcType=VARCHAR},
      publish_client = #{publishClient,jdbcType=INTEGER},
      publish_page = #{publishPage,jdbcType=VARCHAR},
      if_top = #{ifTop,jdbcType=INTEGER},
      top_number = #{topNumber,jdbcType=INTEGER},
      show_number = #{showNumber,jdbcType=INTEGER},
      publisher = #{publisher,jdbcType=VARCHAR},
      publish_time = #{publishTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <delete id="deleteByPolicyId" parameterType="java.lang.Long">
  delete from policy_publish where policy_id = #{0}
  </delete>
  
  <select id="getPagesByPolicyId" parameterType="java.lang.Long" resultType="java.lang.String">
  select pp.publish_page from policy_publish pp where pp.policy_id = #{0}
  </select>
</mapper> 