<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select e.employee_id, e.employee_code, e.name from exp_employees e #WHERE_CLAUSE#
            order by employee_code
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="employee_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_ID"/>
        <bm:field name="employee_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EMPLOYEE_CODE" prompt="EXP_EMPLOYEES_VL.EMPLOYEE_CODE"/>
        <bm:field name="name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NAME" prompt="EXP_EMPLOYEES_VL.DESC"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="employee_code" queryExpression="employee_code like ${@employee_code}"/>
        <bm:query-field field="name" queryExpression="name like ${@name}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression=" (exists (select 1 from exp_org_position  p, exp_employee_assigns s where p.unit_id = nvl(${@unit_id},p.unit_id)  and p.position_id = nvl(${@position_id}, p.position_id) and s.position_id = p.position_id and s.employee_id = e.employee_id and s.company_id = nvl(${@company_id},s.company_id)))"/>
    </bm:data-filters>
</bm:model>
