<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Feng  
    $Date: 2013-9-24 上午11:35:20  
    $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="CON_DUN_RECORD" defaultOrderBy="t1.contact_date desc">
    <bm:fields>
        <bm:field name="con_dun_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CON_DUN_ID" prompt="CON_DUN_RECORD.CON_DUN_ID"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CON_DUN_RECORD.CONTRACT_ID"/>
        <bm:field name="contact_date" databaseType="DATE" datatype="java.util.Date" physicalName="CONTACT_DATE" prompt="CON_DUN_RECORD.CONTACT_DATE"/>
        <bm:field name="contact_ways" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTACT_WAYS" prompt="CON_DUN_RECORD.CONTACT_WAYS"/>
        <bm:field name="promised_return_date" databaseType="DATE" datatype="java.util.Date" physicalName="PROMISED_RETURN_DATE" prompt="CON_DUN_RECORD.PROMISED_RETURN_DATE"/>
        <bm:field name="promised_return_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROMISED_RETURN_AMOUNT" prompt="CON_DUN_RECORD.PROMISED_RETURN_AMOUNT"/>
        <bm:field name="dun_message" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DUN_MESSAGE" prompt="CON_DUN_RECORD.DUN_MESSAGE"/>
        <bm:field name="dun_after_message"/>
        <bm:field name="dun_unit_id"/>
        <bm:field name="dun_unit_id_desc" expression="(select unit_code||&apos;-&apos;||unit_name from exp_org_unit_v where unit_id = t1.dun_unit_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="dun_person_id"/>
        <bm:field name="contact_person"/>
        <bm:field name="cell_phone"/>
        <bm:field name="phone"/>
        <bm:field name="phone_extra"/>
        <bm:field name="fax_number"/>
        <bm:field name="status"/>
        <bm:field name="dun_person_id_desc" expression="(select employee_code||&apos;-&apos;||name from exp_employees where employee_id = t1.dun_person_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="bp_id_tenant_desc" datatype="java.lang.String" expression="(SELECT hbm.bp_name FROM hls_bp_master hbm,con_contract cc WHERE hbm.bp_id = cc.bp_id_tenant and cc.contract_id=t1.contract_id) " forInsert="false" forUpdate="false"/>
        <bm:field name="contract_number" datatype="java.lang.String" expression="(SELECT cc.contract_number FROM con_contract cc WHERE cc.contract_id=t1.contract_id) " forInsert="false" forUpdate="false"/>
        <bm:field name="bp_id_agent_desc" datatype="java.lang.String" expression="(SELECT hbm.bp_name FROM hls_bp_master hbm,con_contract cc WHERE hbm.bp_id = cc.bp_id_agent_level1 and cc.contract_id=t1.contract_id) " forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk sequenceName="con_dun_record_s"/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="con_dun_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>
