<?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.cku.dao.CkuTrainerMapper" >
  <resultMap id="BaseResultMap" type="com.cku.model.CkuTrainer" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="trainer_name" property="trainerName" jdbcType="VARCHAR" />
    <result column="trainer_sex" property="trainerSex" jdbcType="INTEGER" />
    <result column="trainer_phone" property="trainerPhone" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, trainer_name, trainer_sex, trainer_phone
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from cku_trainer
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from cku_trainer
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.cku.model.CkuTrainer" >
    insert into cku_trainer (id, trainer_name, trainer_sex, 
      trainer_phone)
    values (#{id,jdbcType=INTEGER}, #{trainerName,jdbcType=VARCHAR}, #{trainerSex,jdbcType=INTEGER}, 
      #{trainerPhone,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.cku.model.CkuTrainer" >
    insert into cku_trainer
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="trainerName != null" >
        trainer_name,
      </if>
      <if test="trainerSex != null" >
        trainer_sex,
      </if>
      <if test="trainerPhone != null" >
        trainer_phone,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="trainerName != null" >
        #{trainerName,jdbcType=VARCHAR},
      </if>
      <if test="trainerSex != null" >
        #{trainerSex,jdbcType=INTEGER},
      </if>
      <if test="trainerPhone != null" >
        #{trainerPhone,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cku.model.CkuTrainer" >
    update cku_trainer
    <set >
      <if test="trainerName != null" >
        trainer_name = #{trainerName,jdbcType=VARCHAR},
      </if>
      <if test="trainerSex != null" >
        trainer_sex = #{trainerSex,jdbcType=INTEGER},
      </if>
      <if test="trainerPhone != null" >
        trainer_phone = #{trainerPhone,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cku.model.CkuTrainer" >
    update cku_trainer
    set trainer_name = #{trainerName,jdbcType=VARCHAR},
      trainer_sex = #{trainerSex,jdbcType=INTEGER},
      trainer_phone = #{trainerPhone,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>