<?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.fdkankan.platform.order.mapper.IExpansionOrderMapper">

    <select id="getExpansionListByParam" resultType="com.fdkankan.platform.order.vo.ResponseExpansionOrder">
        select o.id, t.child_name, o.unit, o.unit_size, c.space, o.pay_type, c.space_start_time, c.space_end_time, o.trade_time, o.pay_status, o.amount, o.order_sn, o.status, o.month from t_expansion_order o
        LEFT JOIN t_camera_space c on o.order_sn = c.order_sn
        LEFT JOIN t_camera t on o.camera_id = t.id
        WHERE o.pay_status = 1 AND o.rec_status = 'A'
        <if test=" userId != null and  param.userId !='' " >
            and o.user_id = ${ param.userId}
        </if>
        <if test=" param.childName != null and  param.childName !='' " >
            and c.child_name like concat('%',#{ param.childName},'%')
        </if>
        <if test="  param.cameraId != null and  param.cameraId !='' " >
            and o.camera_id = ${ param.cameraId}
        </if>
        <if test=" param.orderBy != null">
            order by ${ param.orderBy}
        </if>

    </select>


</mapper>
