<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2012-9-13 上午9:03:30  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
               select * from (SELECT t.function_id,t.image_url,t.text,t.url,t.order_field,(
                      SELECT t1.text
                      FROM ios_function_center t1
                      WHERE t1.function_id = t.parent_id
                    ) AS parent_name,t.function_type,t.parent_id
                FROM ios_function_center t CONNECT BY PRIOR t.function_id = t.parent_id START WITH t.parent_id IS null)
                #WHERE_CLAUSE#
                order by order_field
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
            begin
            	ios_function_maintain_pkg.insert_ios_function_center(p_image_url => ${@image_url},
                                       p_text       => ${@text},
                                       p_url             =>${@url},
                                       p_order_field    =>${@order_field},
                                       p_parent_id       =>${@parent_id},
                                       p_function_type   =>${@function_type},
                                       p_created_by      =>${/session/@user_id},
                                       p_last_updated_by =>${/session/@user_id});
            end;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                BEGIN
                    ios_function_maintain_pkg.update_ios_function_center(p_function_id => ${@function_id},
                                                                         p_image_url => ${@image_url},
                                                                         p_text => ${@text},
                                                                         p_url => ${@url},
                                                                         p_order_field => ${@order_field},
                                                                         p_parent_id => ${@parent_id},
                                                                         p_function_type => ${@function_type},
                                                                         p_last_updated_by => ${/session/@user_id});
                END;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
                begin
                ios_function_maintain_pkg.delete_ios_function_center(
            						p_function_id => ${@function_id});
                end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="text" queryExpression="text like &apos;%&apos;||${@text}||&apos;%&apos;"/>
        <bm:query-field name="url" queryExpression="url like &apos;%&apos;||${@url}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
