huminmin
2026-06-01 0c9ee949b6a7ea8ce2bbc42cbbd2c64fb977e509
src/main/resources/mapper/sales/SalesLedgerMapper.xml
@@ -62,7 +62,8 @@
        T1.payment_method,
        T1.delivery_date,
        DATEDIFF(T1.delivery_date, CURDATE()) AS delivery_days_diff,
        IFNULL(shipping_status_counts.is_all_shipped, FALSE) AS is_fh
        IFNULL(shipping_status_counts.is_all_shipped, FALSE) AS is_fh,
        T3.purchase_contract_number
        FROM sales_ledger T1
        LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id
        LEFT JOIN (
@@ -74,6 +75,7 @@
        FROM shipping_info
        GROUP BY sales_ledger_id
        ) shipping_status_counts ON T1.id = shipping_status_counts.sales_ledger_id
        LEFT JOIN purchase_ledger T3 ON T1.purchase_ledger_id = T3.id
        <where>
            <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' ">
@@ -121,5 +123,23 @@
        </if>
        order by sl.execution_date desc
    </select>
    <select id="selectPurchaseReportVoPage" resultType="com.ruoyi.purchase.vo.PurchaseReportVo">
        select sl.sales_contract_no customerContractNo,
               c.customer_name,
               sl.project_name,
               sl.contract_amount contractAmount,
               pl.contract_amount purchaseAmount,
               sl.contract_amount-pl.contract_amount balance,
               (sl.contract_amount-pl.contract_amount)/sl.contract_amount balanceRatio
        from sales_ledger sl
        left join purchase_ledger pl on sl.id = pl.sales_ledger_id
        left join customer c on sl.customer_id = c.id
        <where>
            <if test="customerName != null and customerName != '' ">
                and c.customer_name like concat('%',#{customerName},'%')
            </if>
        </where>
        order by sl.entry_date desc
    </select>
</mapper>