<?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.m2pool.lease.mapper.LeasePaymentRecordMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.m2pool.lease.entity.LeasePaymentRecord">
        <id column="id" property="id" />
        <result column="order_id" property="orderId" />
        <result column="amount" property="amount" />
        <result column="status" property="status" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="del" property="del" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, order_id, payment_method, amount, status, create_time, update_time, del
    </sql>
    <update id="updateBatchStatusForOderIdAndShopId">
        update lease_payment_record set status = 5
        where
         status = 6 AND
        (<foreach collection="list" item="item" separator="OR">
        (`order_id` = #{item.orderId} and `shop_id` = #{item.shopId})
        </foreach>)
    </update>
    <select id="checkPaymentRecordStatus" resultType="com.m2pool.lease.entity.LeasePaymentRecord">
select id,order_id as orderId,shop_id as shopId,status from lease_payment_record
where
        <foreach collection="list" item="item" separator="OR">
            (`order_id` = #{item.orderId} and `shop_id` = #{item.shopId})
        </foreach>
    </select>
    <select id="getIsPayInData" resultType="com.m2pool.lease.entity.LeasePaymentRecord">
        select id,order_id as orderId, shop_id AS shopId,status,amount,pay_amount AS payAmount,pay_address as payAddress from lease_payment_record
        where
             create_time > DATE_SUB(NOW(),INTERVAL 15 MINUTE) and del = false
    </select>


</mapper>
