<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qm  
    $Date: 2014-5-20 上午10:30:16  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="contract_id"/>
        <bm:field name="guarantor_name"/>
        <bm:field name="id_card_no"/>
        <bm:field name="address_on_id"/>
        <bm:field name="address_on_resident_booklit"/>
        <bm:field name="cell_phone"/>
        <bm:field name="phone"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select * from(select 
            rownum as row_num,t3.*
  			from ( select 	t2.contract_id,
               				t1.bp_name as guarantor_name,-- 担保人
               				t1.id_card_no,-- 身份证号码
               				t1.address_on_id,-- 身份地址
               				t1.address_on_resident_booklit,-- 本市地址
               				t1.cell_phone,-- 手机号
               				t1.phone-- 工作电话
          			from 	hls_bp_master t1, con_contract_bp_lv t2
         			where 	t1.bp_id = t2.bp_id
               				--and t1.id_type = 'ID_CARD'-- 筛选身份证，其它证件请维护此条件
           					and t2.bp_category = 'GUARANTOR') t3 #WHERE_CLAUSE#)
           					where row_num = 1
           ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
