<?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.CkuUserPayTypeMapper" >
  <resultMap id="BaseResultMap" type="com.cku.model.CkuUserPayType" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="subject_name" property="subjectName" jdbcType="VARCHAR" />
    <result column="subject_type" property="subjectType" jdbcType="INTEGER" />
    <result column="subject_price" property="subjectPrice" jdbcType="DECIMAL" />
    <result column="del_tag" property="delTag" jdbcType="CHAR" />
    <result column="max_sum" property="maxSum" jdbcType="INTEGER" />
    <result column="px" property="px" jdbcType="INTEGER" />
    <result column="use_order" property="useOrder" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, subject_name, subject_type, subject_price, del_tag, max_sum, px, use_order
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from cku_user_payType
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from cku_user_payType
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.cku.model.CkuUserPayType" >
    insert into cku_user_payType (id, subject_name, subject_type, 
      subject_price, del_tag, max_sum, 
      px, use_order)
    values (#{id,jdbcType=INTEGER}, #{subjectName,jdbcType=VARCHAR}, #{subjectType,jdbcType=INTEGER}, 
      #{subjectPrice,jdbcType=DECIMAL}, #{delTag,jdbcType=CHAR}, #{maxSum,jdbcType=INTEGER}, 
      #{px,jdbcType=INTEGER}, #{useOrder,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.cku.model.CkuUserPayType" >
    insert into cku_user_payType
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="subjectName != null" >
        subject_name,
      </if>
      <if test="subjectType != null" >
        subject_type,
      </if>
      <if test="subjectPrice != null" >
        subject_price,
      </if>
      <if test="delTag != null" >
        del_tag,
      </if>
      <if test="maxSum != null" >
        max_sum,
      </if>
      <if test="px != null" >
        px,
      </if>
      <if test="useOrder != null" >
        use_order,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="subjectName != null" >
        #{subjectName,jdbcType=VARCHAR},
      </if>
      <if test="subjectType != null" >
        #{subjectType,jdbcType=INTEGER},
      </if>
      <if test="subjectPrice != null" >
        #{subjectPrice,jdbcType=DECIMAL},
      </if>
      <if test="delTag != null" >
        #{delTag,jdbcType=CHAR},
      </if>
      <if test="maxSum != null" >
        #{maxSum,jdbcType=INTEGER},
      </if>
      <if test="px != null" >
        #{px,jdbcType=INTEGER},
      </if>
      <if test="useOrder != null" >
        #{useOrder,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cku.model.CkuUserPayType" >
    update cku_user_payType
    <set >
      <if test="subjectName != null" >
        subject_name = #{subjectName,jdbcType=VARCHAR},
      </if>
      <if test="subjectType != null" >
        subject_type = #{subjectType,jdbcType=INTEGER},
      </if>
      <if test="subjectPrice != null" >
        subject_price = #{subjectPrice,jdbcType=DECIMAL},
      </if>
      <if test="delTag != null" >
        del_tag = #{delTag,jdbcType=CHAR},
      </if>
      <if test="maxSum != null" >
        max_sum = #{maxSum,jdbcType=INTEGER},
      </if>
      <if test="px != null" >
        px = #{px,jdbcType=INTEGER},
      </if>
      <if test="useOrder != null" >
        use_order = #{useOrder,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cku.model.CkuUserPayType" >
    update cku_user_payType
    set subject_name = #{subjectName,jdbcType=VARCHAR},
      subject_type = #{subjectType,jdbcType=INTEGER},
      subject_price = #{subjectPrice,jdbcType=DECIMAL},
      del_tag = #{delTag,jdbcType=CHAR},
      max_sum = #{maxSum,jdbcType=INTEGER},
      px = #{px,jdbcType=INTEGER},
      use_order = #{useOrder,jdbcType=CHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <!-- ******************* -->
  <!-- 得到订单业务类型 -->
  <select id="getPayType" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  select id, subject_name, subject_type, 
      subject_price, del_tag, max_sum, 
      px, use_order
  from cku_user_payType where id=#{id,jdbcType=INTEGER}
  </select>
  
 
  
</mapper>