<?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.kmall.api.dao.ApiOrderExceptionRecordMapper" >
  <resultMap id="BaseResultMap" type="com.kmall.api.entity.MallOrderExceptionRecord" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="order_sn" property="orderSn" jdbcType="VARCHAR" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="exception_content" property="exceptionContent" jdbcType="VARCHAR" />
    <result column="exception_status" property="exceptionStatus" jdbcType="CHAR" />
    <result column="creater_sn" property="createrSn" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="moder_sn" property="moderSn" jdbcType="VARCHAR" />
    <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
    <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, order_sn, user_id, exception_content, exception_status, creater_sn, create_time, 
    moder_sn, mod_time, tstm
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from mall_order_exception_record
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="delete" parameterType="java.lang.Integer" >
    delete from mall_order_exception_record
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="save" parameterType="com.kmall.api.entity.MallOrderExceptionRecord"  useGeneratedKeys="true" keyProperty="id">
    insert into mall_order_exception_record
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="orderSn != null" >
        order_sn,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="exceptionContent != null" >
        exception_content,
      </if>
      <if test="exceptionStatus != null" >
        exception_status,
      </if>
      <if test="createrSn != null" >
        creater_sn,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="moderSn != null" >
        moder_sn,
      </if>
      <if test="modTime != null" >
        mod_time,
      </if>
      <if test="tstm != null" >
        tstm,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="orderSn != null" >
        #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="exceptionContent != null" >
        #{exceptionContent,jdbcType=VARCHAR},
      </if>
      <if test="exceptionStatus != null" >
        #{exceptionStatus,jdbcType=CHAR},
      </if>
      <if test="createrSn != null" >
        #{createrSn,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="moderSn != null" >
        #{moderSn,jdbcType=VARCHAR},
      </if>
      <if test="modTime != null" >
        #{modTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tstm != null" >
        #{tstm,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="update" parameterType="com.kmall.api.entity.MallOrderExceptionRecord" >
    update mall_order_exception_record
    <set >
      <if test="orderSn != null" >
        order_sn = #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="exceptionContent != null" >
        exception_content = #{exceptionContent,jdbcType=VARCHAR},
      </if>
      <if test="exceptionStatus != null" >
        exception_status = #{exceptionStatus,jdbcType=CHAR},
      </if>
      <if test="createrSn != null" >
        creater_sn = #{createrSn,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="moderSn != null" >
        moder_sn = #{moderSn,jdbcType=VARCHAR},
      </if>
      <if test="modTime != null" >
        mod_time = #{modTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tstm != null" >
        tstm = #{tstm,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>