From e66777aa00aa4aba2943d0d305cf9766f4ae6b0c Mon Sep 17 00:00:00 2001 From: Lxy Date: Sat, 24 Jan 2026 11:01:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E8=A1=A8=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E5=A4=87=E4=BB=BD=EF=BC=88=E6=88=AA=E8=87=B32026?= =?UTF-8?q?=E5=B9=B41=E6=9C=8824=E6=97=A511=E7=82=B9=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql_ok/t_industry_basic.sql | 37 ++++++++++++++++++++ sql_ok/t_industry_index.sql | 55 +++++++++++++++++++++++++++++ sql_ok/t_stock_basic.sql | 40 +++++++++++++++++++++ sql_ok/t_stock_daily_trade.sql | 64 ++++++++++++++++++++++++++++++++++ 4 files changed, 196 insertions(+) create mode 100644 sql_ok/t_industry_basic.sql create mode 100644 sql_ok/t_industry_index.sql create mode 100644 sql_ok/t_stock_basic.sql create mode 100644 sql_ok/t_stock_daily_trade.sql diff --git a/sql_ok/t_industry_basic.sql b/sql_ok/t_industry_basic.sql new file mode 100644 index 0000000..5f9ea9a --- /dev/null +++ b/sql_ok/t_industry_basic.sql @@ -0,0 +1,37 @@ +/* + Navicat Premium Dump SQL + + Source Server : 192.168.0.222 + Source Server Type : MySQL + Source Server Version : 80031 (8.0.31) + Source Host : 192.168.0.222:3306 + Source Schema : ry_refactor0120 + + Target Server Type : MySQL + Target Server Version : 80031 (8.0.31) + File Encoding : 65001 + + Date: 24/01/2026 10:59:39 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for t_industry_basic +-- ---------------------------- +DROP TABLE IF EXISTS `t_industry_basic`; +CREATE TABLE `t_industry_basic` ( + `industry_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '行业代码(如802089.EI)', + `industry_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '行业名称(如\"银行\")', + `industry_level` tinyint NOT NULL DEFAULT 2 COMMENT '行业级别(1=一级行业,2=二级行业,3=三级行业等)', + `status` tinyint NOT NULL DEFAULT 1 COMMENT '状态(1=正常,0=禁用)', + `sort_order` int NOT NULL DEFAULT 0 COMMENT '排序', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`industry_code`) USING BTREE, + INDEX `idx_t_industry_basic_level`(`industry_level` ASC) USING BTREE, + INDEX `idx_t_industry_basic_status`(`status` ASC) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '行业基础数据表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/sql_ok/t_industry_index.sql b/sql_ok/t_industry_index.sql new file mode 100644 index 0000000..f1a40b6 --- /dev/null +++ b/sql_ok/t_industry_index.sql @@ -0,0 +1,55 @@ +/* + Navicat Premium Dump SQL + + Source Server : 192.168.0.222 + Source Server Type : MySQL + Source Server Version : 80031 (8.0.31) + Source Host : 192.168.0.222:3306 + Source Schema : ry_refactor0120 + + Target Server Type : MySQL + Target Server Version : 80031 (8.0.31) + File Encoding : 65001 + + Date: 24/01/2026 10:59:49 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for t_industry_index +-- ---------------------------- +DROP TABLE IF EXISTS `t_industry_index`; +CREATE TABLE `t_industry_index` ( + `industry_index_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '行业指数代码(如802089.EI)', + `industry_index_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '行业指数名称(如“银行”)', + `component_count` int NULL DEFAULT NULL COMMENT '成份个数(行业包含个股数量)', + `trade_date` date NOT NULL COMMENT '交易日期', + `open_price` decimal(20, 2) NULL DEFAULT NULL COMMENT '开盘价(指数点位)', + `close_price` decimal(20, 2) NOT NULL COMMENT '收盘价(指数点位)', + `high_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '最高价(指数点位)', + `low_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '最低价(指数点位)', + `up_count` int NULL DEFAULT NULL COMMENT '成份股上涨家数', + `down_count` int NULL DEFAULT NULL COMMENT '成份股下跌家数', + `limit_up_count` int NULL DEFAULT NULL COMMENT '成份股涨停家数', + `limit_down_count` int NULL DEFAULT NULL COMMENT '成份股跌停家数', + `no_change_count` int NULL DEFAULT NULL COMMENT '成份股平盘家数', + `suspend_count` int NULL DEFAULT NULL COMMENT '成份股停牌家数', + `new_high_flag` tinyint NULL DEFAULT NULL COMMENT '近期创历史新高(1=是,0=否)', + `new_low_flag` tinyint NULL DEFAULT NULL COMMENT '近期创历史新低(1=是,0=否)', + `volume` bigint NULL DEFAULT NULL COMMENT '成交量(指数成交总量)', + `turnover` decimal(20, 2) NULL DEFAULT NULL COMMENT '成交额(单位:万元)', + `total_market_cap` decimal(20, 2) NULL DEFAULT NULL COMMENT '总市值(单位:万元)', + `free_circulation_cap` decimal(20, 2) NULL DEFAULT NULL COMMENT '自由流通市值(单位:万元)', + `price_change_rate` decimal(10, 4) NULL DEFAULT NULL COMMENT '涨跌幅(百分比,如1.2937=1.2937%)', + `pe_ttm` decimal(10, 2) NULL DEFAULT NULL COMMENT '市盈率PE(TTM)', + `pe_ttm_median` decimal(10, 2) NULL DEFAULT NULL COMMENT '市盈率PE(TTM)中位值', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间(自动填充)', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间(自动更新)', + PRIMARY KEY (`industry_index_code`, `trade_date`) USING BTREE, + INDEX `idx_t_industry_index_trade_date`(`trade_date` ASC) USING BTREE, + CONSTRAINT `t_industry_index_ibfk_1` FOREIGN KEY (`industry_index_code`) REFERENCES `t_industry_basic` (`industry_code`) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '东财二级行业指数每日数据' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/sql_ok/t_stock_basic.sql b/sql_ok/t_stock_basic.sql new file mode 100644 index 0000000..a076865 --- /dev/null +++ b/sql_ok/t_stock_basic.sql @@ -0,0 +1,40 @@ +/* + Navicat Premium Dump SQL + + Source Server : 192.168.0.222 + Source Server Type : MySQL + Source Server Version : 80031 (8.0.31) + Source Host : 192.168.0.222:3306 + Source Schema : ry_refactor0120 + + Target Server Type : MySQL + Target Server Version : 80031 (8.0.31) + File Encoding : 65001 + + Date: 24/01/2026 10:59:56 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for t_stock_basic +-- ---------------------------- +DROP TABLE IF EXISTS `t_stock_basic`; +CREATE TABLE `t_stock_basic` ( + `stock_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '证券代码(如000061.SZ、600000.SH)', + `stock_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '证券名称(如“农 产 品”)', + `listing_date` date NULL DEFAULT NULL COMMENT '首发上市日期', + `listing_days` int NULL DEFAULT NULL COMMENT '上市天数(冗余存储,提升查询效率)', + `is_st` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否为ST股票(1=是,0=否)', + `is_star_st` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否为*ST股票(1=是,0=否)', + `industry_index_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '所属行业指数代码(关联t_industry_index)', + `industry_index_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '所属行业指数名称(冗余存储,减少关联查询)', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间', + PRIMARY KEY (`stock_code`) USING BTREE, + INDEX `idx_t_stock_basic_industry`(`industry_index_code` ASC) USING BTREE, + CONSTRAINT `t_stock_basic_ibfk_1` FOREIGN KEY (`industry_index_code`) REFERENCES `t_industry_basic` (`industry_code`) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'A股个股基础信息' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/sql_ok/t_stock_daily_trade.sql b/sql_ok/t_stock_daily_trade.sql new file mode 100644 index 0000000..f452d48 --- /dev/null +++ b/sql_ok/t_stock_daily_trade.sql @@ -0,0 +1,64 @@ +/* + Navicat Premium Dump SQL + + Source Server : 192.168.0.222 + Source Server Type : MySQL + Source Server Version : 80031 (8.0.31) + Source Host : 192.168.0.222:3306 + Source Schema : ry_refactor0120 + + Target Server Type : MySQL + Target Server Version : 80031 (8.0.31) + File Encoding : 65001 + + Date: 24/01/2026 11:00:05 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for t_stock_daily_trade +-- ---------------------------- +DROP TABLE IF EXISTS `t_stock_daily_trade`; +CREATE TABLE `t_stock_daily_trade` ( + `stock_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '证券代码(关联t_stock_basic,通过应用层校验一致性)', + `trade_date` date NOT NULL COMMENT '交易日期', + `open_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '开盘价(单位:元)', + `close_price` decimal(10, 2) NOT NULL COMMENT '收盘价(单位:元)', + `high_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '最高价(单位:元)', + `low_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '最低价(单位:元)', + `price_change_rate` decimal(6, 4) NULL DEFAULT NULL COMMENT '当日涨跌幅(百分比)', + `volume` bigint NULL DEFAULT NULL COMMENT '成交量(单位:股)', + `turnover` decimal(20, 2) NULL DEFAULT NULL COMMENT '成交额(单位:万元)', + `free_circulation_cap` decimal(20, 2) NULL DEFAULT NULL COMMENT '自由流通市值(单位:万元)', + `is_limit_up` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否涨停(1=是,0=否)', + `is_limit_down` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否跌停(1=是,0=否)', + `momentum_10d` decimal(20, 4) NULL DEFAULT NULL COMMENT '10日动量(涨跌幅)', + `momentum_20d` decimal(20, 4) NULL DEFAULT NULL COMMENT '20日动量(涨跌幅)', + `momentum_60d` decimal(20, 4) NULL DEFAULT NULL COMMENT '60日动量(涨跌幅)', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间', + PRIMARY KEY (`stock_code`, `trade_date`) USING BTREE, + INDEX `idx_t_stock_daily_trade_date`(`trade_date` ASC) USING BTREE, + INDEX `idx_t_stock_daily_trade_code`(`stock_code` ASC) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'A股个股每日交易数据-按月分区' ROW_FORMAT = Dynamic PARTITION BY RANGE (to_days(`trade_date`)) +PARTITIONS 16 +(PARTITION `p202412` VALUES LESS THAN (739617) ENGINE = InnoDB COMMENT = '2024年12月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202501` VALUES LESS THAN (739648) ENGINE = InnoDB COMMENT = '2025年1月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202502` VALUES LESS THAN (739676) ENGINE = InnoDB COMMENT = '2025年2月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202503` VALUES LESS THAN (739707) ENGINE = InnoDB COMMENT = '2025年3月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202504` VALUES LESS THAN (739737) ENGINE = InnoDB COMMENT = '2025年4月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202505` VALUES LESS THAN (739768) ENGINE = InnoDB COMMENT = '2025年5月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202506` VALUES LESS THAN (739798) ENGINE = InnoDB COMMENT = '2025年6月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202507` VALUES LESS THAN (739829) ENGINE = InnoDB COMMENT = '2025年7月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202508` VALUES LESS THAN (739860) ENGINE = InnoDB COMMENT = '2025年8月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202509` VALUES LESS THAN (739890) ENGINE = InnoDB COMMENT = '2025年9月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202510` VALUES LESS THAN (739921) ENGINE = InnoDB COMMENT = '2025年10月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202511` VALUES LESS THAN (739951) ENGINE = InnoDB COMMENT = '2025年11月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202512` VALUES LESS THAN (739982) ENGINE = InnoDB COMMENT = '2025年12月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202601` VALUES LESS THAN (740013) ENGINE = InnoDB COMMENT = '2026年1月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202602` VALUES LESS THAN (740041) ENGINE = InnoDB COMMENT = '2026年2月数据' MAX_ROWS = 0 MIN_ROWS = 0 , +PARTITION `p202603` VALUES LESS THAN (740072) ENGINE = InnoDB COMMENT = '2026年3月数据' MAX_ROWS = 0 MIN_ROWS = 0 ) +; + +SET FOREIGN_KEY_CHECKS = 1;