TdBPayBlncacWxSMapper.xml 5.18 KB
<?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.zteits.pay.mapper.smapper.TdBPayBlncacWxSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdBPayBlncacWx">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="tradetime" property="tradetime" jdbcType="VARCHAR"/>
        <result column="appid" property="appid" jdbcType="VARCHAR"/>
        <result column="mchid" property="mchid" jdbcType="VARCHAR"/>
        <result column="submch" property="submch" jdbcType="VARCHAR"/>
        <result column="device_no" property="deviceNo" jdbcType="VARCHAR"/>
        <result column="transaction_id" property="transactionId" jdbcType="VARCHAR"/>
        <result column="out_trade_no" property="outTradeNo" jdbcType="VARCHAR"/>
        <result column="openid" property="openid" jdbcType="VARCHAR"/>
        <result column="trade_type" property="tradeType" jdbcType="VARCHAR"/>
        <result column="trade_status" property="tradeStatus" jdbcType="VARCHAR"/>
        <result column="bank" property="bank" jdbcType="VARCHAR"/>
        <result column="currency" property="currency" jdbcType="VARCHAR"/>
        <result column="total_fee" property="totalFee" jdbcType="VARCHAR"/>
        <result column="coupon_fee" property="couponFee" jdbcType="VARCHAR"/>
        <result column="refund_transaction_id" property="refundTransactionId" jdbcType="VARCHAR"/>
        <result column="out_refund_no" property="outRefundNo" jdbcType="VARCHAR"/>
        <result column="refund_fee" property="refundFee" jdbcType="VARCHAR"/>
        <result column="refund_coupon_fee" property="refundCouponFee" jdbcType="VARCHAR"/>
        <result column="refund_type" property="refundType" jdbcType="VARCHAR"/>
        <result column="refund_status" property="refundStatus" jdbcType="VARCHAR"/>
        <result column="productname" property="productname" jdbcType="VARCHAR"/>
        <result column="attach" property="attach" jdbcType="VARCHAR"/>
        <result column="fee" property="fee" jdbcType="VARCHAR"/>
        <result column="rate" property="rate" jdbcType="VARCHAR"/>
        <result column="data_state" property="dataState" jdbcType="INTEGER" />
        <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">
    id, tradetime, appid, mchid, submch, device_no, transaction_id, out_trade_no, openid, 
    trade_type, trade_status, bank, currency, total_fee, coupon_fee, refund_transaction_id, 
    out_refund_no, refund_fee, refund_coupon_fee, refund_type, refund_status, productname, 
    attach, fee, rate
  </sql>

    <insert id="insertWXPayBincac" parameterType="java.util.List">
        insert into td_b_pay_blncac_wx (tradetime, appid, mchid,
        submch, device_no, transaction_id,
        out_trade_no, openid, trade_type,
        trade_status, bank, currency,
        total_fee, coupon_fee, refund_transaction_id,
        out_refund_no, refund_fee, refund_coupon_fee,
        refund_type, refund_status, productname,
        attach, fee, rate,data_state,create_date)
        values
        <foreach collection="payBlncacWxList" separator="," item="item" index="index">
            (
            #{item.tradetime,jdbcType=VARCHAR}, #{item.appid,jdbcType=VARCHAR}, #{item.mchid,jdbcType=VARCHAR},
            #{item.submch,jdbcType=VARCHAR}, #{item.deviceNo,jdbcType=VARCHAR}, #{item.transactionId,jdbcType=VARCHAR},
            #{item.outTradeNo,jdbcType=VARCHAR}, #{item.openid,jdbcType=VARCHAR}, #{item.tradeType,jdbcType=VARCHAR},
            #{item.tradeStatus,jdbcType=VARCHAR}, #{item.bank,jdbcType=VARCHAR}, #{item.currency,jdbcType=VARCHAR},
            #{item.totalFee,jdbcType=VARCHAR}, #{item.couponFee,jdbcType=VARCHAR},
            #{item.refundTransactionId,jdbcType=VARCHAR},
            #{item.outRefundNo,jdbcType=VARCHAR}, #{item.refundFee,jdbcType=VARCHAR},
            #{item.refundCouponFee,jdbcType=VARCHAR},
            #{item.refundType,jdbcType=VARCHAR}, #{item.refundStatus,jdbcType=VARCHAR},
            #{item.productname,jdbcType=VARCHAR},
            #{item.attach,jdbcType=VARCHAR}, #{item.fee,jdbcType=VARCHAR}, #{item.rate,jdbcType=VARCHAR},
            #{item.dataState,jdbcType=INTEGER},#{item.createDate,jdbcType=TIMESTAMP}
            )
        </foreach>
    </insert>

    <delete id="deleteWXPayBincacByTradeTime">
        DELETE FROM td_b_pay_blncac_wx
        <where>
            <choose>
                <when test="null == tradeTime">
                    1=2
                </when>
                <otherwise>
                    DATE(tradetime) &gt;= DATE(#{tradeTime})
                    AND
                    DATE(tradetime) &lt; date_sub(DATE(#{tradeTime}),interval -1 day)
                </otherwise>
            </choose>

        </where>

    </delete>
    <!-- 根据支付单list查询微信对账单数据 -->
    <select id="querywxPayBlncacListByPayOrderIds" resultMap="BaseResultMap">
       select * from
       td_b_pay_blncac_wx
       where 1=1
         and out_trade_no in
       <foreach collection="list" item="item" open="(" close=")" separator=",">
	       #{item}
	    </foreach>
    </select>


</mapper>