<?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.cf.imes.module.executor.dal.mysql.order.OrderMapper">

    <select id="selectOrderPage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
        select a.id as orderId, a.order_date, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId,
               count(op.id) as num, sum(op.area) as area
        from `orders` a
                 left join order_item oi on a.id = oi.order_id and a.organ_id = oi.organ_id
                 inner join order_plate op on oi.plate_id = op.id and oi.organ_id = op.organ_id
                 inner join order_goods og on op.goods_id = og.id and op.organ_id = og.organ_id
                 left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
        ${ew.customSqlSegment}


    </select>

    <select id="selectDynamicSqlString" resultType="java.util.Map">
        ${sqlStr}
    </select>
</mapper>