<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wqw  
    $Date: 2013-1-22 下午4:53:26  
    $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
                    v.*
                    
                FROM
                    (SELECT DISTINCT
                        tc.TABLE_NAME,
                        tc.COLUMN_NAME,
                        tc.DATA_TYPE,
                        tc.DATA_LENGTH,
                        tc.DATA_PRECISION,
                        (SELECT
                        p.comments
                    FROM
                        user_col_comments p
                    WHERE
                        tc.table_name  = p.table_name AND
                        tc.column_name = p.column_name
                    ) comments
                    FROM
                        USER_TAB_COLS tc
                    WHERE
                        tc.TABLE_NAME = ${@table_name} AND
                        NOT EXISTS
                        (SELECT
                            1
                        FROM
                            psr_base_tables_fields tf
                        WHERE
                            tf.table_name = ${@table_name} AND
                            tf.field_name = tc.COLUMN_NAME
                        )
                    ) v #WHERE_CLAUSE#
                ORDER BY
                    COLUMN_NAME
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="table_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_NAME" required="true"/>
        <bm:field name="column_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COLUMN_NAME" required="true"/>
        <bm:field name="data_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DATA_TYPE"/>
        <bm:field name="data_length" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DATA_LENGTH" required="true"/>
        <bm:field name="data_precision" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DATA_PRECISION"/>
        <bm:field name="comments" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMMENTS"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="column_name" queryOperator="like"/>
        <bm:query-field field="comments" queryOperator="like"/>
    </bm:query-fields>
</bm:model>
