<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lpc
    $Date: 2018-9-4 下午4:10:21
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="update">
            <bm:parameters>
                <bm:parameter name="loan_contract_number" input="true" output="false" outputPath="@loan_contract_number"/>
                <bm:parameter name="loan_contract_term_type" input="true" output="false" outputPath="@loan_contract_term_type"/>
                <bm:parameter name="v_loan_contract_number" input="false" output="true" outputPath="@v_loan_contract_number"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
                BEGIN
                    SELECT
                        regexp_replace(SUBSTR(${@loan_contract_number}, 0, 4)
                        || DECODE(${@loan_contract_term_type}, '10', 'DGL','20','DSL','30','DFS','40','DFL')
                        || SUBSTR(${@loan_contract_number}, -3), '[0-9]', '', 2, 1)
                    INTO
                        ${@v_loan_contract_number}
                    FROM
                        dual;
                END;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
