<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:ns2="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="update">
            <bm:parameters>
                <bm:parameter name="session_id" dataType="java.lang.Long" output="true" outputPath="/session/@session_id"/>
                <bm:parameter name="encryted_session_id" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@encryted_session_id"/>
                <bm:parameter name="message" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@message"/>
                <bm:parameter name="user_id" dataType="java.lang.Long" input="false" output="true" outputPath="/parameter/@user_id"/>
                <bm:parameter name="role_code" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@role_code"/>
                <bm:parameter name="return_status" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@return_status"/>
                <bm:parameter name="return_message" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@return_message"/>
                <bm:parameter name="return_mobile" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@return_mobile"/>
                <bm:parameter name="return_access_token" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@return_access_token"/>
                <bm:parameter name="is_ipad" output="true" outputPath="/session/@is_ipad"/>
                <bm:parameter name="position_code" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@position_code"/>
                <bm:parameter name="unit_code" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@unit_code"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
                DECLARE
                    vsid NUMBER;
                BEGIN
                    sys_login_pkg.app_login( p_user_name =>${@user_name}, p_password =>${@user_password}, p_language =>${@user_language}, p_session_id =>vsid, p_encryted_session_id =>${@encryted_session_id}, x_return_status =>${@return_status}, x_return_message =>${@return_message}, x_return_mobile =>${@return_mobile}, x_access_token =>${@return_access_token} );
                    IF vsid != -1 THEN
                        SELECT
                            s.user_id,
                            vsid,
                            ${/parameter/@is_ipad} ,
                            sr.role_code,
                            eop.position_code,
                            eou.unit_code
                        INTO
                            ${@user_id},
                            ${@session_id},
                            ${@is_ipad},
                            ${@role_code},
                            ${@position_code},
                            ${@unit_code}
                        FROM
                            sys_session s,
                            sys_role sr,
                            exp_org_position eop,
                            exp_org_unit eou
                        WHERE
                            s.session_id  = vsid AND
                            s.role_id     = sr.role_id AND
                            s.unit_id     =eop.unit_id AND
                            s.position_id = eop.position_id AND
                            eop.unit_id   = eou.unit_id;
                    END IF;
                END;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
