<?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.kmall.schedule.dao.OrderWXPayRecordMapper">
    <update id="update" parameterType="map">
        update mall_order_wxpay_record
        <set>
            <if test="return_code != null">`return_code` = #{return_code}, </if>
            <if test="return_msg != null">`return_msg` = #{return_msg}, </if>
            <if test="result_code != null">`result_code` = #{result_code}, </if>
            <if test="err_code != null">`err_code` = #{err_code}, </if>
            <if test="err_code_des != null">`err_code_des` = #{err_code_des}, </if>
            <if test="openid != null">`openid` = #{openid}, </if>
            <if test="is_subscribe != null">`is_subscribe` = #{is_subscribe}, </if>
            <if test="trade_type != null">`trade_type` = #{trade_type}, </if>
            <if test="fee_type != null">`fee_type` = #{fee_type}, </if>
            <if test="total_fee != null">`total_fee` = #{total_fee}, </if>
            <if test="transaction_id != null">`transaction_id` = #{transaction_id}, </if>
            <if test="out_trade_no != null">`out_trade_no` = #{out_trade_no}, </if>
            <if test="out_trade_no_wx != null">`out_trade_no_wx` = #{out_trade_no_wx}, </if>
            <if test="attach != null">`attach` = #{attach}, </if>
            <if test="time_end != null">`time_end` = #{time_end}, </if>
            <if test="trade_state != null">`trade_state` = #{trade_state}, </if>
            <if test="creater_sn != null">`creater_sn` = #{creater_sn}, </if>
            <if test="create_time != null">`create_time` = #{create_time}, </if>
            <if test="moder_sn != null">`moder_sn` = #{moder_sn}, </if>
            <if test="mod_time != null">`mod_time` = #{mod_time}</if>
        </set>
        where id = #{id}
    </update>

    <select id="queryRecordList" resultType="map">
        SELECT id,out_trade_no,out_trade_no_wx
        FROM mall_order_wxpay_record
        where trade_state in
        <foreach collection="list" item="listItem" open="(" separator="," close=")">
            #{listItem}
        </foreach>
    </select>

    <select id="getRecordsByOutTradeNo" resultType="map">
        SELECT id,trade_state,out_trade_no_wx
        FROM mall_order_wxpay_record
        where out_trade_no = #{out_trade_no}
    </select>
</mapper>