<?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.fs.live.mapper.LiveOrderPaymentErrorMapper">

    <resultMap type="LiveOrderPaymentError" id="LiveOrderPaymentErrorResult">
        <result property="id"    column="id"    />
        <result property="orderFlowNo"    column="order_flow_no"    />
        <result property="orderNo"    column="order_no"    />
        <result property="msg"    column="msg"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectLiveOrderPaymentErrorVo">
        select id, order_flow_no, order_no, msg, status, create_time from live_order_payment_error
    </sql>

    <select id="selectLiveOrderPaymentErrorList" parameterType="LiveOrderPaymentError" resultMap="LiveOrderPaymentErrorResult">
        <include refid="selectLiveOrderPaymentErrorVo"/>
        <where>
            <if test="orderFlowNo != null  and orderFlowNo != ''"> and order_flow_no = #{orderFlowNo}</if>
            <if test="orderNo != null  and orderNo != ''"> and order_no = #{orderNo}</if>
            <if test="msg != null  and msg != ''"> and msg = #{msg}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>

    <select id="selectLiveOrderPaymentErrorById" parameterType="Long" resultMap="LiveOrderPaymentErrorResult">
        <include refid="selectLiveOrderPaymentErrorVo"/>
        where id = #{id}
    </select>

    <insert id="insertLiveOrderPaymentError" parameterType="LiveOrderPaymentError">
        insert into live_order_payment_error
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="orderFlowNo != null">order_flow_no,</if>
            <if test="orderNo != null">order_no,</if>
            <if test="msg != null">msg,</if>
            <if test="status != null">status,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="orderFlowNo != null">#{orderFlowNo},</if>
            <if test="orderNo != null">#{orderNo},</if>
            <if test="msg != null">#{msg},</if>
            <if test="status != null">#{status},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateLiveOrderPaymentError" parameterType="LiveOrderPaymentError">
        update live_order_payment_error
        <trim prefix="SET" suffixOverrides=",">
            <if test="orderFlowNo != null">order_flow_no = #{orderFlowNo},</if>
            <if test="orderNo != null">order_no = #{orderNo},</if>
            <if test="msg != null">msg = #{msg},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteLiveOrderPaymentErrorById" parameterType="Long">
        delete from live_order_payment_error where id = #{id}
    </delete>

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