sys_account.md 4.4 KB

系统银行记录表

伞形账户的主账户 由is_main判断, 主账户 有多个子账户

伞形账户的子账户的pid关联当前银行记录表的主账户 open_at :开户时间

is_main :是否主账户,主账户关联本表的一个或多个子账户

pid` int DEFAULT '0' COMMENT '子账户所关联的父账户id

bank_code : 所属银行的代码 关联银行记录bank.bank_code

bank_name :所属银行的名称 关联银行记录bank.bank_name

country :账户所属的国家/地区 如中国,来自area.area

province:账户所属的省/州 如广东省, 来自area.area

city:账户所属的省/州 如深圳市, 来自area.area

area : 账户所属的区域 如南山区, 来自area.area

postal_code : 关联区域的邮政编码area.postal_code

swift_code :国际结算系统中编号

CREATE TABLE `sys_account` (
    `id` int NOT NULL AUTO_INCREMENT,
    `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `deleted_at` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    `open_at` datetime DEFAULT NULL COMMENT '开户时间',
    `pid` int DEFAULT '0' COMMENT '子账户所关联的父账户id',
    `is_main` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否主账户{ 1:是 ,2:子账户}',
    `bank_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '银行名称',
    `bank_mer_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '银行商户号',
    `bank_account_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '在银行的账户号',
    `bank_no` varchar(32) DEFAULT NULL COMMENT '银行号',
    `bank_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '银行代码',
    `bank_branch_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '分行代码',
    `account_num` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户编号',
    `account_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户名称',
    `account_name_en` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户名 英文',
    `country` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账户所属的国家/地区 如中国',
    `province` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的省/州 如广东省',
    `city` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的省/州 如深圳市',
    `area` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的区域 如南山区',
    `address` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '详细地址',
    `postal_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮政编码',
    `swift_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'SWIFT CODE',
    `state` tinyint(1) DEFAULT NULL COMMENT '账户状态(特指本收款平台方)',
    `account_state` tinyint(1) DEFAULT NULL COMMENT '银行账户状态(特指银行方)',
    `bank_state_branc_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT 'BSB(BankStateBranch)NO',
    `path_clearing_no` varchar(32) DEFAULT NULL COMMENT '路径清算号',
    `bpay_biller_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
    `bpay_customer_ref` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
    `cnaps_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '中国现代化支付系统;',
    `zengin_no` varchar(32) DEFAULT NULL COMMENT 'zengin',
    `fedwire` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'Fedwire',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='平台的银行帐户';