<?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.ghy.payment.mapper.ReverseRecordMapper">

    <resultMap id="ColumnsMap" type="com.ghy.payment.domain.ReverseRecord">
        <result property="id" column="id"/>
        <result property="deptId" column="dept_id"/>
        <result property="status" column="status"/>
        <result property="orderNo" column="order_no"/>
        <result property="paymentId" column="payment_id"/>
        <result property="reverseAmt" column="reverse_amt"/>
        <result property="reversedAmt" column="reversed_amt"/>
        <result property="confirmedAmt" column="confirmed_amt"/>
        <result property="refundedAmt" column="refunded_amt"/>
        <result property="errorCode" column="error_code"/>
        <result property="errorMsg" column="error_msg"/>
        <result property="errorType" column="error_type"/>
        <result property="createdTime" column="created_time"/>
        <result property="createTime" column="create_time"/>
    </resultMap>

    <sql id="select_columns">
        SELECT id, status, order_no, payment_id, reverse_amt, reversed_amt, confirmed_amt, refunded_amt,
               error_code, error_msg, error_type, created_time, create_time, dept_id
        FROM reverse_record
    </sql>

    <insert id="insert" parameterType="com.ghy.payment.domain.ReverseRecord">
        INSERT INTO reverse_record(id, status, order_no, payment_id, reverse_amt, reversed_amt, confirmed_amt, refunded_amt,
                                     error_code, error_msg, error_type, created_time, dept_id)
        VALUES (#{id}, #{status}, #{orderNo}, #{paymentId}, #{reverseAmt}, #{reversedAmt}, #{confirmedAmt},
                #{refundedAmt}, #{errorCode}, #{errorMsg}, #{errorType}, #{createdTime}, #{deptId})
    </insert>

    <update id="update" parameterType="com.ghy.payment.domain.ReverseRecord">
        UPDATE reverse_record
        SET status = #{status}, order_no = #{orderNo}, payment_id = #{paymentId},
          reverse_amt = #{reverseAmt}, reversed_amt = #{reversedAmt},
          confirmed_amt = #{confirmedAmt}, refunded_amt = #{refundedAmt},
          error_code = #{errorCode}, error_msg = #{errorMsg}, error_type = #{errorType},
          created_time = #{createdTime}, dept_id = #{deptId}
        WHERE id = #{id}
    </update>

</mapper>