-- 创建全市场待发行临时表
DROP TABLE IF EXISTS `custody_tongyi_unissued_data`;
CREATE TABLE `custody_tongyi_unissued_data`  (
                                                 `id` int(20) NOT NULL AUTO_INCREMENT COMMENT 'id（无实际意义）',
                                                 `listdate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目进度',
                                                 `tradingcode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代码',
                                                 `chiname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '公司',
                                                 `issuesize` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拟募集规模',
                                                 `leadunderwriter` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '券商',
                                                 `marginsellstatus` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '两融标的',
                                                 `indunameiv` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所处行业',
                                                 `refinancingmode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '再融资方式',
                                                 `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '版本',
                                                 `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                                 `create_time` datetime(0) NULL DEFAULT current_timestamp(0) COMMENT '创建时间',
                                                 `update_time` datetime(0) NULL DEFAULT current_timestamp(0) COMMENT '更新时间',
                                                 `is_deleted` int(1) NULL DEFAULT 0 COMMENT '是否有效(0：有效 1：无效)',
                                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 767 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '全市场待发行项目临时表（每天更新）' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

-- 创建定增临时表
DROP TABLE IF EXISTS `custody_tongyi_directionalup_data`;
CREATE TABLE `custody_tongyi_directionalup_data`  (
                                                      `id` int(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
                                                      `trading_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代码',
                                                      `chiname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '公司',
                                                      `change_date` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上市日期',
                                                      `minlisting_date` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '限售解禁日',
                                                      `exp_collection` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预计募集资金总额(亿元)',
                                                      `collection` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实际募资总额(亿元)',
                                                      `price` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发行价格(元）',
                                                      `closing_price` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '增发日收盘价（元）',
                                                      `actpricepct` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实施价格相对基准价格比例(%)',
                                                      `leadunderwriter` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主承销商',
                                                      `FXZJL` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发行折价率(%)',
                                                      `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '版本',
                                                      `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                                      `create_time` datetime(0) NULL DEFAULT current_timestamp(0) COMMENT '创建时间',
                                                      `update_time` datetime(0) NULL DEFAULT current_timestamp(0) COMMENT '更新时间',
                                                      `is_deleted` int(1) NULL DEFAULT NULL COMMENT '\'是否有效\'',
                                                      PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 512 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '通怡定增临时表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

-- 创建可转债临时表
DROP TABLE IF EXISTS `custody_tongyi_convertible_bonds_data`;
CREATE TABLE `custody_tongyi_convertible_bonds_data`  (
                                                          `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
                                                          `trading_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '转债代码',
                                                          `secuabbr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '转债名称',
                                                          `listing_date` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上市时间',
                                                          `luname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主承销商',
                                                          `stkexchange_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '正股代码',
                                                          `stkexchange_secuabbr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '正股简称',
                                                          `issue_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发行规模（万元）',
                                                          `coupon_rate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '票面利率（%）',
                                                          `comin_terest` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '补偿利率（%）',
                                                          `exerbeg_date` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '转股起始日',
                                                          `initicvtprice` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '初始转股价（元）',
                                                          `cvtprice` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '最新转股价（元）',
                                                          `redeemclause` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '赎回',
                                                          `putclause` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '回售',
                                                          `specidownclause` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '特别向下修正',
                                                          `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '版本',
                                                          `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                                          `create_time` datetime(0) NULL DEFAULT current_timestamp(0) COMMENT '创建时间',
                                                          `update_time` datetime(0) NULL DEFAULT current_timestamp(0) COMMENT '更新时间',
                                                          `is_deleted` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '是否有效',
                                                          `type` int(1) NULL DEFAULT NULL COMMENT '类型 0:定向 1：可发行',
                                                          PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 263 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '通怡可转债临时表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

-- 创建可交债临时表
DROP TABLE IF EXISTS `custody_tongyi_celiverable_bond_data`;
CREATE TABLE `custody_tongyi_celiverable_bond_data`  (
                                                         `id` int(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
                                                         `trading_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '转债代码',
                                                         `secuabbr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '转债名称',
                                                         `dateinstoff` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网下发行日期',
                                                         `listingdate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上市时间',
                                                         `stkexchange_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '正股代码',
                                                         `stksecuabbr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '正股简称',
                                                         `issue_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发行规模（万元）',
                                                         `coupon_rate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '票面利率（%）',
                                                         `comin_terest` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '补偿利率（%）',
                                                         `binfointeresttype` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '利率类型',
                                                         `convstartdate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '转股起始日',
                                                         `initicvtprice` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '初始转股价（元）',
                                                         `newcvt_price` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '最新转股价（元）',
                                                         `redeemclause` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '赎回',
                                                         `putclause` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '回售',
                                                         `specidownclause` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '特别向下修正',
                                                         `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '版本',
                                                         `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                                         `create_time` datetime(0) NULL DEFAULT current_timestamp(0) COMMENT '创建时间',
                                                         `update_time` datetime(0) NULL DEFAULT current_timestamp(0) COMMENT '更新时间',
                                                         `is_deleted` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '是否有效',
                                                         PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '通怡可交债务临时表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

    -- custody.custody_tongyi_directional_convertible_bonds definition
DROP TABLE IF EXISTS `custody_tongyi_directional_convertible_bonds`;
CREATE TABLE `custody_tongyi_directional_convertible_bonds` (
                                                                `id` int(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
                                                                `trading_code` varchar(255) DEFAULT NULL COMMENT '转债代码',
                                                                `secuabbr` varchar(255) DEFAULT NULL COMMENT '转债名称',
                                                                `listing_date` varchar(255) DEFAULT NULL COMMENT '上市时间',
                                                                `luname` varchar(255) DEFAULT NULL COMMENT '主承销商',
                                                                `stkexchange_code` varchar(255) DEFAULT NULL COMMENT '正股代码',
                                                                `stkexchange_secuabbr` varchar(255) DEFAULT NULL COMMENT '正股简称',
                                                                `issue_size` varchar(255) DEFAULT NULL COMMENT '发行规模（万元）',
                                                                `coupon_rate` varchar(255) DEFAULT NULL COMMENT '票面利率（%）',
                                                                `comin_terest` varchar(255) DEFAULT NULL COMMENT '补偿利率（%）',
                                                                `exerbeg_date` varchar(255) DEFAULT NULL COMMENT '转股起始日',
                                                                `initicvtprice` varchar(255) DEFAULT NULL COMMENT '初始转股价（元）',
                                                                `cvtprice` varchar(255) DEFAULT NULL COMMENT '最新转股价（元）',
                                                                `redeemclause` text DEFAULT NULL COMMENT '赎回',
                                                                `putclause` text DEFAULT NULL COMMENT '回售',
                                                                `specidownclause` text DEFAULT NULL COMMENT '特别向下修正',
                                                                `version` varchar(255) DEFAULT NULL COMMENT '版本',
                                                                `remark` varchar(255) DEFAULT NULL COMMENT '备注',
                                                                `create_time` datetime DEFAULT current_timestamp() COMMENT '创建时间',
                                                                `update_time` datetime DEFAULT current_timestamp() COMMENT '更新时间',
                                                                `is_deleted` varchar(255) DEFAULT '0' COMMENT '是否有效',
                                                                `type` int(1) DEFAULT NULL COMMENT '类型 0:定向 1：可发行',
                                                                PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='通怡定向可转债临时表';