<?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.UserAbilityMapper" >
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserAbility" >
    <id column="id" property="id" jdbcType="VARCHAR" />
    <result column="uid" property="uid" jdbcType="VARCHAR" />
    <result column="ability_label" property="abilityLabel" jdbcType="VARCHAR" />
    <result column="intellect_right" property="intellectRight" jdbcType="VARCHAR" />
    <result column="science_achievement" property="scienceAchievement" jdbcType="VARCHAR" />
    <result column="research_innovation" property="researchInnovation" jdbcType="VARCHAR" />
    <result column="personnel" property="personnel" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, uid, ability_label, intellect_right, science_achievement, research_innovation, personnel
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from user_ability
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from user_ability
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.UserAbility" >
    insert into user_ability (id, uid, ability_label, intellect_right, science_achievement, research_innovation, personnel
      )
    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{abilityLabel,jdbcType=VARCHAR},
    #{intellectRight,jdbcType=VARCHAR}, #{scienceAchievement,jdbcType=VARCHAR}, 
    #{researchInnovation,jdbcType=VARCHAR}, #{personnel,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.UserAbility" >
    insert into user_ability
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="uid != null" >
        uid,
      </if>
      <if test="abilityLabel != null" >
        ability_label,
      </if>
      
      <if test="intellectRight != null" >
        intellect_right,
      </if>
      <if test="scienceAchievement != null" >
        science_achievement,
      </if>
      <if test="researchInnovation != null" >
        research_innovation,
      </if>
      <if test="personnel != null" >
        personnel,
      </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="abilityLabel != null" >
        #{abilityLabel,jdbcType=VARCHAR},
      </if>
      
      <if test="intellectRight != null" >
        #{intellectRight,jdbcType=VARCHAR},
      </if>
      <if test="scienceAchievement != null" >
        #{scienceAchievement,jdbcType=VARCHAR},
      </if>
      <if test="researchInnovation != null" >
        #{researchInnovation,jdbcType=VARCHAR},
      </if>
      <if test="personnel != null" >
        #{personnel,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserAbility" >
    update user_ability
    <set >
      <if test="uid != null" >
        uid = #{uid,jdbcType=VARCHAR},
      </if>
      <if test="abilityLabel != null" >
        ability_label = #{abilityLabel,jdbcType=VARCHAR},
      </if>
      
      <if test="intellectRight != null" >
        intellect_right = #{intellectRight,jdbcType=VARCHAR},
      </if>
      <if test="scienceAchievement != null" >
        science_achievement = #{scienceAchievement,jdbcType=VARCHAR},
      </if>
      <if test="researchInnovation != null" >
        research_innovation = #{researchInnovation,jdbcType=VARCHAR},
      </if>
      <if test="personnel != null" >
        personnel = #{personnel,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserAbility" >
    update user_ability
    set uid = #{uid,jdbcType=VARCHAR},
      ability_label = #{abilityLabel,jdbcType=VARCHAR},
      intellect_right = #{intellectRight,jdbcType=VARCHAR},
      science_achievement = #{scienceAchievement,jdbcType=VARCHAR},
      research_innovation = #{researchInnovation,jdbcType=VARCHAR},
      personnel = #{personnel,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  
  <select id="selectUserAbilityByUserId" parameterType="java.lang.String" resultMap="BaseResultMap">
  	 select 
    <include refid="Base_Column_List" />
    from user_ability
    where uid = #{uid,jdbcType=VARCHAR}
  </select>
</mapper>