-- 客户账户资金流水 CREATE TABLE IF NOT EXISTS `t_customer_account_flow` ( `Id` int NOT NULL AUTO_INCREMENT, `CustomerId` int NOT NULL COMMENT '客户 ID', `SerialNumber` varchar(64) NOT NULL COMMENT '流水号', `BizType` varchar(32) NOT NULL COMMENT '业务类型 recharge/orderPay', `BizId` int DEFAULT NULL COMMENT '关联业务主键', `BizNo` varchar(64) DEFAULT NULL COMMENT '关联业务单号', `Amount` decimal(18,2) NOT NULL COMMENT '变动金额,正入账负出账', `BalanceBefore` decimal(18,2) NOT NULL COMMENT '变动前余额', `BalanceAfter` decimal(18,2) NOT NULL COMMENT '变动后余额', `Currency` varchar(8) NOT NULL DEFAULT 'CNY' COMMENT '币种', `Remark` varchar(512) DEFAULT NULL COMMENT '备注', `IsDeleted` tinyint(1) NOT NULL DEFAULT '0', `ConcurrencyStamp` char(36) NOT NULL DEFAULT (UUID()) COMMENT '并发戳', `CreateUserId` int NOT NULL DEFAULT '0', `CreateTime` datetime NOT NULL, `UpdateUserId` int DEFAULT NULL, `UpdateTime` datetime DEFAULT NULL, PRIMARY KEY (`Id`), UNIQUE KEY `uk_customer_account_flow_serial` (`SerialNumber`), KEY `idx_customer_account_flow_customer_time` (`CustomerId`, `CreateTime`), KEY `idx_customer_account_flow_biz` (`BizType`, `BizId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户账户资金流水';