<?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.zheng.ucenter.dao.mapper.UcenterUserDetailsMapper">
  <resultMap id="BaseResultMap" type="com.zheng.ucenter.dao.model.UcenterUserDetails">
    <id column="user_id" jdbcType="INTEGER" property="userId" />
    <result column="signature" jdbcType="VARCHAR" property="signature" />
    <result column="real_name" jdbcType="VARCHAR" property="realName" />
    <result column="birthday" jdbcType="TIMESTAMP" property="birthday" />
    <result column="question" jdbcType="VARCHAR" property="question" />
    <result column="answer" jdbcType="VARCHAR" property="answer" />
  </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">
    user_id, signature, real_name, birthday, question, answer
  </sql>
  <select id="selectByExample" parameterType="com.zheng.ucenter.dao.model.UcenterUserDetailsExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from ucenter_user_details
    <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.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from ucenter_user_details
    where user_id = #{userId,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from ucenter_user_details
    where user_id = #{userId,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.zheng.ucenter.dao.model.UcenterUserDetailsExample">
    delete from ucenter_user_details
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.zheng.ucenter.dao.model.UcenterUserDetails">
    insert into ucenter_user_details (user_id, signature, real_name, 
      birthday, question, answer
      )
    values (#{userId,jdbcType=INTEGER}, #{signature,jdbcType=VARCHAR}, #{realName,jdbcType=VARCHAR}, 
      #{birthday,jdbcType=TIMESTAMP}, #{question,jdbcType=VARCHAR}, #{answer,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.zheng.ucenter.dao.model.UcenterUserDetails">
    insert into ucenter_user_details
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        user_id,
      </if>
      <if test="signature != null">
        signature,
      </if>
      <if test="realName != null">
        real_name,
      </if>
      <if test="birthday != null">
        birthday,
      </if>
      <if test="question != null">
        question,
      </if>
      <if test="answer != null">
        answer,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="signature != null">
        #{signature,jdbcType=VARCHAR},
      </if>
      <if test="realName != null">
        #{realName,jdbcType=VARCHAR},
      </if>
      <if test="birthday != null">
        #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="question != null">
        #{question,jdbcType=VARCHAR},
      </if>
      <if test="answer != null">
        #{answer,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.zheng.ucenter.dao.model.UcenterUserDetailsExample" resultType="java.lang.Long">
    select count(*) from ucenter_user_details
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update ucenter_user_details
    <set>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=INTEGER},
      </if>
      <if test="record.signature != null">
        signature = #{record.signature,jdbcType=VARCHAR},
      </if>
      <if test="record.realName != null">
        real_name = #{record.realName,jdbcType=VARCHAR},
      </if>
      <if test="record.birthday != null">
        birthday = #{record.birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="record.question != null">
        question = #{record.question,jdbcType=VARCHAR},
      </if>
      <if test="record.answer != null">
        answer = #{record.answer,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update ucenter_user_details
    set user_id = #{record.userId,jdbcType=INTEGER},
      signature = #{record.signature,jdbcType=VARCHAR},
      real_name = #{record.realName,jdbcType=VARCHAR},
      birthday = #{record.birthday,jdbcType=TIMESTAMP},
      question = #{record.question,jdbcType=VARCHAR},
      answer = #{record.answer,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.zheng.ucenter.dao.model.UcenterUserDetails">
    update ucenter_user_details
    <set>
      <if test="signature != null">
        signature = #{signature,jdbcType=VARCHAR},
      </if>
      <if test="realName != null">
        real_name = #{realName,jdbcType=VARCHAR},
      </if>
      <if test="birthday != null">
        birthday = #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="question != null">
        question = #{question,jdbcType=VARCHAR},
      </if>
      <if test="answer != null">
        answer = #{answer,jdbcType=VARCHAR},
      </if>
    </set>
    where user_id = #{userId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.zheng.ucenter.dao.model.UcenterUserDetails">
    update ucenter_user_details
    set signature = #{signature,jdbcType=VARCHAR},
      real_name = #{realName,jdbcType=VARCHAR},
      birthday = #{birthday,jdbcType=TIMESTAMP},
      question = #{question,jdbcType=VARCHAR},
      answer = #{answer,jdbcType=VARCHAR}
    where user_id = #{userId,jdbcType=INTEGER}
  </update>
  <cache type="org.mybatis.caches.ehcache.LoggingEhcache" />
</mapper>