写一段代码,实现银行转帐功能:
接口定义如下:
Public interface ITransfer{
/**
* 银行内部转帐,从转出帐号中扣除转帐金额,给转入帐号增加转帐金额,需要保证以上两个操作
* 要么同时成功,要么同时失败
* fromAccountId 转出帐号
* outAccountId 转入帐号
* amount 转帐金额
**/
Public void transferInner(String fromAccountId,String outAccountId,
BigDecimal amount);
/**
* 外部转帐-转出,从转出帐号中扣除转帐金额
* fromAccountId 转出帐号
* amount 转帐金额
**/
Public void transferOut(String fromAccountId,BigDecimal amount);
/**
* 外部转帐-转入,给转入帐号增加转帐金额
* toAccountId 转入帐号
* amount 转帐金额
Public void transerIn (String toAccountId, BigDecimal amount);
}
请编写你的实现类,来实现上述接口
Account 表
字段:accountId , 主键 varchar2(32), 用户帐号
字段:amount , 金额 number(18,3)