<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2014-4-8 下午02:46:50  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="RSC_CONTRACT_COLLECTION">
    <bm:fields>
        <bm:field name="collection_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COLLECTION_ID" prompt="RSC_CONTRACT_COLLECTION.COLLECTION_ID"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="RSC_CONTRACT_COLLECTION.CONTRACT_ID"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" prompt="RSC_CONTRACT_COLLECTION.BP_ID"/>
        <bm:field name="bp_name" expression="(select hbm.bp_name from hls_bp_master hbm where hbm.bp_id=t1.bp_id)" forInsert="fasle" forUpdate="false"/>
        <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="RSC_CONTRACT_COLLECTION.OWNER_USER_ID"/>
        <bm:field name="overdue_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OVERDUE_AMOUNT" prompt="RSC_CONTRACT_COLLECTION.OVERDUE_AMOUNT"/>
        <bm:field name="collector_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COLLECTOR_USER_ID" prompt="RSC_CONTRACT_COLLECTION.COLLECTOR_USER_ID"/>
        <bm:field name="collector_user_name" expression="(select su.description from sys_user su where su.user_id=t1.collector_user_id)" forInsert="fasle" forUpdate="false"/>
        <bm:field name="org_unit_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ORG_UNIT_ID" prompt="RSC_CONTRACT_COLLECTION.ORG_UNIT_ID"/>
        <bm:field name="org_unit_desc" expression="(select eou.unit_name from exp_org_unit_v eou where eou.unit_id=t1.org_unit_id)" forInsert="fasle" forUpdate="false"/>
        <bm:field name="collection_date" databaseType="VARCHAR2" datatype="java.lang.String" expression="(to_char(t1.collection_date,&apos;YYYY-MM-DD&apos;))" insertExpression="to_date(${@collection_date},&apos;YYYY-MM-DD&apos;)" physicalName="COLLECTION_DATE" prompt="RSC_CONTRACT_COLLECTION.COLLECTION_DATE" updateExpression="to_date(${@collection_date},&apos;YYYY-MM-DD&apos;)"/>
        <bm:field name="collection_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COLLECTION_METHOD" prompt="RSC_CONTRACT_COLLECTION.COLLECTION_METHOD"/>
        <bm:field name="collection_method_desc" expression="(select sc.code_value_name from sys_code_values_v sc where sc.code = &apos;RSC_COLLECTION_METHOD&apos; and sc.code_value = t1.collection_method)" forInsert="fasle" forUpdate="false"/>
        <bm:field name="collection_result" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COLLECTION_RESULT" prompt="RSC_CONTRACT_COLLECTION.COLLECTION_RESULT"/>
        <bm:field name="follow_up" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FOLLOW_UP" prompt="RSC_CONTRACT_COLLECTION.FOLLOW_UP"/>
    </bm:fields>
    <bm:features>
        <o:sequence-pk/>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="collection_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="bp_id" queryExpression="t1.bp_id=${@bp_id}"/>
        <bm:query-field name="contract_id" queryExpression="t1.contract_id=${@contract_id}"/>
        <bm:query-field name="bp_name" queryExpression="exists(select 1 from hls_bp_master hbm where hbm.bp_id=t1.bp_id and hbm.bp_name like ${@bp_name})"/>
    </bm:query-fields>
</bm:model>
