<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="CON_CONTRACT_CASHFLOW_REQ" needAccessControl="false">
    <bm:fields>
        <bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASHFLOW_ID" prompt="CON_CONTRACT_CASHFLOW_REQ.CASHFLOW_ID"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CON_CONTRACT_CASHFLOW_REQ.CONTRACT_ID"/>
        <bm:field name="cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_ITEM" prompt="CON_CONTRACT_CASHFLOW_REQ.CF_ITEM"/>
        <bm:field name="cf_item_n" expression="(SELECT description FROM hls_cashflow_item WHERE cf_direction = &apos;INFLOW&apos; and cf_item = t1.cf_item)" forInsert="false" forUpdate="false"/>
        <bm:field name="cf_direction" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_DIRECTION" prompt="CON_CONTRACT_CASHFLOW_REQ.CF_DIRECTION"/>
        <bm:field name="cf_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_STATUS" prompt="CON_CONTRACT_CASHFLOW_REQ.CF_STATUS"/>
        <bm:field name="due_date" databaseType="DATE" datatype="java.util.Date" physicalName="DUE_DATE" prompt="CON_CONTRACT_CASHFLOW_REQ.DUE_DATE"/>
        <bm:field name="due_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DUE_AMOUNT" prompt="CON_CONTRACT_CASHFLOW_REQ.DUE_AMOUNT"/>
        <!-- <bm:field name="write_off_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_FLAG" prompt="CON_CONTRACT_CASHFLOW_REQ.WRITE_OFF_FLAG"/> -->
        <bm:field name="write_off_flag" expression="(SELECT decode(t1.insert_flag,&apos;N&apos;,&apos;NOT&apos;,&apos;Y&apos;,(SELECT write_off_flag FROM con_contract_cashflow WHERE cashflow_id = t1.cashflow_id)) FROM dual)"/>
        <bm:field name="write_off_flag_n" expression="(SELECT V.code_value_name FROM SYS_CODE_VALUES_V V WHERE V.code = &apos;CON_WRITE_OFF_FLAG&apos; AND V.code_value = ((SELECT decode(t1.insert_flag,&apos;N&apos;,&apos;NOT&apos;,&apos;Y&apos;,(SELECT write_off_flag FROM con_contract_cashflow WHERE cashflow_id = t1.cashflow_id)) FROM dual)))" forInsert="false" forUpdate="false"/>
        <bm:field name="insert_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSERT_FLAG" prompt="插入现金流表标志"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk sequenceName="CON_CONTRACT_CASHFLOW_REQ_S"/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="cashflow_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="contract_id" queryExpression="t1.contract_id=${/parameter/@contract_id}"/>
    </bm:query-fields>
</bm:model>
