<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                        t.log_id,
                        t.log_code,
                        t.log_msg,
                        p.quotation_id,
                        c.loan_contract_id,
                        c.loan_contract_number,
                        c.loan_contract_name,
                        TO_CHAR(t.creation_date, 'YYYY-MM-DD') log_date
                    FROM
                        sdic_tre_floating_interest_log t,
                        tre_loan_con_withdrawal_plan p,
                        tre_loan_contract c
                    WHERE
                        t.quotation_id     = p.quotation_id AND
                        p.loan_contract_id = c.loan_contract_id AND
                        t.quotation_id     = ${@quotation_id}
                    ORDER BY
                        t.log_id DESC
                    ) t1
                WHERE
                    rownum = 1
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
