<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: 王建文  
    $Date: 2017-3-6 下午7:49:17  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
              SELECT
                    opv.DESCRIPTION position_n,
                    eou.DESCRIPTION department_n,
                    fov.company_short_name company_n,
                    s.description name_n,
                    e.email,
                    e.phone,
                    fov.address
                FROM
                    Exp_Org_Position_Vl opv,
                    exp_org_unit_vl eou,
                    fnd_companies_vl fov,
                    sys_user s,
                    exp_employee_assigns eea,
                    exp_org_position eop,
                    exp_employees e
                WHERE
                    s.employee_id   = eea.employee_id AND
                    eea.company_id  = fov.company_id AND
                    s.user_id       = ${@user_id} AND
                    eea.position_id = eop.position_id AND
                    eop.unit_id     = eou.UNIT_ID AND
                    eea.position_id = opv.POSITION_ID AND
                    s.employee_id   =e.employee_id
                    
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="position_n" databaseType="VARCHAR" datatype="java.lang.String" physicalName="POSITION_N"/>
        <bm:field name="department_n" databaseType="VARCHAR" datatype="java.lang.String" physicalName="DEPARTMENT_N"/>
        <bm:field name="company_n" databaseType="VARCHAR" datatype="java.lang.String" physicalName="COMPANY_N"/>
        <bm:field name="name_n" databaseType="VARCHAR" datatype="java.lang.String" physicalName="NAME_N"/>
        <bm:field name="email" databaseType="VARCHAR" datatype="java.lang.String" physicalName="EMAIL"/>
        <bm:field name="phone" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PHONE"/>
        <bm:field name="address" databaseType="VARCHAR" datatype="java.lang.String" physicalName="ADDRESS"/>
    </bm:fields>
</bm:model>
