<?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.logistics.LogisticsInfosMapper">
    <select id="getPage" resultType="com.fjhx.victoriatourist.entity.logistics.vo.LogisticsInfosVo">
        select
            li.id,
            li.business_id,
            li.business_code,
            li.business_type,
            li.warehouse_id,
            li.status,
            li.in_stock_status,
            li.code,
            li.logistics_company_code,
            li.logistics_status,
            li.is_kd100,
            li.create_user,
            li.create_time,
            li.update_user,
            li.update_time,
            li.country_id,
            li.province_id,
            li.city_id,
            li.address,
            li.purchase_id
        from logistics_infos li
                 LEFT JOIN bytesailing_purchase.purchase p ON li.purchase_id = p.id
                 LEFT JOIN bytesailing_purchase.purchase_detail pd ON pd.purchase_id = p.id
                 LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id
                 LEFT JOIN bytesailing_base.sys_dept de
                           ON json_unquote(pi.victoriatourist_json -> '$.deptId') = de.dept_id
            ${ew.customSqlSegment}
    </select>

</mapper>
