<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-5-21 下午4:08:01  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="GLD_JE_TEMPLATE_DTL_CON_HD">
    <bm:fields>
        <bm:field name="config_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONFIG_ID"/>
        <bm:field name="table_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_NAME"/>
        <bm:field name="function_symbol_1" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FUNCTION_SYMBOL_1" prompt="GLD107.GLD_JE_TEMPLATE_DTL_CON_HD.FUNCTION_SYMBOL"/>
        <bm:field name="mutil_row_function_symbol_1" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MUTIL_ROW_FUNCTION_SYMBOL_1"/>
        <bm:field name="table_column_1" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_COLUMN_1"/>
        <bm:field name="function_symbol_2" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FUNCTION_SYMBOL_2"/>
        <bm:field name="mutil_row_function_symbol_2" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MUTIL_ROW_FUNCTION_SYMBOL_2"/>
        <bm:field name="table_column_2" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_COLUMN_2"/>
        <bm:field name="function_symbol_3" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FUNCTION_SYMBOL_3" prompt="GLD107.GLD_JE_TEMPLATE_DTL_CON_HD.FUNCTION_SYMBOL"/>
        <bm:field name="mutil_row_function_symbol_3" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MUTIL_ROW_FUNCTION_SYMBOL_3"/>
        <bm:field name="table_column_3" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_COLUMN_3"/>
        <bm:field name="table_name_desc" forInsert="false" forUpdate="false" prompt="GLD107.GLD_JE_TEMPLATE_DTL_CON_HD.TABLE_NAME"/>
        <bm:field name="table_column_1_desc" forInsert="false" forUpdate="false" prompt="GLD107.GLD_JE_TEMPLATE_DTL_CON_HD.TABLE_COLUMN"/>
        <bm:field name="table_column_2_desc" forInsert="false" forUpdate="false" prompt="GLD107.GLD_JE_TEMPLATE_DTL_CON_HD.TABLE_COLUMN"/>
        <bm:field name="table_column_3_desc" forInsert="false" forUpdate="false" prompt="GLD107.GLD_JE_TEMPLATE_DTL_CON_HD.TABLE_COLUMN"/>
        <bm:field name="tab_col_desc_format_1" forInsert="false" forUpdate="false"/>
        <bm:field name="tab_col_desc_format_2" forInsert="false" forUpdate="false"/>
        <bm:field name="tab_col_desc_format_3" forInsert="false" forUpdate="false"/>
        <bm:field name="je_transaction_code" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			SELECT t1.CONFIG_ID,
				       t1.TABLE_NAME,
				       TAB.TABLE_DESC as table_name_desc,
				       t1.FUNCTION_SYMBOL_1,
				       t1.MUTIL_ROW_FUNCTION_SYMBOL_1,
				       t1.TABLE_COLUMN_1,
				       t1.FUNCTION_SYMBOL_2,
				       t1.MUTIL_ROW_FUNCTION_SYMBOL_2,
				       t1.TABLE_COLUMN_2,
				       t1.FUNCTION_SYMBOL_3,
				       t1.MUTIL_ROW_FUNCTION_SYMBOL_3,
				       t1.TABLE_COLUMN_3,
				       col1.column_desc               as table_column_1_desc,
				       col2.column_desc               as table_column_2_desc,
				       col3.column_desc               as table_column_3_desc,
				       col1.tab_col_desc_format       as tab_col_desc_format_1,
				       col2.tab_col_desc_format       as tab_col_desc_format_2,
				       col3.tab_col_desc_format       as tab_col_desc_format_3,
				       tab.je_transaction_code
				  from GLD_JE_TEMPLATE_DTL_CON_HD t1,
				       gld_je_trx_tables          tab,
				       GLD_JE_TRX_TAB_COLUMNS_V   col1,
				       GLD_JE_TRX_TAB_COLUMNS_V   col2,
				       GLD_JE_TRX_TAB_COLUMNS_V   col3
				 where t1.config_id=${@config_id}
				   and tab.je_transaction_code(+) = ${@je_transaction_code}
				   and tab.table_name(+) = t1.table_name
				   and col1.je_transaction_code(+) = ${@je_transaction_code}
				   and col1.table_name(+) = t1.table_name
				   AND col1.table_column(+) = t1.TABLE_COLUMN_1
				   and col2.je_transaction_code(+) = ${@je_transaction_code}
				   and col2.table_name(+) = t1.table_name
				   AND col2.table_column(+) = t1.TABLE_COLUMN_2
				   and col3.je_transaction_code(+) = ${@je_transaction_code}
				   and col3.table_name(+) = t1.table_name
				   AND col3.table_column(+) = t1.TABLE_COLUMN_3
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="config_id" input="false" output="true" outputPath="@config_id"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
            	begin
				
				 GLD104_SAVE_PKG.configColumn_manage(p_sql_type                    => 'INSERT',
							                                     p_source_type                 => ${@source_type},
							                                     p_source_column               => ${@source_column},
							                                     p_source_id                   => ${@source_id},
							                                     p_je_transaction_code         => ${@je_transaction_code},
							                                     p_config_id                   => ${@config_id},
							                                     p_config_desc				   => ${@config_desc},
							                                     p_function_symbol_1           => ${@function_symbol_1},
										                         p_table_name                  => ${@table_name},
										                         p_table_column_1              => ${@table_column_1},
										                         p_mutil_row_function_symbol_1 => ${@mutil_row_function_symbol_1},
										                         p_user_id                     => ${/session/@user_id},
										                         p_function_symbol_2           => ${@function_symbol_2},
										                         p_mutil_row_function_symbol_2 => ${@mutil_row_function_symbol_2},
										                         p_table_column_2              => ${@table_column_2},
										                         p_mutil_row_function_symbol_3 => ${@mutil_row_function_symbol_3},
										                         p_table_column_3              => ${@table_column_3},
										                         p_function_symbol_3           => ${@function_symbol_3});
				end;
            	
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:parameters>
                <bm:parameter name="config_id" input="true" output="true" outputPath="@config_id"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
            	begin
				
				 GLD104_SAVE_PKG.configColumn_manage(p_sql_type                    => 'UPDATE',
							                                     p_source_type                 => ${@source_type},
							                                     p_source_column               => ${@source_column},
							                                     p_source_id                   => ${@source_id},
							                                     p_je_transaction_code         => ${@je_transaction_code},
							                                     p_config_id                   => ${@config_id},
							                                     p_config_desc				   => ${@config_desc},
							                                     p_function_symbol_1           => ${@function_symbol_1},
										                         p_table_name                  => ${@table_name},
										                         p_table_column_1              => ${@table_column_1},
										                         p_mutil_row_function_symbol_1 => ${@mutil_row_function_symbol_1},
										                         p_user_id                     => ${/session/@user_id},
										                         p_function_symbol_2           => ${@function_symbol_2},
										                         p_mutil_row_function_symbol_2 => ${@mutil_row_function_symbol_2},
										                         p_table_column_2              => ${@table_column_2},
										                         p_mutil_row_function_symbol_3 => ${@mutil_row_function_symbol_3},
										                         p_table_column_3              => ${@table_column_3},
										                         p_function_symbol_3           => ${@function_symbol_3});
				end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
            	begin
				
				 GLD104_SAVE_PKG.configColumn_manage(p_sql_type                    => 'DELETE',
							                                     p_source_type                 => ${@source_type},
							                                     p_source_column               => ${@source_column},
							                                     p_source_id                   => ${@source_id},
							                                     p_je_transaction_code         => ${@je_transaction_code},
							                                     p_config_id                   => ${@config_id},
							                                     p_config_desc				   => ${@config_desc},
							                                     p_function_symbol_1           => ${@function_symbol_1},
										                         p_table_name                  => ${@table_name},
										                         p_table_column_1              => ${@table_column_1},
										                         p_mutil_row_function_symbol_1 => ${@mutil_row_function_symbol_1},
										                         p_user_id                     => ${/session/@user_id},
										                         p_function_symbol_2           => ${@function_symbol_2},
										                         p_mutil_row_function_symbol_2 => ${@mutil_row_function_symbol_2},
										                         p_table_column_2              => ${@table_column_2},
										                         p_mutil_row_function_symbol_3 => ${@mutil_row_function_symbol_3},
										                         p_table_column_3              => ${@table_column_3},
										                         p_function_symbol_3           => ${@function_symbol_3});
				end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="config_id"/>
    </bm:primary-key>
</bm:model>
