<?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 * from (
                SELECT
                    hacc.config_id,
                    hacc.function_code,
                    hacc.function_description,
                    hacc.document_category,
                    hdc.description document_category_desc,
                    hacc.approval_method,
                    (SELECT
                        v.code_value_name
                    FROM
                        sys_code_values_v v
                    WHERE
                        v.code       = 'HLS003_APPROVAL_METHOD' AND
                        v.code_value = hacc.approval_method
                    ) approval_method_desc,
                    hacc.workflow_id,
                    (SELECT
                        zww.workflow_desc
                    FROM
                        zj_wfl_workflow zww
                    WHERE
                        zww.workflow_id = hacc.workflow_id
                    ) workflow_desc,
                    hacc.enabled_flag,
                    (SELECT
                        v.code_value_name
                    FROM
                        sys_code_values_v v
                    WHERE
                        v.code       = 'YES_NO' AND
                        v.code_value = hacc.enabled_flag) enabled_flag_desc,
                    hacc.table_name,
                    hacc.screen_id,
                    hacs.screen_url,
                    hacs.url_desc
                FROM
                    hn_atm_complement_config hacc,
                    hn_atm_complement_screen hacs,
                    hls_document_category hdc
                WHERE
                    hacc.screen_id         = hacs.screen_id(+) AND
                    hacc.document_category = hdc.document_category
                    ) tt #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
            begin
            hn_atm_complement_pkg.hn_atm_complement_config_ins(p_function_code =>${@function_code},
                                         p_function_description =>${@function_description},
                                         p_document_category    =>${@document_category},
                                         p_approval_method      =>${@approval_method},
                                         p_workflow_id          =>${@workflow_id},
                                         p_enabled_flag         =>${@enabled_flag},
                                         p_table_name           =>${@table_name},
                                         p_screen_id            =>${@screen_id},
                                         p_user_id              =>${/session/@user_id});
            end;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            begin
            hn_atm_complement_pkg.hn_atm_complement_config_upd(p_config_id =>${@config_id},
                                         p_function_description =>${@function_description},
                                         p_approval_method      =>${@approval_method},
                                         p_workflow_id          =>${@workflow_id},
                                         p_enabled_flag         =>${@enabled_flag},
                                         p_table_name           =>${@table_name},
                                         p_screen_id            =>${@screen_id},
                                         p_user_id              =>${/session/@user_id});
            end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="enabled_flag_desc" queryExpression="tt.enabled_flag = ${@enabled_flag}"/>
        <bm:query-field name="document_category_desc" queryExpression="tt.document_category = ${@document_category}"/>
        <bm:query-field name="function_code_desc" queryExpression="tt.function_code = ${@function_code}"/>
        <bm:query-field name="function_description" queryExpression="tt.function_description like &apos;%&apos;||${@function_description}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
