<?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.CkuMatchHotelRelationMapper" >
  <resultMap id="BaseResultMap" type="com.cku.model.CkuMatchHotelRelation" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="match_id" property="matchId" jdbcType="INTEGER" />
    <result column="hotel_id" property="hotelId" jdbcType="INTEGER" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
    <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
    <result column="remarks" property="remarks" jdbcType="VARCHAR" />
    <result column="del_flag" property="delFlag" jdbcType="CHAR" />
    <result column="show_location" property="showLocation" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, match_id, hotel_id, create_by, create_date, update_by, update_date, remarks, 
    del_flag, show_location
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from cku_match_hotel_relation
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from cku_match_hotel_relation
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.cku.model.CkuMatchHotelRelation" >
    insert into cku_match_hotel_relation (id, match_id, hotel_id, 
      create_by, create_date, update_by, 
      update_date, remarks, del_flag, 
      show_location)
    values (#{id,jdbcType=INTEGER}, #{matchId,jdbcType=INTEGER}, #{hotelId,jdbcType=INTEGER}, 
      #{createBy,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, 
      #{updateDate,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR}, 
      #{showLocation,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.cku.model.CkuMatchHotelRelation" >
    insert into cku_match_hotel_relation
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="matchId != null" >
        match_id,
      </if>
      <if test="hotelId != null" >
        hotel_id,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createDate != null" >
        create_date,
      </if>
      <if test="updateBy != null" >
        update_by,
      </if>
      <if test="updateDate != null" >
        update_date,
      </if>
      <if test="remarks != null" >
        remarks,
      </if>
      <if test="delFlag != null" >
        del_flag,
      </if>
      <if test="showLocation != null" >
        show_location,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="matchId != null" >
        #{matchId,jdbcType=VARCHAR},
      </if>
      <if test="hotelId != null" >
        #{hotelId,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null" >
        #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="updateDate != null" >
        #{updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null" >
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="delFlag != null" >
        #{delFlag,jdbcType=CHAR},
      </if>
      <if test="showLocation != null" >
        #{showLocation,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cku.model.CkuMatchHotelRelation" >
    update cku_match_hotel_relation
    <set >
      <if test="matchId != null" >
        match_id = #{matchId,jdbcType=INTEGER},
      </if>
      <if test="hotelId != null" >
        hotel_id = #{hotelId,jdbcType=INTEGER},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null" >
        update_by = #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="updateDate != null" >
        update_date = #{updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null" >
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="delFlag != null" >
        del_flag = #{delFlag,jdbcType=CHAR},
      </if>
      <if test="showLocation != null" >
        show_location = #{showLocation,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cku.model.CkuMatchHotelRelation" >
    update cku_match_hotel_relation
    set match_id = #{matchId,jdbcType=INTEGER},
      hotel_id = #{hotelId,jdbcType=INTEGER},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=TIMESTAMP},
      update_by = #{updateBy,jdbcType=VARCHAR},
      update_date = #{updateDate,jdbcType=TIMESTAMP},
      remarks = #{remarks,jdbcType=VARCHAR},
      del_flag = #{delFlag,jdbcType=CHAR},
      show_location = #{showLocation,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  <!--  -->
  
  <delete id="deleteByMatchIdAndHotelId" parameterType="java.lang.Integer" >
    delete from cku_match_hotel_relation
    where match_id = #{matchId,jdbcType=VARCHAR}
    and  hotel_id = #{hotelId,jdbcType=VARCHAR}
  </delete>
</mapper>