<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2014-11-24 下午06:07:14  
    $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_CONTRACT_V" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    cc.*,
                    (SELECT
                        lc.description
                    FROM
                        hls_lease_channel lc
                    WHERE
                        lc.lease_channel = cc.lease_channel
                    ) AS hls_lease_channel_desc,
                    (SELECT
                        docu_number
                    FROM
                        CON_CONTRACT_LOCATION_LN c
                    WHERE
                        c.contract_id=cc.contract_id AND
                        c.doc_type   ='20'
                    ) AS docu_number_reg,
                    (SELECT
                        docu_number
                    FROM
                        CON_CONTRACT_LOCATION_LN c
                    WHERE
                        c.contract_id=cc.contract_id AND
                        c.doc_type   ='10'
                    ) AS docu_numberr_archive
                FROM
                    CON_CONTRACT_V cc
                WHERE
                    cc.contract_id IN
                    (SELECT
                        ydlrl.contract_id
                    FROM
                        YONDA_DOCUMENT_LEND_RECORD_LN ydlrl
                    WHERE
                        ydlrl.lend_header_id = ${@lend_header_id}
                    )
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <!-- <bm:data-filters>
        <bm:data-filter name="lend_header_id" expression="t1.lend_header_id=${@lend_header_id}"/>
    </bm:data-filters> -->
</bm:model>
