<?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.cf.ucenter.dao.mapper.CfUserFriendMapper" >
  <resultMap id="BaseResultMap" type="com.cf.ucenter.domain.CfUserFriend" >
    <id column="id" property="id" jdbcType="VARCHAR" />
    <result column="uid" property="uid" jdbcType="VARCHAR" />
    <result column="friend_id" property="friendId" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
  </resultMap>
  <resultMap id="CfUserResultMap" type="com.cf.ucenter.domain.CfUser" >
    <id column="id" property="id" jdbcType="VARCHAR" />
    <result column="user_name" property="userName" jdbcType="VARCHAR" />
    <result column="password" property="password" jdbcType="VARCHAR" />
    <result column="avatar" property="avatar" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="TINYINT" />
    <result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
    <result column="true_name" property="trueName" jdbcType="VARCHAR" />
    <result column="birthday" property="birthday" jdbcType="BIGINT" />
    <result column="sex" property="sex" jdbcType="BIT" />
    <result column="sign" property="sign" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="BIGINT" />
    <result column="phone" property="phone" jdbcType="VARCHAR" />
    <result column="email" property="email" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    id, uid, friend_id, create_time
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.cf.ucenter.domain.CfUserFriendExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from cf_user_friend
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from cf_user_friend
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from cf_user_friend
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.cf.ucenter.domain.CfUserFriendExample" >
    delete from cf_user_friend
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.cf.ucenter.domain.CfUserFriend" >
    insert into cf_user_friend (id, uid, friend_id, 
      create_time)
    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{friendId,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.cf.ucenter.domain.CfUserFriend" >
    insert into cf_user_friend
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="uid != null" >
        uid,
      </if>
      <if test="friendId != null" >
        friend_id,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="uid != null" >
        #{uid,jdbcType=VARCHAR},
      </if>
      <if test="friendId != null" >
        #{friendId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.cf.ucenter.domain.CfUserFriendExample" resultType="java.lang.Integer" >
    select count(*) from cf_user_friend
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <select id="selectListByUid" resultMap="CfUserResultMap" >
    select u.id,u.user_name,u.avatar,u.type,u.nick_name,u.sex,u.sign from cf_user_friend uf
    left join cf_user u on(uf.friend_id=u.id) where uf.uid = #{uid,jdbcType=VARCHAR} limit #{page,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update cf_user_friend
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.uid != null" >
        uid = #{record.uid,jdbcType=VARCHAR},
      </if>
      <if test="record.friendId != null" >
        friend_id = #{record.friendId,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null" >
        create_time = #{record.createTime,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update cf_user_friend
    set id = #{record.id,jdbcType=VARCHAR},
      uid = #{record.uid,jdbcType=VARCHAR},
      friend_id = #{record.friendId,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=INTEGER}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.cf.ucenter.domain.CfUserFriend" >
    update cf_user_friend
    <set >
      <if test="uid != null" >
        uid = #{uid,jdbcType=VARCHAR},
      </if>
      <if test="friendId != null" >
        friend_id = #{friendId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cf.ucenter.domain.CfUserFriend" >
    update cf_user_friend
    set uid = #{uid,jdbcType=VARCHAR},
      friend_id = #{friendId,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>