<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HN_COND_CHANGE_APPROVER">
    <bm:fields>
        <bm:field name="approver_record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="APPROVER_RECORD_ID" prompt="HN_COND_CHANGE_APPROVER.APPROVER_RECORD_ID"/>
        <bm:field name="approval_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="APPROVAL_ID" prompt="HN_COND_CHANGE_APPROVER.APPROVAL_ID"/>
        <bm:field name="approver_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="APPROVER_USER_ID" prompt="HN_COND_CHANGE_APPROVER.APPROVER_USER_ID"/>
        <bm:field name="approve_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="APPROVE_STATUS" prompt="HN_COND_CHANGE_APPROVER.APPROVE_STATUS"/>
        <bm:field name="approve_context" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="APPROVE_CONTEXT" prompt="HN_COND_CHANGE_APPROVER.APPROVE_CONTEXT"/>
        <bm:field name="unit_id" forInsert="false" forUpdate="false"/>
        <bm:field name="unit_code" forInsert="false" forUpdate="false"/>
        <bm:field name="unit_name" forInsert="false" forUpdate="false"/>
        <bm:field name="position_name" forInsert="false" forUpdate="false"/>
        <bm:field name="company_short_name" forInsert="false" forUpdate="false"/>
        <bm:field name="employee_code" forInsert="false" forUpdate="false" prompt="HLS.EMPLOYEE_CODE"/>
        <bm:field name="employee_name" forInsert="false" forUpdate="false" prompt="HLS.EMPLOYEE_NAME"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="approver_record_id"/>
    </bm:primary-key>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.approver_record_id,
                    t1.approval_id,
                    t1.approver_user_id,
                    t1.approve_status,
                    t1.approve_context,
                    e.employee_code,
                    e.employee_name,
                    e.unit_id,
                    e.unit_code,
                    e.unit_name,
                    t1.created_by,
                    t1.creation_date,
                    t1.last_updated_by,
                    t1.last_update_date,
                    e.position_name,
                    e.company_short_name
                FROM
                    hn_cond_change_approver t1,
                    exp_emp_assign_e_v e
                WHERE
                    e.primary_position_flag = 'Y' AND
                    t1.approver_user_id     = e.user_id AND
                    t1.approval_id          = ${@approval_id}
                    and e.user_id = nvl(${@user_id},e.user_id)
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
