3. 对于Table_AccountTransaction中的AccountTransactionType_ID字段对应新增表Table_AccountTransactionType中的记录。
Table_AccountTransactionType字段
列名 |
解释 |
AccountTransactionType_ID |
Identity字段 |
AccountTransactionType_InOutFlag |
0为支付,1为充值 |
AccountTransactionType_Name |
账户流水类型名: |
AccountTransactionType_Description |
账户流水类型描述 |
4. 增加Table_PaymentApplication表,这张表建立了Order与AccountTransaction之间的多对多关系。
Table_PaymentApplication字段
列名 |
解释 |
PaymentApplication_ID |
Identity字段 |
Order_ID |
订单ID,外键 |
AccountTransaction_ID |
账户流水ID,外键 |
PaymentApplication_Amount |
支付金额 |
PaymentApplication_Date |
支付日期 |
加入支付管理功能后的表关系图
其中用红色标出了新增加的表,用黄色标出了新增加的列。
注意:
1. 一般在一个表中有金额字段时,我都会加一个对应的Currency字段来表示货币类型。在这次新增的Table_AccountTransaction和Table_PaymentApplication中虽有金额字段,但没有对应的Currency字段,这是因为我默认这些记录的Currency与Table_Customer表中新增的Customer_AccountCurrency一致。大家可以根据需要加上Currency字段。
2. 这个支付管理的设计我总感觉不是最好,就如上文解决方案中所说的。我试图给出了另一种设计(增加Table_Payment表,用以记录用户的支付来源,如信用卡信息等。简化Table_AccountTransaction表,只保留金额与时间,对于充值记录对应Table_Payment的ID。对于Table_PaymentApplication,可能有两种来源一种是直接的Payment,对应Table_Payment记录,另一种是用户Account,对应Table_AccountTransaction记录),但也并不满意。大家可以进行更多的尝试,并欢迎分享。