<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: sf
    $Date: 2019-12-2 下午02:32:50
    $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 t1.unit_id,
                   t1.bp_code,
                   t1.enabled_flag,
                   t1.bp_category,
                   t1.bp_name
              FROM hls_bp_master t1
              WHERE
                 t1.bp_category='TENANT'
                 and t1.unit_id IN (
                  SELECT v.unit_id
                    FROM exp_emp_assign_e_v v
                    WHERE v.user_id=${/session/@user_id}
                   )
                   ) v #WHERE_CLAUSE#

  			]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="unit_id" displayWidth="200"/>
        <bm:field name="bp_code" displayWidth="150" forDisplay="true" forQuery="true" prompt="商业伙伴编码"/>
        <bm:field name="bp_name" displayWidth="200" forDisplay="true" forQuery="true" prompt="商业伙伴名称"/>
        <bm:field name="enabled_flag"/>
        <bm:field name="bp_category"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="bp_code" queryOperator="like"/>
        <bm:query-field field="bp_name" queryOperator="like"/>
        <bm:query-field field="bp_category" queryOperator="like"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="v.enabled_flag=&apos;Y&apos;"/>
    </bm:data-filters>
</bm:model>
