<?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.MallOrderRefundMapper" >
  <resultMap id="BaseResultMap" type="com.kmall.api.entity.MallOrderRefund" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="order_id" property="orderId" jdbcType="INTEGER" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="refund_type" property="refundType" jdbcType="TINYINT" />
    <result column="refund_time" property="refundTime" jdbcType="TIMESTAMP" />
    <result column="creator" property="creator" jdbcType="VARCHAR" />
    <result column="refund_money" property="refundMoney" jdbcType="DECIMAL" />
    <result column="refund_status" property="refundStatus" jdbcType="TINYINT" />
    <result column="refund_reason" property="refundReason" jdbcType="VARCHAR" />
    <result column="approver" property="approver" jdbcType="VARCHAR" />
    <result column="approval_time" property="approvalTime" jdbcType="TIMESTAMP" />
    <result column="approval_remark" property="approvalRemark" jdbcType="VARCHAR" />
    <result column="create_sn" property="createSn" 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_id, user_id, refund_type, refund_time, creator, refund_money, refund_status, 
    refund_reason, approver, approval_time, approval_remark, create_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_refund
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="delete" parameterType="java.lang.Integer" >
    delete from mall_order_refund
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="save" parameterType="com.kmall.api.entity.MallOrderRefund"  useGeneratedKeys="true" keyProperty="id">
    insert into mall_order_refund
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="orderId != null" >
        order_id,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="refundType != null" >
        refund_type,
      </if>
      <if test="refundTime != null" >
        refund_time,
      </if>
      <if test="creator != null" >
        creator,
      </if>
      <if test="refundMoney != null" >
        refund_money,
      </if>
      <if test="refundStatus != null" >
        refund_status,
      </if>
      <if test="refundReason != null" >
        refund_reason,
      </if>
      <if test="approver != null" >
        approver,
      </if>
      <if test="approvalTime != null" >
        approval_time,
      </if>
      <if test="approvalRemark != null" >
        approval_remark,
      </if>
      <if test="createSn != null" >
        create_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="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="orderId != null" >
        #{orderId,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="refundType != null" >
        #{refundType,jdbcType=TINYINT},
      </if>
      <if test="refundTime != null" >
        #{refundTime,jdbcType=TIMESTAMP},
      </if>
      <if test="creator != null" >
        #{creator,jdbcType=VARCHAR},
      </if>
      <if test="refundMoney != null" >
        #{refundMoney,jdbcType=DECIMAL},
      </if>
      <if test="refundStatus != null" >
        #{refundStatus,jdbcType=TINYINT},
      </if>
      <if test="refundReason != null" >
        #{refundReason,jdbcType=VARCHAR},
      </if>
      <if test="approver != null" >
        #{approver,jdbcType=VARCHAR},
      </if>
      <if test="approvalTime != null" >
        #{approvalTime,jdbcType=TIMESTAMP},
      </if>
      <if test="approvalRemark != null" >
        #{approvalRemark,jdbcType=VARCHAR},
      </if>
      <if test="createSn != null" >
        #{createSn,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.MallOrderRefund" >
    update mall_order_refund
    <set >
      <if test="orderId != null" >
        order_id = #{orderId,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="refundType != null" >
        refund_type = #{refundType,jdbcType=TINYINT},
      </if>
      <if test="refundTime != null" >
        refund_time = #{refundTime,jdbcType=TIMESTAMP},
      </if>
      <if test="creator != null" >
        creator = #{creator,jdbcType=VARCHAR},
      </if>
      <if test="refundMoney != null" >
        refund_money = #{refundMoney,jdbcType=DECIMAL},
      </if>
      <if test="refundStatus != null" >
        refund_status = #{refundStatus,jdbcType=TINYINT},
      </if>
      <if test="refundReason != null" >
        refund_reason = #{refundReason,jdbcType=VARCHAR},
      </if>
      <if test="approver != null" >
        approver = #{approver,jdbcType=VARCHAR},
      </if>
      <if test="approvalTime != null" >
        approval_time = #{approvalTime,jdbcType=TIMESTAMP},
      </if>
      <if test="approvalRemark != null" >
        approval_remark = #{approvalRemark,jdbcType=VARCHAR},
      </if>
      <if test="createSn != null" >
        create_sn = #{createSn,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>