<?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.DocumentsProductMapper">
    <select id="getPage" resultType="com.fjhx.sale.entity.documents.vo.DocumentsProductVo">
        select
            dp.id,
            dp.business_id,
            dp.documents_id,
            dp.describes,
            dp.sub_describe,
            dp.customs_code,
            dp.price,
            dp.quantity,
            dp.contract_code,
            dp.product_name,
            dp.update_time,
            dp.update_user,
            dp.create_user,
            dp.create_time
        from documents_product dp
            ${ew.customSqlSegment}
    </select>

    <select id="getDpList" resultType="com.fjhx.sale.entity.documents.po.DocumentsProduct">
        SELECT
            t1.*,
            t2.product_id AS productId
        FROM
            documents_product t1
        LEFT JOIN pack_detail_product t2 ON t1.business_id = t2.id
        WHERE t1.documents_id = #{documentId}
    </select>
</mapper>
