<?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
                    (
                        CASE
                            WHEN UPPER(h.irr) LIKE '%ERROR%'
                            THEN 'IRR计算错误'
                            ELSE ROUND(h.irr * 100,6)
                                || '%'
                        END) irr,
                    l.times,
                    TO_CHAR(l.rental, 'fm99,999,999,990.00') rental,
                    TO_CHAR(l.principal, 'fm99,999,999,990.00') principal,
                    TO_CHAR(l.interest, 'fm99,999,999,990.00') interest
                FROM
                    hls_fin_calculator_hd h,
                    hls_fin_calculator_ln l
                WHERE
                    h.calc_session_id  = l.calc_session_id AND
                    h.calc_session_id  =${@calc_session_id} AND
                    to_number(l.times) >0
                ORDER BY
                    to_number(l.times)
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
