<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-5-6 下午3:03:36  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CSH_BANK">
    <bm:fields>
        <bm:field name="bank_id" databaseType="NUMBER" datatype="java.lang.Double" insertExpression="csh_bank_s.nextval" physicalName="BANK_ID" prompt="CSH_BANK.BANK_ID"/>
        <bm:field name="bank_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_CODE" prompt="HLS.BANK_CODE"/>
        <bm:field name="bank_short_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_SHORT_NAME" prompt="HLS.BANK_SHORT_NAME"/>
        <bm:field name="bank_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_TYPE"/>
        <bm:field name="bank_type_name" forInsert="false" forUpdate="false" prompt="HLS.BANK_TYPE"/>
        <bm:field name="bank_full_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_FULL_NAME" prompt="HLS.BANK_FULL_NAME"/>
        <bm:field name="zero_amounts_allowed" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ZERO_AMOUNTS_ALLOWED" prompt="CSH101.CSH_BANK.ZERO_AMOUNTS_ALLOWED"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.bank_id,
    			       t1.bank_code,
				       t1.bank_short_name,
				       t1.bank_type,
				       t1.bank_type_name,
				       t1.bank_full_name,
				       t1.zero_amounts_allowed,
				       t1.enabled_flag
				  from csh_bank_v t1
				  #WHERE_CLAUSE#
				 order by t1.bank_code
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="bank_id" input="false" output="true" outputPath="@bank_id"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
        		begin
				  CSH101_SAVE_PKG.bank_manage(p_sql_type			 => 'INSERT',
				  							  p_bank_id              => ${@bank_id},
								              p_bank_code            => ${@bank_code},
								              p_bank_type            => ${@bank_type},
								              p_bank_short_name      => ${@bank_short_name},
								              p_bank_full_name       => ${@bank_full_name},
								              p_zero_amounts_allowed => ${@zero_amounts_allowed},
								              p_enabled_flag         => ${@enabled_flag},
								              p_user_id              => ${/session/@user_id});
				end;
        	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
        		begin
				  CSH101_SAVE_PKG.bank_manage(p_sql_type			 => 'UPDATE',
				  							  p_bank_id              => ${@bank_id},
								              p_bank_code            => ${@bank_code},
								              p_bank_type            => ${@bank_type},
								              p_bank_short_name      => ${@bank_short_name},
								              p_bank_full_name       => ${@bank_full_name},
								              p_zero_amounts_allowed => ${@zero_amounts_allowed},
								              p_enabled_flag         => ${@enabled_flag},
								              p_user_id              => ${/session/@user_id});
				end;
        	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
        		begin
				  CSH101_SAVE_PKG.bank_manage(p_sql_type			 => 'DELETE',
				  							  p_bank_id              => ${@bank_id},
								              p_bank_code            => ${@bank_code},
								              p_bank_type            => ${@bank_type},
								              p_bank_short_name      => ${@bank_short_name},
								              p_bank_full_name       => ${@bank_full_name},
								              p_zero_amounts_allowed => ${@zero_amounts_allowed},
								              p_enabled_flag         => ${@enabled_flag},
								              p_user_id              => ${/session/@user_id});
				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="bank_id"/>
    </bm:primary-key>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="CSH101.ERROR.BANK_CODE_REPEATED"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
