<?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.ucenter.mapper.IExpansionOrderMapper">

    <select id="pageList" resultType="com.fdkankan.ucenter.vo.response.ExpansionOrderVo">
        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="param.cameraId !=null">
            and o.camera_id = #{param.cameraId}
        </if>
        <if test="param.userId !=null">
            and o.user_id = #{param.userId}
        </if>
        <if test="param.childName !=null and param.childName !=''">
            and o.t.child_name like concat('%', #{param.childName},'%')
        </if>

    </select>

    <select id="getCount" resultType="java.lang.Long">
        select count(*) from t_expansion_order o
        where o.rec_status = 'A' and o.pay_status = 1
        and o.user_id = #{userId}
    </select>
</mapper>
