<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:e="leaf.service.exception" xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="gld_company_accounts_ref">
    <bm:fields>
        <bm:field name="gld_company_accounts_ref_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="GLD_COMPANY_ACCOUNTS_REF_ID"/>
        <bm:field name="set_of_books_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SET_OF_BOOKS_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="account_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ACCOUNT_ID"/>
        <bm:field name="subsystem_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SUBSYSTEM_FLAG"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG"/>
        <bm:field name="ref_code1" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE1"/>
        <bm:field name="ref_code2" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE2"/>
        <bm:field name="ref_code3" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE3"/>
        <bm:field name="ref_code4" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE4"/>
        <bm:field name="ref_code5" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE5"/>
        <bm:field name="ref_code6" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE6"/>
        <bm:field name="ref_code7" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE7"/>
        <bm:field name="ref_code8" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE8"/>
        <bm:field name="ref_code9" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CODE9"/>
        <bm:field name="account_set_code" expression="(SELECT t2.account_set_code FROM gld_account_sets t2 where t2.account_set_id = t1.set_of_books_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="account_set_name" expression="(SELECT t2.account_set_name FROM gld_account_sets t2 where t2.account_set_id = t1.set_of_books_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="account_code" expression="(select t2.account_code from gld_accounts_vl t2 where t2.ACCOUNT_ID = t1.account_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="account_desc" expression="(select t2.DESCRIPTION from gld_accounts_vl t2 where t2.ACCOUNT_ID = t1.account_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="company_id_desc" expression="(select fc.company_short_name from fnd_companies fc where fc.company_id = t1.company_id)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.company_id=${/session/@company_id}"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field name="set_of_books_id" queryExpression="t1.set_of_books_id like &apos;%&apos;||${@set_of_books_id}||&apos;%&apos;"/>
        <bm:query-field name="account_id" queryExpression="t1.account_id like &apos;%&apos;||${@account_id}||&apos;%&apos;"/>
        <bm:query-field name="enabled_flag" queryExpression="t1.enabled_flag like &apos;%&apos;||${@enabled_flag}||&apos;%&apos;"/>
    </bm:query-fields>
    <bm:primary-key>
        <bm:pk-field name="gld_company_accounts_ref_id"/>
    </bm:primary-key>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="同一科目表中的科目重复，请修改科目！"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
