<?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.purchase.mapper.invoice.InvoiceMapper">
    <select id="getPage" resultType="com.fjhx.purchase.entity.invoice.vo.InvoiceVo">
        SELECT
            *
        FROM
            (
                SELECT
                    t1.*,
                    GROUP_CONCAT( t3.`code` ) AS purchaseCodes
                FROM
                    invoice t1
                        LEFT JOIN invoice_details t2 ON t1.id = t2.invoice_id
                        LEFT JOIN purchase t3 ON t2.purchase_id = t3.id
                GROUP BY
                    t1.id
            ) t1
            ${ew.customSqlSegment}
    </select>

</mapper>
