<?xml version="1.0" encoding="UTF-8"?>

<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            Select distinct t1.borrower_phone,
               t1.borrower_date,
               t1.lender_name,
               t1.borrow_to,
               t1.borrow_to_n,
               t1.unit_id,
               t1.apply_date,
               t1.send_date,
               t1.send_number,
               t1.reader_name,
               t1.back_date,
               t1.back_number,
               t1.promise_date,
               t1.real_date,
               t1.status,
               t1.status_n,
               t1.borrow_reason,
               t1.send_flag,
               t1.send_flag_n,
               t1.track_number,
               t1.recipient,
               t1.return_mark,
               t1.return_send_flag,
               t1.return_send_flag_n,
               t1.return_recipient,
               t1.return_track_number,
               t1.contract_number,
               t1.bp_name,
               t1.agent_name,
               t1.lend_header_id,
               t1.lend_number,
               t1.borrower_id,
               t1.borrower_id_n,
               t1.borrower_name
          From document_lend_record_hd_lv t1, con_doc_lend_record_ln ln
         Where t1.lend_header_id = ln.lend_header_id
         and ln.contract_id = ${@contract_id}

]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="borrower_phone" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BORROWER_PHONE"/>
        <bm:field name="borrower_date" databaseType="DATE" datatype="java.util.Date" physicalName="BORROWER_DATE"/>
        <bm:field name="lender_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LENDER_NAME"/>
        <bm:field name="borrow_to" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BORROW_TO"/>
        <bm:field name="borrow_to_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BORROW_TO_N"/>
        <bm:field name="unit_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNIT_ID"/>
        <bm:field name="apply_date" databaseType="DATE" datatype="java.util.Date" physicalName="APPLY_DATE"/>
        <bm:field name="send_date" databaseType="DATE" datatype="java.util.Date" physicalName="SEND_DATE"/>
        <bm:field name="send_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SEND_NUMBER"/>
        <bm:field name="reader_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="READER_NAME"/>
        <bm:field name="back_date" databaseType="DATE" datatype="java.util.Date" physicalName="BACK_DATE"/>
        <bm:field name="back_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BACK_NUMBER"/>
        <bm:field name="promise_date" databaseType="DATE" datatype="java.util.Date" physicalName="PROMISE_DATE"/>
        <bm:field name="real_date" databaseType="DATE" datatype="java.util.Date" physicalName="REAL_DATE"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS"/>
        <bm:field name="status_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS_N"/>
        <bm:field name="borrow_reason" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BORROW_REASON"/>
        <bm:field name="send_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SEND_FLAG"/>
        <bm:field name="send_flag_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SEND_FLAG_N"/>
        <bm:field name="track_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRACK_NUMBER"/>
        <bm:field name="recipient" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RECIPIENT"/>
        <bm:field name="return_mark" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RETURN_MARK"/>
        <bm:field name="return_send_flag" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="RETURN_SEND_FLAG"/>
        <bm:field name="return_send_flag_n" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="RETURN_SEND_FLAG_N"/>
        <bm:field name="return_recipient" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="RETURN_RECIPIENT"/>
        <bm:field name="return_track_number" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="RETURN_TRACK_NUMBER"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CONTRACT_NUMBER"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
        <bm:field name="agent_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="AGENT_NAME"/>
        <bm:field name="lend_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEND_HEADER_ID"
                  required="true"/>
        <bm:field name="lend_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEND_NUMBER"/>
        <bm:field name="borrower_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BORROWER_ID"/>
        <bm:field name="borrower_id_n" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BORROWER_ID_N"/>
        <bm:field name="borrower_name" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BORROWER_NAME"/>
    </bm:fields>
</bm:model>
