<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Icon  
    $Date: 2014-10-10 上午9:22:14  
    $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 a.*, 'Y' assign_flag
          FROM fnd_companies a, hls_price_list_assign b
         WHERE a.company_id = b.company_id
           AND b.price_list = ${@price_list}
        UNION
        select a.*, 'N' assign_flag
          from fnd_companies a
         WHERE not exists
         (select 1
                  from hls_price_list_assign b
                 WHERE a.company_id = b.company_id
                   AND b.price_list = ${@price_list})) t1 
                   #WHERE_CLAUSE#
			    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="company_code" queryExpression="t1.company_code like &apos;%&apos;||${@company_code}||&apos;%&apos;"/>
        <bm:query-field name="company_short_name" queryExpression="t1.company_short_name like &apos;%&apos;||${@company_short_name}||&apos;%&apos;"/>
        <bm:query-field name="assign_flag" queryExpression="t1.assign_flag =${@assign_flag}"/>
    </bm:query-fields>
</bm:model>