<?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="org.wfc.system.mapper.UOrderMapper">
    <select id="listOrder" resultType="org.wfc.system.domain.UOrder">
        SELECT
        	o.*,
        	u.user_name,
        	p.package_name
        FROM
        	u_order o
        	LEFT JOIN u_user u ON o.user_id = u.user_id
        	AND u.del_flag = 0
        	LEFT JOIN u_package p ON o.package_id = p.id
        	AND p.del_flag = 0
        WHERE
        	o.del_flag = 0
        <if test="item.userName != null and item.userName != ''">
            AND u.user_name like concat('%', #{item.userName}, '%')
        </if>
        <if test="item.status != null">
            AND o.status = #{item.status}
        </if>
        <if test="item.type != null">
            AND o.type = #{item.type}
        </if>
        ORDER BY
        	o.create_time DESC
    </select>
</mapper>
