<?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.OrderRespVO">
        select a.id as orderId, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId,
        count(c.id) as num, sum(c.area) as area, p.goods_name, p.color, p.material, p.goods_id
        from `order` a
        left join order_plate c ON a.id = c.order_id and c.is_cancel = 0
        left join plate p on c.goods_id = p.goods_id
        left join order_item d ON c.order_id = d.order_id
        ${ew.customSqlSegment}
        group by orderId, p.id
    </select>
</mapper>