<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features">
    <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="id_card_no" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="address_on_resident_booklit" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="living_address" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="cell_phone" databaseType="VARCHAR2" datatype="java.lang.String"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
select * from (select t2.contract_id,
       t1.id_card_no,
       t1.bp_name,
       decode(t1.bp_class,
              'NP',
              t1.address_on_resident_booklit,
              t1.registered_place) as address_on_resident_booklit,
       decode(t1.bp_class, 'NP', t1.living_address, t1.working_address) as living_address,
       t1.cell_phone
  from hls_bp_master t1, con_contract_bp_lv t2
 where t1.bp_id = t2.bp_id
   and t2.bp_category = 'TENANT') t5 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
