<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-3-13 上午09:25:25  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="LCH_LEASE_CHANCE_DOC_CLT">
    <bm:fields>
        <bm:field name="lease_chance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_CHANCE_ID"/>
        <bm:field name="tenant_doc_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TENANT_DOC_CODE" prompt="LCH502.LCH_LEASE_CHANCE_DOC_CLT.TENANT_DOC_CODE"/>
        <bm:field name="tenant_doc_name" forInsert="false" forUpdate="false" prompt="LCH502.LCH_LEASE_CHANCE_DOC_CLT.TENANT_DOC_NAME"/>
        <bm:field name="received_date" databaseType="DATE" datatype="java.util.Date" physicalName="RECEIVED_DATE" prompt="LCH502.LCH_LEASE_CHANCE_DOC_CLT.RECEIVED_DATE"/>
        <bm:field name="received_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RECEIVED_FLAG" prompt="LCH502.LCH_LEASE_CHANCE_DOC_CLT.RECEIVED_FLAG"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select ${@lease_chance_id} as lease_chance_id,
    				   l.tenant_doc_code,
    				   l.tenant_doc_name,
				       nvl(d.received_flag, 'N') as received_flag,
				       d.received_date
				  from lch_doc_list l, lch_lease_chance_doc_clt d
				 where l.tenant_doc_code = d.tenant_doc_code(+)
				   and d.lease_chance_id(+) = ${@lease_chance_id}
				   and l.enabled_flag = 'Y'
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
        	  begin
        	  	null;
        	  end;
        	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
        	  begin
        	  
			   lch501_save_pkg.doc_manage(p_lease_chance_id => ${@lease_chance_id},
							              p_tenant_doc_code => ${@tenant_doc_code},
							              p_received_date   => to_date(${@received_date},'yyyy-mm-dd'),
							              p_received_flag   => ${@received_flag},
							              p_user_id         => ${/session/@user_id});
        	  end;
        	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
        	  begin
        	  	null;
        	  end;
        	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
