<?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.cab.dao.CabMyLoveDogMapper" >
  <resultMap id="BaseResultMap" type="com.cab.model.CabMyLoveDog" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="dog_name" property="dogName" jdbcType="VARCHAR" />
    <result column="pedigree_num" property="pedigreeNum" jdbcType="VARCHAR" />
    <result column="sex" property="sex" jdbcType="VARCHAR" />
    <result column="weight" property="weight" jdbcType="VARCHAR" />
    <result column="dog_birthday" property="dogBirthday" jdbcType="TIMESTAMP" />
    <result column="get_home_date" property="getHomeDate" jdbcType="TIMESTAMP" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="dogType" property="dogType" jdbcType="INTEGER" />
    <result column="deleteFlag" property="deleteflag" jdbcType="INTEGER" />
    <result column="avatar" property="avatar" jdbcType="VARCHAR" />
    <result column="type_name" property="typeName" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, user_id, dog_name, pedigree_num, sex, weight, dog_birthday, get_home_date, 
    create_time, update_time,dogType, deleteFlag ,avatar,type_name
  </sql>
  <select id="getMyLoveDog" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from cab_mylove_dog
    where user_id = #{userId,jdbcType=INTEGER}  and deleteFlag = '0'
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from cab_mylove_dog
    where id = #{id}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from cab_mylove_dog
    where id = #{id,jdbcType=INTEGER} 
  </delete>
  <insert id="insert" parameterType="com.cab.model.CabMyLoveDog" >
    insert into cab_mylove_dog (id, user_id, dog_name, 
      pedigree_num, sex, weight, 
      dog_birthday, get_home_date, create_time, 
      update_time,dogType, deleteFlag,avatar)
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{dogName,jdbcType=VARCHAR}, 
      #{pedigreeNum,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, #{weight,jdbcType=INTEGER}, 
      #{dogBirthday,jdbcType=TIMESTAMP}, #{getHomeDate,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateTime,jdbcType=TIMESTAMP},#{dogType,jdbcType=INTEGER},#{deleteflag,jdbcType=INTEGER},#{avatar,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.cab.model.CabMyLoveDog" >
    insert into cab_mylove_dog
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="dogName != null" >
        dog_name,
      </if>
      <if test="pedigreeNum != null" >
        pedigree_num,
      </if>
      <if test="sex != null" >
        sex,
      </if>
      <if test="weight != null" >
        weight,
      </if>
      <if test="dogBirthday != null" >
        dog_birthday,
      </if>
      <if test="getHomeDate != null" >
        get_home_date,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="dogType != null">
      	dogType,
      </if>
      <if test="deleteflag != null" >
        deleteFlag,
      </if>
      <if test="avatar != null">
      	avatar,
      </if>
      <if test="typeName != null">
      	type_name
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="dogName != null" >
        #{dogName,jdbcType=VARCHAR},
      </if>
      <if test="pedigreeNum != null" >
        #{pedigreeNum,jdbcType=VARCHAR},
      </if>
      <if test="sex != null" >
        #{sex,jdbcType=INTEGER},
      </if>
      <if test="weight != null" >
        #{weight,jdbcType=INTEGER},
      </if>
      <if test="dogBirthday != null" >
        #{dogBirthday,jdbcType=TIMESTAMP},
      </if>
      <if test="getHomeDate != null" >
        #{getHomeDate,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="dogType != null">
        #{dogType,jdbcType=INTEGER},
      </if>
      <if test="deleteflag != null" >
        #{deleteflag,jdbcType=INTEGER},
      </if>
      <if test="avatar != null">
      	#{avatar,jdbcType=VARCHAR},
      </if>
      <if test="typeName != null">
      	#{typeName,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cab.model.CabMyLoveDog" >
    update cab_mylove_dog
    <set >
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="dogName != null" >
        dog_name = #{dogName,jdbcType=VARCHAR},
      </if>
      <if test="pedigreeNum != null" >
        pedigree_num = #{pedigreeNum,jdbcType=VARCHAR},
      </if>
      <if test="sex != null" >
        sex = #{sex,jdbcType=INTEGER},
      </if>
      <if test="weight != null" >
        weight = #{weight,jdbcType=INTEGER},
      </if>
      <if test="dogBirthday != null" >
        dog_birthday = #{dogBirthday,jdbcType=TIMESTAMP},
      </if>
      <if test="getHomeDate != null" >
        get_home_date = #{getHomeDate,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="dogType != null">
      	dogType = #{dogType,jdbcType=INTEGER},
      </if>
      <if test="deleteflag != null" >
        deleteFlag = #{deleteflag,jdbcType=INTEGER},
      </if>
      <if test="avatar != null">
      	avatar=#{avatar,jdbcType=VARCHAR},
      </if>
      <if test="typeName != null">
      	type_name=#{typeName,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER} and user_id = #{userId}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cab.model.CabMyLoveDog" >
    update cab_mylove_dog
    set user_id = #{userId,jdbcType=INTEGER},
      dog_name = #{dogName,jdbcType=VARCHAR},
      pedigree_num = #{pedigreeNum,jdbcType=VARCHAR},
      sex = #{sex,jdbcType=INTEGER},
      weight = #{weight,jdbcType=INTEGER},
      dog_birthday = #{dogBirthday,jdbcType=TIMESTAMP},
      get_home_date = #{getHomeDate,jdbcType=TIMESTAMP},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      dogType = #{dogType,jdbcType=INTEGER},
      deleteFlag = #{deleteflag,jdbcType=INTEGER},
      avatar=#{avatar,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update> 
</mapper>