<?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.ichangzuo.system.mapper.OrderMapper">
    <!-- 提现分页列表 -->
    <select id="listPaged" resultType="com.ichangzuo.system.model.vo.OrderPageVO">
        SELECT
        order_id,
        o.user_id,
        u.user_name,
        u.nickname,
        order_number,
        money,
        payway,
        paytime,
        endtime,
        o.state,
        o.remark
        FROM mc_user_order o
        LEFT JOIN mc_user u ON u.user_id = o.user_id
        <where>
            <if test='queryParams.userId!=null'>
                AND o.user_id = #{queryParams.userId}
            </if>
            <if test='queryParams.payway!=null'>
                AND payway = #{queryParams.payway}
            </if>
            <if test='queryParams.state!=null'>
                AND o.state = #{queryParams.state}
            </if>
            <if test="queryParams.paytime != null and queryParams.paytime.size > 0">
                <if test="queryParams.paytime[0] != null and queryParams.paytime[0] != ''">
                    <bind name="startDate" value="queryParams.paytime[0]"/>
                    AND payime &gt;= #{startDate}
                </if>
                <if test="queryParams.paytime[1] != null and queryParams.paytime[1] != ''">
                    <bind name="endDate" value="queryParams.paytime[1]"/>
                    AND paytime &lt;= #{endDate}
                </if>
            </if>
        </where>
        ORDER BY order_id DESC
    </select>
</mapper>
