OrderRefundMapper.xml 4.29 KB
Newer Older
张新旗 committed
1 2 3 4 5 6 7 8 9 10 11
<?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.ruoyi.system.mapper.OrderRefundMapper">
    
    <resultMap type="OrderRefund" id="OrderRefundResult">
        <result property="id"    column="id"    />
        <result property="orderId"    column="order_id"    />
        <result property="refundAmount"    column="refund_amount"    />
        <result property="state"    column="state"    />
张新旗 committed
12
        <result property="refundNo" column="refund_no"/>
张新旗 committed
13 14 15
        <result property="desc"    column="desc"    />
        <result property="createdAt"    column="created_at"    />
        <result property="updatedAt"    column="updated_at"    />
张新旗 committed
16
        <result property="orderNo" column="order_no"/>
张新旗 committed
17 18 19
    </resultMap>

    <sql id="selectOrderRefundVo">
张新旗 committed
20
        select id, order_id, refund_amount, state, `desc`, created_at, updated_at,refund_no,order_no from order_refund
张新旗 committed
21 22 23 24 25 26 27 28
    </sql>

    <select id="selectOrderRefundList" parameterType="OrderRefund" resultMap="OrderRefundResult">
        <include refid="selectOrderRefundVo"/>
        <where>  
            <if test="orderId != null  and orderId != ''"> and order_id = #{orderId}</if>
            <if test="refundAmount != null "> and refund_amount = #{refundAmount}</if>
            <if test="state != null  and state != ''"> and state = #{state}</if>
张新旗 committed
29
            <if test="desc != null  and desc != ''"> and `desc` = #{desc}</if>
张新旗 committed
30 31
            <if test="createdAt != null "> and created_at = #{createdAt}</if>
            <if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
张新旗 committed
32 33
            <if test="refundNo != null "> and refund_no = #{refundNo}</if>
            <if test="orderNo != null "> and order_no = #{orderNo}</if>
张新旗 committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47
        </where>
    </select>
    
    <select id="selectOrderRefundById" parameterType="String" resultMap="OrderRefundResult">
        <include refid="selectOrderRefundVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertOrderRefund" parameterType="OrderRefund" useGeneratedKeys="true" keyProperty="id">
        insert into order_refund
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="orderId != null and orderId != ''">order_id,</if>
            <if test="refundAmount != null">refund_amount,</if>
            <if test="state != null and state != ''">state,</if>
张新旗 committed
48
            <if test="desc != null">`desc`,</if>
张新旗 committed
49 50
            <if test="createdAt != null">created_at,</if>
            <if test="updatedAt != null">updated_at,</if>
张新旗 committed
51 52 53
            <if test="refundNo != null">refund_no,</if>
            <if test="orderNo != null">order_no,</if>

张新旗 committed
54 55 56 57 58 59 60 61
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="orderId != null and orderId != ''">#{orderId},</if>
            <if test="refundAmount != null">#{refundAmount},</if>
            <if test="state != null and state != ''">#{state},</if>
            <if test="desc != null">#{desc},</if>
            <if test="createdAt != null">#{createdAt},</if>
            <if test="updatedAt != null">#{updatedAt},</if>
张新旗 committed
62 63
            <if test="refundNo != null">#{refundNo},</if>
            <if test="orderNo != null">#{orderNo},</if>
张新旗 committed
64 65 66 67 68 69 70 71 72
         </trim>
    </insert>

    <update id="updateOrderRefund" parameterType="OrderRefund">
        update order_refund
        <trim prefix="SET" suffixOverrides=",">
            <if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
            <if test="refundAmount != null">refund_amount = #{refundAmount},</if>
            <if test="state != null and state != ''">state = #{state},</if>
张新旗 committed
73
            <if test="desc != null">`desc` = #{desc},</if>
张新旗 committed
74
            <if test="updatedAt != null">updated_at = #{updatedAt},</if>
张新旗 committed
75 76
            <if test="refundNo != null">refund_no = #{refundNo},</if>
            <if test="orderNo != null">order_no = #{orderNo},</if>
张新旗 committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteOrderRefundById" parameterType="String">
        delete from order_refund where id = #{id}
    </delete>

    <delete id="deleteOrderRefundByIds" parameterType="String">
        delete from order_refund where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>