<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ldd  
    $Date: 2012-8-13 下午1:10:11  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select * from (
            select v.region_code region_city_code,v.description description
			  from fnd_region_code_vl v
			 where substr(v.region_code, 1, 2) = substr(${@region_code}, 1, 2)
			   and v.region_code not in
			 (select a.region_code
			          from fnd_region_code_vl a
			         where substr(a.region_code, 1, 2) = substr(${@region_code}, 1, 2)
			           and substr(a.region_code, 3, 6) = '0000'
			           and not exists
			         (select 1
			                  from dual
			                 where (select count(1)
			                          from fnd_region_code_vl b
			                         where substr(b.region_code, 1, 2) =
			                               substr(${@region_code}, 1, 2)) = 1)))
             #WHERE_CLAUSE# 
             order by region_city_code            
                               ]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="region_city_code"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="region_city_code" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="200" forDisplay="true" forQuery="true" physicalName="REGION_CODE" prompt="FND_REGION_PROVINCE.CITY_CODE"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="200" forDisplay="true" forQuery="true" physicalName="DESCRIPTION" prompt="FND_REGION_PROVINCE.CITY_NAME"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="region_city_code" queryExpression="region_code like &apos;%&apos;||${@region_city_code}||&apos;%&apos;"/>
        <bm:query-field name="description" queryExpression="description like &apos;%&apos;||${@description}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
