

CREATE TABLE `credit_info` (
                               `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                               `name` varchar(1000) COLLATE utf8_unicode_ci NOT NULL COMMENT '名称',
                               `type` tinyint(1) DEFAULT NULL COMMENT '类型 0：个人 1：企业',
                               `document_type` tinyint(1) DEFAULT NULL COMMENT '证件类型',
                               `card_no` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '证件号码',
                               `phone` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '手机号码',
                               `search_date` datetime DEFAULT NULL COMMENT '最近征信查询日期',
                               `user_create` varchar(32) COLLATE utf8_unicode_ci DEFAULT '' COMMENT '创建人',
                               `user_modified` varchar(32) COLLATE utf8_unicode_ci DEFAULT '' COMMENT '修改人',
                               `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                               `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                               `card_photo` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
                               `card_rev_photo` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
                               PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='征信信息';



CREATE TABLE `credit_detail` (
                                 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                                 `credit_id` bigint(20) NOT NULL COMMENT '征信id',
                                 `auth_address` varchar(50)  DEFAULT NULL COMMENT '授权书地址',
                                 `credit_address` varchar(50)  DEFAULT NULL COMMENT '征信地址',
                                 `search_date` datetime DEFAULT NULL COMMENT '征信查询日期',
                                 `user_create` varchar(32)  DEFAULT '' COMMENT '创建人',
                                 `user_modified` varchar(32)  DEFAULT '' COMMENT '修改人',
                                 `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                 `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                 PRIMARY KEY (`id`)
) ENGINE=InnoDB  COMMENT='征信详情';


DROP TABLE IF EXISTS  `trading_platform_invoice_info`;
CREATE TABLE `trading_platform_invoice_info` (
                                                 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                                 `trading_platform_id` bigint(20) NOT NULL COMMENT '贸易平台Id',
                                                 `platform_name` varchar(200)  DEFAULT NULL COMMENT '贸易平台名称',
                                                 `social_credit_code` varchar(200)  DEFAULT NULL COMMENT '纳税识别号',
                                                 `address` varchar(200)  DEFAULT NULL COMMENT '地址',
                                                 `phone_number` varchar(200)  DEFAULT NULL COMMENT '电话',
                                                 `user_create` varchar(32)  DEFAULT '' COMMENT '创建人',
                                                 `user_modified` varchar(32)  DEFAULT '' COMMENT '修改人',
                                                 `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                                 `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                                 `bank_account` varchar(255)  DEFAULT NULL,
                                                 `account` varchar(255)  DEFAULT NULL,
                                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5   COMMENT='贸易平台-开票信息表';

DROP TABLE IF EXISTS  `enterprise_customer_info`;
CREATE TABLE `enterprise_customer_info` (
                                            `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                            `enterprise_name` varchar(50) DEFAULT NULL COMMENT '企业名称',
                                            `socialCreditCode` varchar(18) DEFAULT NULL COMMENT '统一社会信用代码',
                                            `auth_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '二网认证状态 0：未认证 1：已认证',
                                            `auth_url` varchar(1024) DEFAULT NULL COMMENT '二网认证链接',
                                            `fdd_customer_id` varchar(50) DEFAULT NULL COMMENT '二网在法大大上的客户编号',
                                            `synchronize_time` timestamp NULL DEFAULT NULL COMMENT '同步时间',
                                            `supplier` tinyint(1) NOT NULL COMMENT '核心企业或供应商 0：核心企业 1：供应商',
                                            `address` varchar(255) DEFAULT NULL COMMENT '注册地址',
                                            `phone_number` varchar(50) DEFAULT NULL COMMENT '注册电话',
                                            `user_create` varchar(50) DEFAULT NULL COMMENT '创建人',
                                            `user_modified` varchar(50) DEFAULT NULL COMMENT '修改人',
                                            `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                            `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                            `short_auth_url` varchar(1024) DEFAULT NULL COMMENT '自动签署短链接',
                                            `short_auth_url_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '自动签署创建时间',
                                            PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=117  COMMENT='企业客户信息表';


DROP TABLE IF EXISTS  `electronic_signature_personal`;
CREATE TABLE `electronic_signature_personal` (
                                                 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                                                 `name` varchar(50)  DEFAULT NULL COMMENT '用户名',
                                                 `card_type` varchar(50)  DEFAULT '' COMMENT '证件类型',
                                                 `socialCreditCode` varchar(18)  DEFAULT NULL COMMENT '证件号码',
                                                 `mobile` varchar(50)  DEFAULT NULL COMMENT '联系电话',
                                                 `fdd_customer_id` varchar(50)  DEFAULT NULL COMMENT '电子签客户编号',
                                                 `open_id` varchar(50)  DEFAULT NULL COMMENT 'open_id',
                                                 `auth_url` varchar(1024)  DEFAULT NULL COMMENT '认证链接',
                                                 `short_auth_url` varchar(1024)  DEFAULT NULL COMMENT '认证短链接',
                                                 `auth_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '电子签认证状态 0：未认证 1：已认证',
                                                 `user_create` varchar(32)  DEFAULT '' COMMENT '创建人',
                                                 `user_modified` varchar(32)  DEFAULT '' COMMENT '修改人',
                                                 `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                                 `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                                 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=42  COMMENT='--电子签个人信息表';




INSERT INTO `t_permission` (`parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( NULL, '企业管理', 'enterpriseManagement', '0', NULL, '', NULL, NULL, NULL, '2021-09-19 16:59:17', '2022-03-28 09:36:38');



INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'enterpriseManagement'), '贸易平台', 'tradingPlatform', '0', '企业管理', '/customer/listPage', NULL, NULL, NULL, '2021-09-19 16:59:17', '2021-09-19 16:59:17');



INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'tradingPlatform'), '添加贸易平台', 'addSupplier', '0', '贸易平台', '/customer/add', NULL, NULL, NULL, '2021-09-19 16:59:18', '2021-09-19 16:59:18');


INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'enterpriseManagement'), '电子签', 'electronicSign', '0', '企业管理', '/customer/listPage', NULL, NULL, NULL, '2021-09-19 16:59:17', '2021-09-19 16:59:17');


INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'electronicSign'), '公司', 'company', '0', '电子签', '/customer/add', NULL, NULL, NULL, '2021-09-19 16:59:18', '2021-09-19 16:59:18');

INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'electronicSign'), '个人', 'individual', '0', '电子签', '/customer/add', NULL, NULL, NULL, '2021-09-19 16:59:18', '2021-09-19 16:59:18');



INSERT INTO `t_permission` (`parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( NULL, '征信管理', 'creditManagement', '1', NULL, '', NULL, NULL, NULL, '2021-09-19 16:59:17', '2022-03-28 09:36:38');


INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'creditManagement'), '企业', 'enterprise', '0', '征信管理', '/customer/listPage', NULL, NULL, NULL, '2021-09-19 16:59:17', '2021-09-19 16:59:17');

INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'enterprise'), '新增企业', 'addEnterprise', '0', '企业', '/customer/add', NULL, NULL, NULL, '2021-09-19 16:59:18', '2021-09-19 16:59:18');



INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'creditManagement'), '个人', 'personal', '0', '征信管理', '/customer/listPage', NULL, NULL, NULL, '2021-09-19 16:59:17', '2021-09-19 16:59:17');

INSERT INTO `t_permission` ( `parentId`, `cname`, `ename`, `gradation`, `moduleName`, `url`, `icon`, `user_create`, `user_modified`, `gmt_create`, `gmt_modified`) VALUES ( (select t.id from t_permission t where t.ename = 'personal'), '新增个人', 'addPerson', '0', '个人', '/customer/add', NULL, NULL, NULL, '2021-09-19 16:59:18', '2021-09-19 16:59:18');

CREATE TABLE `trading_platform` (
                                    `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                    `platform_name` varchar(250) DEFAULT NULL COMMENT '平台名称',
                                    `socialCreditCode` varchar(18) DEFAULT NULL COMMENT '统一社会信用代码',
                                    `auth_status` tinyint(1) DEFAULT '0' COMMENT '二网认证状态 0：未认证 1：已认证',
                                    `auto_sign_status` tinyint(1) DEFAULT '0' COMMENT '二网授权自动签署状态 0：未认证 1：已认证',
                                    `auth_url` varchar(1024) DEFAULT NULL COMMENT '二网认证链接',
                                    `auto_sign_url` varchar(1024) DEFAULT NULL COMMENT '自动签署链接',
                                    `fdd_customer_id` varchar(50) DEFAULT NULL COMMENT '二网在法大大上的客户编号',
                                    `address` varchar(255) DEFAULT NULL COMMENT '注册地址',
                                    `phone_number` varchar(50) DEFAULT NULL COMMENT '注册电话',
                                    `user_create` varchar(50) DEFAULT '' COMMENT '创建人',
                                    `user_modified` varchar(50) DEFAULT '' COMMENT '修改人',
                                    `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                    `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                    `short_auto_sign_url` varchar(1024) DEFAULT NULL COMMENT '自动签署短链接',
                                    `short_auto_sign_url_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '自动签署创建时间',
                                    `short_auth_url` varchar(1024) DEFAULT NULL COMMENT '二网认证短链接',
                                    `short_auth_url_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '二网认证短链接创建时间',
                                    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COMMENT='贸易平台';



CREATE TABLE `sign_confirmation_electronic_info` (
                                                     `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                                                     `sign_confirmation_id` bigint(20) NOT NULL COMMENT '签署确认表Id',
                                                     `contract_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '合同名称',
                                                     `contract_id` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '合同id',
                                                     `file_id` bigint(20) DEFAULT NULL COMMENT '电子签文件',
                                                     `electronic_signature_personal_id` bigint(20) NOT NULL COMMENT '电子签个人信息表Id',
                                                     `transaction_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '客户合同交易id',
                                                     `sign_status` tinyint(1) DEFAULT NULL COMMENT '客户签署状态',
                                                     `back_file_id` bigint(20) DEFAULT NULL COMMENT '电子签回调文件',
                                                     `report_file_id` bigint(20) DEFAULT NULL COMMENT '出证电子签文件',
                                                     `user_create` varchar(32) COLLATE utf8_unicode_ci DEFAULT '' COMMENT '创建人',
                                                     `user_modified` varchar(32) COLLATE utf8_unicode_ci DEFAULT '' COMMENT '修改人',
                                                     `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                                     `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
                                                     PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='--签署确认合同信息';