<?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.fjhx.victoriatourist.mapper.order.OrderInfoMapper">
    <select id="getPage" resultType="com.fjhx.victoriatourist.entity.order.vo.OrderInfoVo">
        select
            oi.id,
            oi.type,
            oi.customer_info_id,
            oi.code,
            oi.amount_money,
            oi.order_time,
            oi.status,
            oi.issue_status,
            oi.after_sales_status,
            oi.country_id,
            oi.province_id,
            oi.city_id,
            oi.detailed_address,
            oi.contacts,
            oi.phone,
            oi.phone_prefix_type,
            oi.excel_import_id,
            oi.distribution_center,
            oi.jd_warehouse,
            oi.remark,
            oi.create_user,
            oi.create_time,
            oi.update_user,
            oi.update_time
        from order_info oi
                 LEFT JOIN order_details od ON od.order_id = oi.id
                 LEFT JOIN bytesailing_item.product_info pi ON od.product_id = pi.id
                 LEFT JOIN bytesailing_base.sys_dept de ON CAST(json_unquote(pi.victoriatourist_json -> '$.deptId') AS UNSIGNED) = de.dept_id
            ${ew.customSqlSegment}
    </select>

</mapper>
