<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang
    $Date: 2014-4-28 下午03:50:32
    $Revision: 1.0
    $Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" >
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select
                t1.function_group_id,
                t1.function_id,
                t1.function_code,
                t1.function_name,
                t1.enabled_flag,
                t1.layout_sequence
            from SYS_FUNCTION_GROUP_ITEM_VL t1
            #WHERE_CLAUSE#
            order by t1.layout_sequence desc
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="function_group_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FUNCTION_GROUP_ID" prompt="SYS_FUNCTION_GROUP_ITEM_VL.FUNCTION_GROUP_ID"/>
        <bm:field name="function_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FUNCTION_ID" prompt="SYS_FUNCTION_GROUP_ITEM_VL.FUNCTION_ID"/>
        <bm:field name="function_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FUNCTION_CODE" prompt="SYS_FUNCTION_GROUP_ITEM_VL.FUNCTION_CODE"/>
        <bm:field name="function_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FUNCTION_NAME" prompt="SYS_FUNCTION_GROUP_ITEM_VL.FUNCTION_NAME"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="SYS_FUNCTION_GROUP_ITEM_VL.ENABLED_FLAG"/>
        <bm:field name="layout_sequence" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LAYOUT_SEQUENCE" prompt="SYS_FUNCTION_GROUP_ITEM_VL.LAYOUT_SEQUENCE"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:query-fields>
        <!--<bm:query-field field="function_group_id" queryOperator="="/>-->
        <bm:query-field field="function_name" queryExpression="(t1.function_code = replace(${@function_name},'%','') or t1.function_name like ${@function_name})"/>
        <bm:query-field field="enabled_flag" queryOperator="="/>
        <bm:query-field name="role_id" queryExpression="t1.function_group_id in (select function_group_id from SYS_ROLE_FUNCTION_GROUP_VL where role_id = ${@role_id} and group_level = 2)"/>
    </bm:query-fields>
</bm:model>
