<?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
                        (SELECT
                            FC.COMPANY_SHORT_NAME
                        FROM
                            FND_COMPANIES FC
                        WHERE
                            FC.COMPANY_ID = A.COMPANY_ID
                        ) AS COMPANY_NAME,
                        A.COMPANY_ID,
                        B.BANK_ID,
                        A.BANK_ACCOUNT_ID,
                        A.BANK_ACCOUNT_NAME,
                        A.BANK_ACCOUNT_NUM,
                        B.BANK_BRANCH_NAME,
                        A.CURRENCY_CODE,
                        C.BANK_FULL_NAME,
                        C.BANK_CODE
                    FROM
                        CSH_BANK_ACCOUNT A,
                        CSH_BANK_BRANCH B,
                        CSH_BANK C
                    WHERE
                        A.IS_COMPANY_ACCOUNT = 'Y' AND
                        A.ENABLED_FLAG       = 'Y' AND
                        A.BANK_BRANCH_ID     = B.BANK_BRANCH_ID AND
                        B.BANK_ID            = C.BANK_ID
                    ORDER BY
                        BANK_ID
                    ) T #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="bank_id"/>
        <bm:field name="bank_account_id"/>
        <bm:field name="company_name" displayWidth="100" prompt="公司"/>
        <bm:field name="bank_account_name" displayWidth="115" forDisplay="true" forQuery="true" prompt="账户名"/>
        <bm:field name="bank_account_num" forDisplay="true" forQuery="true" prompt="银行账户"/>
        <bm:field name="bank_full_name" displayWidth="120" forDisplay="true" prompt="银行"/>
        <bm:field name="bank_branch_name" displayWidth="120" forDisplay="true" prompt="分行"/>
        <bm:field name="currency_code" displayWidth="60" forDisplay="true" prompt="币种"/>
        <bm:field name="bank_code"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="bank_account_name" queryOperator="="/>
        <bm:query-field field="bank_account_num" queryOperator="="/>
        <bm:query-field name="current_company" queryExpression="((t.company_id = ${/session/@company_id} and ${@current_company} = &apos;N&apos;) or ${@current_company} = &apos;Y&apos;)"/>
    </bm:query-fields>
</bm:model>
