<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author:  
    $Date: 2013-5-6 下午3:03:36  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:e="leaf.service.exception" xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="csh_tenant_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="bank_address" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_ADDRESS" prompt="HLS.BANK_ADDRESS"/>
        <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="spd_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SPD_FLAG" prompt="CSH101.CSH_BANK.SPD_FLAG"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
        <bm:field name="remitlocation" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REMITLOCATION" prompt="是否异地"/>
        <bm:field name="payeeaddress" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PAYEEADDRESS" prompt="银行所在省市"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="bank_code" queryExpression="t1.bank_code like &apos;%&apos; || ${@bank_code} || &apos;%&apos;"/>
        <bm:query-field field="bank_short_name" queryExpression="t1.bank_short_name like &apos;%&apos; || ${@bank_short_name} || &apos;%&apos;"/>
        <bm:query-field field="bank_type" queryOperator="="/>
        <bm:query-field field="enabled_flag" queryOperator="="/>
    </bm:query-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.bank_address,
				       t1.zero_amounts_allowed,
				       t1.spd_flag,
				       t1.enabled_flag,
				       t1.remitlocation,
				       --decode(t1.remitlocation,'0','N','1','Y') remitlocation,
				       t1.payeeaddress
				  from csh_tenant_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>
