<?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.sale.mapper.documents.DocumentsMapper">
    <select id="getPage" resultType="com.fjhx.sale.entity.documents.vo.DocumentsVo">
        select d.id,
               d.contract_id,
               d.port_of_destination,
               d.remark,
               d.country_id,
               d.update_time,
               d.update_user,
               d.create_user,
               d.create_time,
               c.sell_corporation_id sellCorporationId,
               c.buy_corporation_id  buyCorporationId,
               c.code,
               dp.accept_carriage    acceptCarriage,
               dp.code               acceptCode
        from documents d
                 left join contract c on d.contract_id = c.id
                 left join documents_transport dp on d.id = dp.documents_id
            ${ew.customSqlSegment}
    </select>

    <select id="getContractDataById" resultType="java.util.Map">
        SELECT t2.transport_method,
               t2.trade_methods
        FROM documents t1
                 LEFT JOIN contract t2 ON t1.contract_id = t2.id
        WHERE t1.id = #{documentId}
    </select>
</mapper>
