<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang
    $Date: 2013-6-18 下午3:47:27  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="HLS_DOC_LAYOUT_TAB" defaultOrderBy="tab_seq">
    <bm:fields>
        <bm:field name="layout_code" databaseType="VARCHAR2" datatype="java.lang.String" forUpdate="false" physicalName="LAYOUT_CODE" prompt="HLS030.HLS_DOC_LAYOUT.LAYOUT_CODE"/>
        <bm:field name="tab_code" databaseType="VARCHAR2" datatype="java.lang.String" forUpdate="false" physicalName="TAB_CODE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_CODE"/>
        <bm:field name="tab_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAB_DESC" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_DESC"/>
        <bm:field name="tab_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TAB_SEQ" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_SEQ"/>
        <bm:field name="tab_group" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TAB_GROUP" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_GROUP"/>
        <bm:field name="base_table" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BASE_TABLE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.BASE_TABLE"/>
        <bm:field name="query_source" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_SOURCE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.QUERY_SOURCE"/>
        <bm:field name="row_count" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="" physicalName="ROW_COUNT" prompt="HLS030.HLS_DOC_LAYOUT_TAB.ROW_COUNT"/>
        <bm:field name="column_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COLUMN_COUNT" prompt="HLS030.HLS_DOC_LAYOUT_TAB.COLUMN_COUNT"/>
        <bm:field name="field_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FIELD_WIDTH" prompt="HLS030.HLS_DOC_LAYOUT_TAB.FIELD_WIDTH"/>
        <bm:field name="label_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LABEL_WIDTH" prompt="HLS030.HLS_DOC_LAYOUT_TAB.LABEL_WIDTH"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
        <bm:field name="configurable" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONFIGURABLE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.CONFIGURABLE"/>
        <bm:field name="margin_top" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MARGIN_TOP" prompt="HLS030.HLS_DOC_LAYOUT_TAB.MARGIN_TOP"/>
        <bm:field name="margin_height" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MARGIN_HEIGHT" prompt="HLS030.HLS_DOC_LAYOUT_TAB.MARGIN_HEIGHT"/>
        <bm:field name="margin_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MARGIN_WIDTH" prompt="HLS030.HLS_DOC_LAYOUT_TAB.MARGIN_WIDTH"/>
        <bm:field name="box_width" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BOX_WIDTH" prompt="HLS030.HLS_DOC_LAYOUT_TAB.BOX_WIDTH"/>
        <bm:field name="show_box" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SHOW_BOX" prompt="HLS030.HLS_DOC_LAYOUT_TAB.SHOW_BOX"/>
        <bm:field name="parent_tab_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_TAB_CODE"/>
        <bm:field name="tab_type" databasetype="VARCHAR2" datatype="java.lang.String" physicalname="TAB_TYPE"/>
        <bm:field name="base_table_pk" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="BASE_TABLE_PK"/>
        <bm:field name="parent_table" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_TABLE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.PARENT_TABLE"/>
        <bm:field name="parent_tab_code_flag" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_TAB_CODE_FLAG"/>
        <bm:field name="parent_table_flag" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_TABLE_FLAG"/>
        <bm:field name="ref_tab_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_TAB_CODE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.REF_TAB_CODE"/>
        <bm:field name="tab_ref_screen" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAB_REF_SCREEN" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_REF_SCREEN"/>
        <bm:field name="width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WIDTH"/>
        <bm:field name="height" databaseType="NUMBER" datatype="java.lang.Long" physicalName="HEIGHT"/>
        <bm:field name="parent_base_table_pk" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_BASE_TABLE_PK"/>
        <bm:field name="parent_table_tab_code" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_TABLE_TAB_CODE"/>
        <bm:field name="form_binder_tab_code" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="FORM_BINDER_TAB_CODE"/>
        <bm:field name="attachment_tab_group" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="ATTACHMENT_TAB_GROUP"/>
        <bm:field name="query_only" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_ONLY"/>
        <bm:field name="fetchall" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="FETCHALL"/>
        <bm:field name="query_tab_code" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_TAB_CODE"/>
        <bm:field name="query_base_table" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_BASE_TABLE"/>
        <bm:field name="check_before_delete_bm" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="CHECK_BEFORE_DELETE_BM"/>
        <bm:field name="check_after_save_bm" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="CHECK_AFTER_SAVE_BM"/>
        <bm:field name="switchcard_value" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="SWITCHCARD_VALUE"/>
        <bm:field name="query_bp_category" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_BP_CATEGORY"/>
        <bm:field name="query_bp_category_name" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_BP_CATEGORY_NAME"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.layout_code,
                    t1.tab_code,
                    DECODE(t1.parent_tab_code_flag,'Y',t1.tab_code,t1.parent_table_tab_code) form_binder_tab_code,
                    t1.tab_desc,
                    t1.tab_seq,
                    t1.tab_group,
                    lower(t1.base_table) base_table,
                    t1.query_source,
                    t1.row_count,
                    t1.column_count,
                    t1.enabled_flag,
                    t1.created_by,
                    t1.creation_date,
                    t1.last_updated_by,
                    t1.last_update_date,
                    t1.configurable,
                    t1.field_width,
                    t1.label_width,
                    t1.margin_top,
                    t1.box_width,
                    t1.show_box,
                    t1.parent_tab_code,
                    lower(t1.parent_table) parent_table,
                    t1.base_table_pk,
                    t1.parent_table_tab_code,
                    t1.parent_base_table_pk,
                    t1.tab_type,
                    t1.parent_tab_code_flag,
                    t1.parent_table_flag,
                    t1.ref_tab_code,
                    t1.tab_ref_screen,
                    t1.margin_width,
                    t1.width,
                    t1.margin_height,
                    t1.height,
                    t1.attachment_tab_group,
                    t1.query_only,
                    t1.fetchall,
                    t1.query_tab_code,
                    t1.query_base_table,
                    t1.check_before_delete_bm,
                    t1.check_after_save_bm,
                    t1.switchcard_value,
                    t1.query_bp_category,
                    (SELECT
                        bc.description
                    FROM
                        hls_bp_category bc
                    WHERE
                        bc.bp_category=t1.query_bp_category
                    ) query_bp_category_name
                FROM
                    hls_con_layout_tab_v t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field field="tab_code" queryOperator="="/>
        <bm:query-field field="parent_table" queryOperator="="/>
        <bm:query-field field="parent_tab_code" queryOperator="="/>
        <!-- <bm:query-field field="enabled_flag" queryOperator="="/> -->
        <bm:query-field name="virtual_parent_flag" queryExpression="(t1.base_table is not null and t1.parent_table is null)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.layout_code=${@layout_code} and t1.enabled_flag=&apos;Y&apos;"/>
    </bm:data-filters>
</bm:model>
