<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2016-5-23 上午10:23:15  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="YONDA_DOCUMENT_LEND_RECORD_HD" defaultOrderBy="t1.borrower_number desc">
    <bm:fields>
        <bm:field name="lend_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEND_HEADER_ID" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.LEND_HEADER_ID"/>
        <bm:field name="borrower_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BORROWER_NAME" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.BORROWER_NAME"/>
        <bm:field name="borrower_phone" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BORROWER_PHONE" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.BORROWER_PHONE"/>
        <bm:field name="borrower_date" databaseType="DATE" datatype="java.util.Date" physicalName="BORROWER_DATE" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.BORROWER_DATE"/>
        <bm:field name="lender_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LENDER_NAME" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.LENDER_NAME"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.REF_D05"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.STATUS"/>
        <bm:field name="borrow_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BORROW_STATUS" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.BORROW_STATUS"/>
        <bm:field name="instance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INSTANCE_ID" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.INSTANCE_ID"/>
        <bm:field name="express_number_out" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_NUMBER_OUT" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.EXPRESS_NUMBER_OUT"/>
        <bm:field name="express_company_out" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_COMPANY_OUT" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.EXPRESS_COMPANY_OUT"/>
        <bm:field name="express_address_out" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_ADDRESS_OUT" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.EXPRESS_ADDRESS_OUT"/>
        <bm:field name="doc_out_time" databaseType="DATE" datatype="java.util.Date" physicalName="DOC_OUT_TIME" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.DOC_OUT_TIME"/>
        <bm:field name="express_number_in" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_NUMBER_IN" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.EXPRESS_NUMBER_IN"/>
        <bm:field name="express_company_in" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_COMPANY_IN" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.EXPRESS_COMPANY_IN"/>
        <bm:field name="express_address_in" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_ADDRESS_IN" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.EXPRESS_ADDRESS_IN"/>
        <bm:field name="doc_in_time" databaseType="DATE" datatype="java.util.Date" physicalName="DOC_IN_TIME" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.DOC_IN_TIME"/>
        <bm:field name="email" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EMAIL" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.EMAIL"/>
        <bm:field name="borrower_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BORROWER_NUMBER" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.BORROWER_NUMBER"/>
        <bm:field name="borrow_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BORROW_TYPE" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.BORROW_TYPE"/>
        <bm:field name="borrow_type_n" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select v.code_value_name as value_name from sys_code_values_v v where v.code = &apos;BORROW_TYPE&apos;  and v.code_value=t1.borrow_type)" forInsert="false" forUpdate="false"/>
        <bm:field name="status_n" databaseType="VARCHAR2" datatype="java.lang.String" expression="(SELECT v.code_value_name value_name FROM sys_code_values_v v WHERE v.code = &apos;CON556_WFL_STATUS&apos; and v.code_value=t1.status)" forInsert="false" forUpdate="false"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" prompt="YONDA_DOCUMENT_LEND_RECORD_HD.DOCUMENT_CATEGORY"/>
        <bm:field name="lender_name_n" databaseType="VARCHAR2" datatype="java.lang.String" expression="(SELECT description FROM sys_user s WHERE TO_CHAR(s.user_id)= t1.lender_name)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <s:bm-script><![CDATA[
            var cx = Packages.leaf.javascript.Context.getCurrentContext();
            Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
        ]]></s:bm-script>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="lend_header_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="borrower_number" queryExpression="t1.borrower_number like upper(&apos;%&apos;||${@borrower_number}||&apos;%&apos;)"/>
        <bm:query-field name="borrower_date_from" queryExpression="t1.borrower_date &gt;= to_date(${@borrower_date_from},&apos;yyyy-mm-dd&apos;) "/>
        <bm:query-field name="borrower_date_to" queryExpression="t1.borrower_date &lt;= to_date(${@borrower_date_to},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="status" queryExpression="t1.status=${@status}"/>
        <bm:query-field name="borrow_type" queryExpression="t1.borrow_type=${@borrow_type}"/>
        <bm:query-field name="borrower_name" queryExpression="t1.borrower_name=${@borrower_name}"/>
    </bm:query-fields>
</bm:model>
