PayRefundMapper.xml 4.2 KB
Newer Older
1 2 3 4 5
<?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="cn.iocoder.mall.pay.biz.dao.PayRefundMapper">

    <sql id="FIELDS">
6
        id, transaction_id, refund_code, app_id, create_ip, order_id,
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
        order_description, price, status,
        finish_time, notify_url, extension_data, refund_channel, refund_time, notify_time,
        trade_no, create_time
    </sql>

    <insert id="insert" parameterType="PayRefundDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
        INSERT INTO refund (
            transaction_id, refund_code, app_id, create_ip, order_id,
            order_description, price, status,
            finish_time, notify_url, extension_data, refund_channel, refund_time, notify_time,
            trade_no, create_time
        ) VALUES (
            #{transactionId}, #{refundCode}, #{appId}, #{createIp}, #{orderId},
            #{orderDescription}, #{price}, #{status},
            #{finishTime}, #{notifyUrl}, #{extensionData}, #{refundChannel}, #{refundTime}, #{notifyTime},
            #{tradeNo}, #{createTime}
        )
    </insert>

    <update id="update">
        UPDATE refund
        <set>
            <if test="entity.status != null">
                , status = #{entity.status}
            </if>
            <if test="entity.finishTime != null">
                , finish_time = #{entity.finishTime}
            </if>
            <if test="entity.extensionData != null">
                , extension_data = #{entity.extensionData}
            </if>
            <if test="entity.refundTime != null">
                , refund_time = #{entity.refundTime}
            </if>
            <if test="entity.notifyTime != null">
                , notify_time = #{entity.notifyTime}
            </if>
            <if test="entity.tradeNo != null">
                , trade_no = #{entity.tradeNo}
            </if>
        </set>
        WHERE id = #{entity.id}
        <if test="whereStatus != null">
            AND status = #{whereStatus}
        </if>
    </update>

    <select id="selectByRefundCode" parameterType="String" resultType="PayRefundDO">
        SELECT
            <include refid="FIELDS"/>
        FROM refund
        WHERE refund_code = #{refundCode}
        LIMIT 1
    </select>

    <select id="selectById" parameterType="Integer" resultType="PayRefundDO">
        SELECT
            <include refid="FIELDS"/>
        FROM refund
        WHERE id = #{id}
    </select>

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
    <select id="selectListByPage" resultType="PayRefundDO">
        SELECT
            <include refid="FIELDS"/>
        FROM refund
        <where>
            <if test="createBeginTime != null">
                AND create_time >= #{createBeginTime}
            </if>
            <if test="createEndTime != null">
                AND #{createEndTime} >= create_time
            </if>
            <if test="finishBeginTime != null">
                AND finish_time >= #{finishBeginTime}
            </if>
            <if test="finishEndTime != null">
                AND #{finishEndTime} >= finish_time
            </if>
            <if test="status != null">
                AND status = #{status}
            </if>
            <if test="payChannel != null">
                AND pay_channel = #{payChannel}
            </if>
        </where>
        LIMIT #{offset}, #{limit}
    </select>

    <select id="selectCountByPage" resultType="Integer">
        SELECT
            COUNT(1)
        FROM refund
        <where>
            <if test="createBeginTime != null">
                AND create_time >= #{createBeginTime}
            </if>
            <if test="createEndTime != null">
                AND #{createEndTime} >= create_time
            </if>
            <if test="finishBeginTime != null">
                AND finish_time >= #{finishBeginTime}
            </if>
            <if test="finishEndTime != null">
                AND #{finishEndTime} >= finish_time
            </if>
            <if test="status != null">
                AND status = #{status}
            </if>
            <if test="payChannel != null">
                AND pay_channel = #{payChannel}
            </if>
        </where>
    </select>

122
</mapper>