<?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.pengzu.dao.PengzuConfigDao">
  <resultMap id="BaseResultMap" type="com.pengzu.entity.PengzuConfig">
    <id column="key" jdbcType="VARCHAR" property="key" />
    <result column="value" jdbcType="VARCHAR" property="value" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="config_type" jdbcType="INTEGER" property="configType" />
    <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
    <result column="gmt_modify" jdbcType="TIMESTAMP" property="gmtModify" />
  </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">
    `key`, `value`, description, config_type, gmt_create, gmt_modify
  </sql>
  <select id="selectByExample" parameterType="com.pengzu.entity.PengzuConfigExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from pengzucms.pengzu_config
    <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">
    select 
    <include refid="Base_Column_List" />
    from pengzucms.pengzu_config
    where `key` = #{key,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from pengzucms.pengzu_config
    where `key` = #{key,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.pengzu.entity.PengzuConfigExample">
    delete from pengzucms.pengzu_config
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.pengzu.entity.PengzuConfig">
    <selectKey keyProperty="key" order="AFTER" resultType="java.lang.String">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into pengzucms.pengzu_config (`value`, description, gmt_create,
      gmt_modify,config_type)
    values (#{value,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, 
      #{gmtModify,jdbcType=TIMESTAMP},#{configType,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.pengzu.entity.PengzuConfig">
    <selectKey keyProperty="key" order="AFTER" resultType="java.lang.String">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into pengzucms.pengzu_config
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="value != null">
        `value`,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="gmtCreate != null">
        gmt_create,
      </if>
      <if test="gmtModify != null">
        gmt_modify,
      </if>
      <if test="configType != null">
        config_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="value != null">
        #{value,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="gmtCreate != null">
        #{gmtCreate,jdbcType=TIMESTAMP},
      </if>
      <if test="gmtModify != null">
        #{gmtModify,jdbcType=TIMESTAMP},
      </if>
      <if test="configType != null">
        #{configType,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.pengzu.entity.PengzuConfigExample" resultType="java.lang.Long">
    select count(*) from pengzucms.pengzu_config
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update pengzucms.pengzu_config
    <set>
      <if test="record.key != null">
        `key` = #{record.key,jdbcType=VARCHAR},
      </if>
      <if test="record.value != null">
        `value` = #{record.value,jdbcType=VARCHAR},
      </if>
      <if test="record.description != null">
        description = #{record.description,jdbcType=VARCHAR},
      </if>
      <if test="record.gmtCreate != null">
        gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.gmtModify != null">
        gmt_modify = #{record.gmtModify,jdbcType=TIMESTAMP},
      </if>
      <if test="record.configType != null">
        config_type = #{record.configType,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update pengzucms.pengzu_config
    set `key` = #{record.key,jdbcType=VARCHAR},
      `value` = #{record.value,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      config_type = #{record.configType,jdbcType=TIMESTAMP},
      gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
      gmt_modify = #{record.gmtModify,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.pengzu.entity.PengzuConfig">
    update pengzucms.pengzu_config
    <set>
      <if test="value != null">
        `value` = #{value,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="gmtCreate != null">
        gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
      </if>
      <if test="gmtModify != null">
        gmt_modify = #{gmtModify,jdbcType=TIMESTAMP},
      </if>
      <if test="configType != null">
        config_type = #{configType,jdbcType=TIMESTAMP},
      </if>
    </set>
    where `key` = #{key,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.pengzu.entity.PengzuConfig">
    update pengzucms.pengzu_config
    set `value` = #{value,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      config_type = #{configType,jdbcType=TIMESTAMP},
      gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
      gmt_modify = #{gmtModify,jdbcType=TIMESTAMP}
    where `key` = #{key,jdbcType=VARCHAR}
  </update>
</mapper>