<?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.CkuMatchCostMapper" >
  <resultMap id="BaseResultMap" type="com.cku.model.CkuMatchCost" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="cost_cac" property="costCac" jdbcType="VARCHAR" />
    <result column="cost_cacib" property="costCacib" jdbcType="VARCHAR" />
    <result column="cost_alone" property="costAlone" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, cost_cac, cost_cacib, cost_alone
  </sql>
  <select id="getMatchCost" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    SELECT cost.id,
       cost.cost_cacib,
       cost.cost_cac,
       cost.cost_alone
	FROM tab_games tab
	LEFT JOIN cku_match_cost cost ON tab.cost_id = cost.id
	WHERE tab.id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from cku_match_cost
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.cku.model.CkuMatchCost" >
    insert into cku_match_cost (id, cost_cac, cost_cacib, 
      cost_alone)
    values (#{id,jdbcType=INTEGER}, #{costCac,jdbcType=VARCHAR}, #{costCacib,jdbcType=VARCHAR}, 
      #{costAlone,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.cku.model.CkuMatchCost" >
    insert into cku_match_cost
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="costCac != null" >
        cost_cac,
      </if>
      <if test="costCacib != null" >
        cost_cacib,
      </if>
      <if test="costAlone != null" >
        cost_alone,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="costCac != null" >
        #{costCac,jdbcType=VARCHAR},
      </if>
      <if test="costCacib != null" >
        #{costCacib,jdbcType=VARCHAR},
      </if>
      <if test="costAlone != null" >
        #{costAlone,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cku.model.CkuMatchCost" >
    update cku_match_cost
    <set >
      <if test="costCac != null" >
        cost_cac = #{costCac,jdbcType=VARCHAR},
      </if>
      <if test="costCacib != null" >
        cost_cacib = #{costCacib,jdbcType=VARCHAR},
      </if>
      <if test="costAlone != null" >
        cost_alone = #{costAlone,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cku.model.CkuMatchCost" >
    update cku_match_cost
    set cost_cac = #{costCac,jdbcType=VARCHAR},
      cost_cacib = #{costCacib,jdbcType=VARCHAR},
      cost_alone = #{costAlone,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>