<?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.PoseOrderZalopayMapper">

    <resultMap type="PoseOrderZalopay" id="PoseOrderZalopayResult">
        <result property="id"    column="id"    />
        <result property="ddId"    column="dd_id"    />
        <result property="callbackResponse"    column="callback_response"    />
        <result property="refundResponse"    column="refund_response"    />
        <result property="callbackResponseTime"    column="callback_response_time"    />
        <result property="refundResponseTime"    column="refund_response_time"    />
        <result property="createResponse"    column="create_response"    />
        <result property="createResponseTime"    column="create_response_time"    />
        <result property="mRefundId"    column="m_refund_id"    />
    </resultMap>

    <sql id="selectPoseOrderZalopayVo">
        select id, dd_id, callback_response, refund_response, callback_response_time, refund_response_time, create_response, create_response_time,m_refund_id from pose_order_zaloPay
    </sql>

    <select id="selectPoseOrderZalopayList" parameterType="PoseOrderZalopay" resultMap="PoseOrderZalopayResult">
        <include refid="selectPoseOrderZalopayVo"/>
        <where>
            <if test="callbackResponse != null  and callbackResponse != ''"> and callback_response = #{callbackResponse}</if>
            <if test="refundResponse != null  and refundResponse != ''"> and refund_response = #{refundResponse}</if>
            <if test="callbackResponseTime != null "> and callback_response_time = #{callbackResponseTime}</if>
            <if test="refundResponseTime != null "> and refund_response_time = #{refundResponseTime}</if>
            <if test="createResponse != null  and createResponse != ''"> and create_response = #{createResponse}</if>
            <if test="createResponseTime != null "> and create_response_time = #{createResponseTime}</if>
        </where>
    </select>

    <select id="selectPoseOrderZalopayById" parameterType="Long" resultMap="PoseOrderZalopayResult">
        <include refid="selectPoseOrderZalopayVo"/>
        where id = #{id}
    </select>

    <insert id="insertPoseOrderZalopay" parameterType="PoseOrderZalopay" useGeneratedKeys="true" keyProperty="id">
        insert into pose_order_zaloPay
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ddId != null">dd_id,</if>
            <if test="callbackResponse != null">callback_response,</if>
            <if test="refundResponse != null">refund_response,</if>
            <if test="callbackResponseTime != null">callback_response_time,</if>
            <if test="refundResponseTime != null">refund_response_time,</if>
            <if test="createResponse != null">create_response,</if>
            <if test="createResponseTime != null">create_response_time,</if>
            <if test="mRefundId != null">m_refund_id,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ddId != null">#{ddId},</if>
            <if test="callbackResponse != null">#{callbackResponse},</if>
            <if test="refundResponse != null">#{refundResponse},</if>
            <if test="callbackResponseTime != null">#{callbackResponseTime},</if>
            <if test="refundResponseTime != null">#{refundResponseTime},</if>
            <if test="createResponse != null">#{createResponse},</if>
            <if test="createResponseTime != null">#{createResponseTime},</if>
            <if test="mRefundId != null">#{mRefundId},</if>
        </trim>
    </insert>

    <update id="updatePoseOrderZalopay" parameterType="PoseOrderZalopay">
        update pose_order_zaloPay
        <trim prefix="SET" suffixOverrides=",">
            <if test="ddId != null">dd_id = #{ddId},</if>
            <if test="callbackResponse != null">callback_response = #{callbackResponse},</if>
            <if test="refundResponse != null">refund_response = #{refundResponse},</if>
            <if test="callbackResponseTime != null">callback_response_time = #{callbackResponseTime},</if>
            <if test="refundResponseTime != null">refund_response_time = #{refundResponseTime},</if>
            <if test="createResponse != null">create_response = #{createResponse},</if>
            <if test="createResponseTime != null">create_response_time = #{createResponseTime},</if>
            <if test="mRefundId != null">m_refund_id = #{mRefundId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePoseOrderZalopayById" parameterType="Long">
        delete from pose_order_zaloPay where id = #{id}
    </delete>

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