diff --git a/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TIndustryBasic.java b/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TIndustryBasic.java index 0eb3a7b..4b2c3fb 100644 --- a/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TIndustryBasic.java +++ b/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TIndustryBasic.java @@ -28,13 +28,7 @@ public class TIndustryBasic extends BaseEntity @Excel(name = "行业级别") private Integer industryLevel; - /** 父级行业代码 */ - @Excel(name = "父级行业代码") - private String parentIndustryCode; - /** 行业描述 */ - @Excel(name = "行业描述") - private String description; /** 状态(1=正常,0=禁用) */ @Excel(name = "状态", readConverterExp = "1=正常,0=禁用") @@ -74,25 +68,7 @@ public class TIndustryBasic extends BaseEntity this.industryLevel = industryLevel; } - public String getParentIndustryCode() - { - return parentIndustryCode; - } - - public void setParentIndustryCode(String parentIndustryCode) - { - this.parentIndustryCode = parentIndustryCode; - } - public String getDescription() - { - return description; - } - - public void setDescription(String description) - { - this.description = description; - } public Integer getStatus() { @@ -121,8 +97,6 @@ public class TIndustryBasic extends BaseEntity "industryCode='" + industryCode + '\'' + ", industryName='" + industryName + '\'' + ", industryLevel=" + industryLevel + - ", parentIndustryCode='" + parentIndustryCode + '\'' + - ", description='" + description + '\'' + ", status=" + status + ", sortOrder=" + sortOrder + '}'; diff --git a/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TIndustryIndex.java b/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TIndustryIndex.java index ac8e039..99f9f12 100644 --- a/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TIndustryIndex.java +++ b/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TIndustryIndex.java @@ -79,18 +79,6 @@ public class TIndustryIndex extends BaseEntity @Excel(name = "最低价") private BigDecimal lowPrice; - /** 振幅(百分比) */ - @Excel(name = "振幅") - private BigDecimal amplitude; - - /** 换手率(百分比) */ - @Excel(name = "换手率") - private BigDecimal turnoverRate; - - /** 等权重平均涨跌幅(百分比) */ - @Excel(name = "等权平均涨跌幅") - private BigDecimal equalWeightAvgChangeRate; - /** 成份股上涨家数 */ @Excel(name = "上涨家数") private Integer upCount; @@ -116,12 +104,13 @@ public class TIndustryIndex extends BaseEntity private Integer suspendCount; /** 近期创历史新高 */ - @Excel(name = "创历史新高", readConverterExp = "1=是,0=否") + @Excel(name = "近期创历史新高", readConverterExp = "1=是,0=否") private Integer newHighFlag; /** 近期创历史新低 */ - @Excel(name = "创历史新低", readConverterExp = "1=是,0=否") + @Excel(name = "近期创历史新低", readConverterExp = "1=是,0=否") private Integer newLowFlag; + public String getIndustryIndexCode() { @@ -273,36 +262,6 @@ public class TIndustryIndex extends BaseEntity this.lowPrice = lowPrice; } - public BigDecimal getAmplitude() - { - return amplitude; - } - - public void setAmplitude(BigDecimal amplitude) - { - this.amplitude = amplitude; - } - - public BigDecimal getTurnoverRate() - { - return turnoverRate; - } - - public void setTurnoverRate(BigDecimal turnoverRate) - { - this.turnoverRate = turnoverRate; - } - - public BigDecimal getEqualWeightAvgChangeRate() - { - return equalWeightAvgChangeRate; - } - - public void setEqualWeightAvgChangeRate(BigDecimal equalWeightAvgChangeRate) - { - this.equalWeightAvgChangeRate = equalWeightAvgChangeRate; - } - public Integer getUpCount() { return upCount; @@ -382,6 +341,7 @@ public class TIndustryIndex extends BaseEntity { this.newLowFlag = newLowFlag; } + @Override public String toString() @@ -400,6 +360,8 @@ public class TIndustryIndex extends BaseEntity ", priceChangeRate=" + priceChangeRate + ", peTtm=" + peTtm + ", peTtmMedian=" + peTtmMedian + + ", newHighFlag=" + newHighFlag + + ", newLowFlag=" + newLowFlag + '}'; } } diff --git a/newstock-system/src/main/resources/mapper/newstocksystem/IndustryIndexMapper.xml b/newstock-system/src/main/resources/mapper/newstocksystem/IndustryIndexMapper.xml index d3113b1..63dea95 100644 --- a/newstock-system/src/main/resources/mapper/newstocksystem/IndustryIndexMapper.xml +++ b/newstock-system/src/main/resources/mapper/newstocksystem/IndustryIndexMapper.xml @@ -17,9 +17,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - @@ -30,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -37,8 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select industry_index_code, industry_index_name, component_count, trade_date, open_price, close_price, high_price, low_price, volume, turnover, - total_market_cap, free_circulation_cap, price_change_rate, amplitude, - turnover_rate, equal_weight_avg_change_rate, pe_ttm, pe_ttm_median, + total_market_cap, free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median, up_count, down_count, limit_up_count, limit_down_count, no_change_count, suspend_count, new_high_flag, new_low_flag, create_time, update_time from t_industry_index @@ -99,9 +96,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" total_market_cap, free_circulation_cap, price_change_rate, - amplitude, - turnover_rate, - equal_weight_avg_change_rate, pe_ttm, pe_ttm_median, up_count, @@ -112,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" suspend_count, new_high_flag, new_low_flag, + create_time, @@ -128,9 +123,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{totalMarketCap}, #{freeCirculationCap}, #{priceChangeRate}, - #{amplitude}, - #{turnoverRate}, - #{equalWeightAvgChangeRate}, #{peTtm}, #{peTtmMedian}, #{upCount}, @@ -141,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{suspendCount}, #{newHighFlag}, #{newLowFlag}, + NOW(), @@ -159,9 +152,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" total_market_cap = #{totalMarketCap}, free_circulation_cap = #{freeCirculationCap}, price_change_rate = #{priceChangeRate}, - amplitude = #{amplitude}, - turnover_rate = #{turnoverRate}, - equal_weight_avg_change_rate = #{equalWeightAvgChangeRate}, pe_ttm = #{peTtm}, pe_ttm_median = #{peTtmMedian}, up_count = #{upCount}, @@ -172,6 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" suspend_count = #{suspendCount}, new_high_flag = #{newHighFlag}, new_low_flag = #{newLowFlag}, + update_time = NOW(), where industry_index_code = #{industryIndexCode} and trade_date = #{tradeDate} @@ -184,16 +175,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into t_industry_index(industry_index_code, industry_index_name, component_count, trade_date, open_price, close_price, high_price, low_price, volume, turnover, - total_market_cap, free_circulation_cap, price_change_rate, amplitude, - turnover_rate, equal_weight_avg_change_rate, pe_ttm, pe_ttm_median, + total_market_cap, free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median, up_count, down_count, limit_up_count, limit_down_count, no_change_count, suspend_count, new_high_flag, new_low_flag, create_time) values (#{item.industryIndexCode}, #{item.industryIndexName}, #{item.componentCount}, #{item.tradeDate}, #{item.openPrice}, #{item.closePrice}, #{item.highPrice}, #{item.lowPrice}, #{item.volume}, #{item.turnover}, - #{item.totalMarketCap}, #{item.freeCirculationCap}, #{item.priceChangeRate}, #{item.amplitude}, - #{item.turnoverRate}, #{item.equalWeightAvgChangeRate}, #{item.peTtm}, #{item.peTtmMedian}, + #{item.totalMarketCap}, #{item.freeCirculationCap}, #{item.priceChangeRate}, #{item.peTtm}, #{item.peTtmMedian}, #{item.upCount}, #{item.downCount}, #{item.limitUpCount}, #{item.limitDownCount}, #{item.noChangeCount}, #{item.suspendCount}, #{item.newHighFlag}, #{item.newLowFlag}, NOW()) @@ -202,16 +191,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into t_industry_index(industry_index_code, industry_index_name, component_count, trade_date, open_price, close_price, high_price, low_price, volume, turnover, - total_market_cap, free_circulation_cap, price_change_rate, amplitude, - turnover_rate, equal_weight_avg_change_rate, pe_ttm, pe_ttm_median, + total_market_cap, free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median, up_count, down_count, limit_up_count, limit_down_count, no_change_count, suspend_count, new_high_flag, new_low_flag, create_time) values (#{item.industryIndexCode}, #{item.industryIndexName}, #{item.componentCount}, #{item.tradeDate}, #{item.openPrice}, #{item.closePrice}, #{item.highPrice}, #{item.lowPrice}, #{item.volume}, #{item.turnover}, - #{item.totalMarketCap}, #{item.freeCirculationCap}, #{item.priceChangeRate}, #{item.amplitude}, - #{item.turnoverRate}, #{item.equalWeightAvgChangeRate}, #{item.peTtm}, #{item.peTtmMedian}, + #{item.totalMarketCap}, #{item.freeCirculationCap}, #{item.priceChangeRate}, #{item.peTtm}, #{item.peTtmMedian}, #{item.upCount}, #{item.downCount}, #{item.limitUpCount}, #{item.limitDownCount}, #{item.noChangeCount}, #{item.suspendCount}, #{item.newHighFlag}, #{item.newLowFlag}, NOW()) @@ -227,9 +214,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" total_market_cap = VALUES(total_market_cap), free_circulation_cap = VALUES(free_circulation_cap), price_change_rate = VALUES(price_change_rate), - amplitude = VALUES(amplitude), - turnover_rate = VALUES(turnover_rate), - equal_weight_avg_change_rate = VALUES(equal_weight_avg_change_rate), pe_ttm = VALUES(pe_ttm), pe_ttm_median = VALUES(pe_ttm_median), up_count = VALUES(up_count), diff --git a/newstock-system/src/main/resources/mapper/newstocksystem/TIndustryBasicMapper.xml b/newstock-system/src/main/resources/mapper/newstocksystem/TIndustryBasicMapper.xml index 4ece4b6..c038e72 100644 --- a/newstock-system/src/main/resources/mapper/newstocksystem/TIndustryBasicMapper.xml +++ b/newstock-system/src/main/resources/mapper/newstocksystem/TIndustryBasicMapper.xml @@ -8,8 +8,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - @@ -17,7 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select industry_code, industry_name, industry_level, parent_industry_code, description, status, sort_order, create_time, update_time + select industry_code, industry_name, industry_level, status, sort_order, create_time, update_time from t_industry_basic @@ -38,9 +36,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND industry_level = #{industryLevel} - - AND parent_industry_code = #{parentIndustryCode} - AND status = #{status} @@ -60,12 +55,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" industry_level, - - parent_industry_code, - - - description, - status, @@ -83,12 +72,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{industryLevel}, - - #{parentIndustryCode}, - - - #{description}, - #{status}, @@ -107,12 +90,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" industry_level = #{industryLevel}, - - parent_industry_code = #{parentIndustryCode}, - - - description = #{description}, - status = #{status}, @@ -139,21 +116,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" INSERT INTO t_industry_basic( - industry_code, industry_name, industry_level, parent_industry_code, - description, status, sort_order, create_time, update_time + industry_code, industry_name, industry_level, + status, sort_order, create_time, update_time ) VALUES ( #{item.industryCode}, #{item.industryName}, #{item.industryLevel}, - #{item.parentIndustryCode}, #{item.description}, #{item.status}, - #{item.sortOrder}, now(), now() + #{item.status}, #{item.sortOrder}, now(), now() ) ON DUPLICATE KEY UPDATE industry_name = VALUES(industry_name), industry_level = VALUES(industry_level), - parent_industry_code = VALUES(parent_industry_code), - description = VALUES(description), status = VALUES(status), sort_order = VALUES(sort_order), update_time = now() diff --git a/sql_refacor0120/add_new_high_low_count_fields.sql b/sql_refacor0120/add_new_high_low_count_fields.sql new file mode 100644 index 0000000..d7b69a5 --- /dev/null +++ b/sql_refacor0120/add_new_high_low_count_fields.sql @@ -0,0 +1,4 @@ +-- 添加新高新低计数字段到行业指数表 +ALTER TABLE `t_industry_index` +ADD COLUMN `new_high_count` INT NULL COMMENT '近期创历史新高家数' AFTER `suspend_count`, +ADD COLUMN `new_low_count` INT NULL COMMENT '近期创历史新低家数' AFTER `new_high_count`; \ No newline at end of file diff --git a/sql_refacor0120/add_new_high_low_flag_fields.sql b/sql_refacor0120/add_new_high_low_flag_fields.sql new file mode 100644 index 0000000..a7c400d --- /dev/null +++ b/sql_refacor0120/add_new_high_low_flag_fields.sql @@ -0,0 +1,4 @@ +-- 添加新高新低标志字段到行业指数表 +ALTER TABLE `t_industry_index` +ADD COLUMN `new_high_flag` TINYINT NULL COMMENT '近期创历史新高(1=是,0=否)' AFTER `suspend_count`, +ADD COLUMN `new_low_flag` TINYINT NULL COMMENT '近期创历史新低(1=是,0=否)' AFTER `new_high_flag`; \ No newline at end of file diff --git a/sql_refacor0120/remove_fields_from_industry_tables.sql b/sql_refacor0120/remove_fields_from_industry_tables.sql new file mode 100644 index 0000000..7bc5dad --- /dev/null +++ b/sql_refacor0120/remove_fields_from_industry_tables.sql @@ -0,0 +1,12 @@ +-- 删除行业基础数据表中的字段 +ALTER TABLE `t_industry_basic` +DROP COLUMN `parent_industry_code`, +DROP COLUMN `description`; + +-- 删除行业指数每日数据表中的字段 +ALTER TABLE `t_industry_index` +DROP COLUMN `amplitude`, +DROP COLUMN `turnover_rate`, +DROP COLUMN `equal_weight_avg_change_rate`, +DROP COLUMN `new_high_flag`, +DROP COLUMN `new_low_flag`; \ No newline at end of file diff --git a/sql_refacor0120/remove_new_high_low_count_fields.sql b/sql_refacor0120/remove_new_high_low_count_fields.sql new file mode 100644 index 0000000..cd7c027 --- /dev/null +++ b/sql_refacor0120/remove_new_high_low_count_fields.sql @@ -0,0 +1,4 @@ +-- 从行业指数表中删除新高新低计数字段 +ALTER TABLE `t_industry_index` +DROP COLUMN `new_high_count`, +DROP COLUMN `new_low_count`; \ No newline at end of file diff --git a/sql_refacor0120/t_industry_basic.sql b/sql_refacor0120/t_industry_basic.sql index 71d3813..bceef3b 100644 --- a/sql_refacor0120/t_industry_basic.sql +++ b/sql_refacor0120/t_industry_basic.sql @@ -3,8 +3,7 @@ CREATE TABLE `t_industry_basic` ( `industry_code` VARCHAR(20) NOT NULL COMMENT '行业代码(如802089.EI)', `industry_name` VARCHAR(50) NOT NULL COMMENT '行业名称(如"银行")', `industry_level` TINYINT NOT NULL DEFAULT 2 COMMENT '行业级别(1=一级行业,2=二级行业,3=三级行业等)', - `parent_industry_code` VARCHAR(20) NULL COMMENT '父级行业代码', - `description` TEXT NULL COMMENT '行业描述', + `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 '创建时间', diff --git a/sql_refacor0120/t_industry_basic_updated.sql b/sql_refacor0120/t_industry_basic_updated.sql new file mode 100644 index 0000000..b72c958 --- /dev/null +++ b/sql_refacor0120/t_industry_basic_updated.sql @@ -0,0 +1,16 @@ +-- 行业基础数据表:存储行业基础信息(已删除parent_industry_code和description字段) +CREATE TABLE `t_industry_basic` ( + `industry_code` VARCHAR(20) NOT NULL COMMENT '行业代码(如802089.EI)', + `industry_name` VARCHAR(50) 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`), + -- 索引:按行业级别查询优化 + INDEX `idx_t_industry_basic_level` (`industry_level`), + -- 索引:按状态查询优化 + INDEX `idx_t_industry_basic_status` (`status`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='行业基础数据表'; \ No newline at end of file diff --git a/sql_refacor0120/t_industry_index.sql b/sql_refacor0120/t_industry_index.sql index e66ef94..ec0004c 100644 --- a/sql_refacor0120/t_industry_index.sql +++ b/sql_refacor0120/t_industry_index.sql @@ -15,9 +15,6 @@ CREATE TABLE `t_industry_index` ( `pe_ttm_median` DECIMAL(10,2) NULL COMMENT '市盈率PE(TTM)中位值', `high_price` DECIMAL(10,2) NULL COMMENT '最高价(指数点位)', `low_price` DECIMAL(10,2) NULL COMMENT '最低价(指数点位)', - `amplitude` DECIMAL(6,4) NULL COMMENT '振幅(百分比)', - `turnover_rate` DECIMAL(6,4) NULL COMMENT '换手率(百分比)', - `equal_weight_avg_change_rate` DECIMAL(6,4) NULL COMMENT '等权重平均涨跌幅(百分比)', `up_count` INT NULL COMMENT '成份股上涨家数', `down_count` INT NULL COMMENT '成份股下跌家数', `limit_up_count` INT NULL COMMENT '成份股涨停家数', @@ -26,6 +23,7 @@ CREATE TABLE `t_industry_index` ( `suspend_count` INT NULL COMMENT '成份股停牌家数', `new_high_flag` TINYINT NULL COMMENT '近期创历史新高(1=是,0=否)', `new_low_flag` TINYINT NULL COMMENT '近期创历史新低(1=是,0=否)', + `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间(自动填充)', `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间(自动更新)', -- 复合主键:确保"指数代码+日期"唯一 diff --git a/sql_refacor0120/t_industry_index_updated.sql b/sql_refacor0120/t_industry_index_updated.sql new file mode 100644 index 0000000..584373f --- /dev/null +++ b/sql_refacor0120/t_industry_index_updated.sql @@ -0,0 +1,30 @@ +-- 行业指数表:存储东财二级行业指数基础信息及每日成交数据(已删除振幅、换手率、等权平均涨跌幅、新高新低标志位字段) +CREATE TABLE `t_industry_index` ( + `industry_index_code` VARCHAR(20) NOT NULL COMMENT '行业指数代码(如802089.EI)', + `industry_index_name` VARCHAR(50) NOT NULL COMMENT '行业指数名称(如"银行")', + `component_count` INT NULL COMMENT '成份个数(行业包含个股数量)', + `trade_date` DATE NOT NULL COMMENT '交易日期', + `open_price` DECIMAL(10,2) NULL COMMENT '开盘价(指数点位)', + `close_price` DECIMAL(10,2) NOT NULL COMMENT '收盘价(指数点位)', + `volume` BIGINT NULL COMMENT '成交量(指数成交总量)', + `turnover` DECIMAL(20,2) NULL COMMENT '成交额(单位:万元)', + `total_market_cap` DECIMAL(20,2) NULL COMMENT '总市值(单位:万元)', + `free_circulation_cap` DECIMAL(20,2) NULL COMMENT '自由流通市值(单位:万元)', + `price_change_rate` DECIMAL(6,4) NULL COMMENT '涨跌幅(百分比,如1.2937=1.2937%)', + `pe_ttm` DECIMAL(10,2) NULL COMMENT '市盈率PE(TTM)', + `pe_ttm_median` DECIMAL(10,2) NULL COMMENT '市盈率PE(TTM)中位值', + `high_price` DECIMAL(10,2) NULL COMMENT '最高价(指数点位)', + `low_price` DECIMAL(10,2) NULL COMMENT '最低价(指数点位)', + `up_count` INT NULL COMMENT '成份股上涨家数', + `down_count` INT NULL COMMENT '成份股下跌家数', + `limit_up_count` INT NULL COMMENT '成份股涨停家数', + `limit_down_count` INT NULL COMMENT '成份股跌停家数', + `no_change_count` INT NULL COMMENT '成份股平盘家数', + `suspend_count` INT 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 (`industry_index_code`, `trade_date`), + -- 索引:优化按日期查询所有行业指数的场景 + INDEX `idx_t_industry_index_trade_date` (`trade_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='东财二级行业指数每日数据'; \ No newline at end of file diff --git a/sql_refacor0120/t_industry_index_with_counts.sql b/sql_refacor0120/t_industry_index_with_counts.sql new file mode 100644 index 0000000..1bbc202 --- /dev/null +++ b/sql_refacor0120/t_industry_index_with_counts.sql @@ -0,0 +1,32 @@ +-- 行业指数表:存储东财二级行业指数基础信息及每日成交数据(包含新高新低计数字段) +CREATE TABLE `t_industry_index` ( + `industry_index_code` VARCHAR(20) NOT NULL COMMENT '行业指数代码(如802089.EI)', + `industry_index_name` VARCHAR(50) NOT NULL COMMENT '行业指数名称(如"银行")', + `component_count` INT NULL COMMENT '成份个数(行业包含个股数量)', + `trade_date` DATE NOT NULL COMMENT '交易日期', + `open_price` DECIMAL(10,2) NULL COMMENT '开盘价(指数点位)', + `close_price` DECIMAL(10,2) NOT NULL COMMENT '收盘价(指数点位)', + `volume` BIGINT NULL COMMENT '成交量(指数成交总量)', + `turnover` DECIMAL(20,2) NULL COMMENT '成交额(单位:万元)', + `total_market_cap` DECIMAL(20,2) NULL COMMENT '总市值(单位:万元)', + `free_circulation_cap` DECIMAL(20,2) NULL COMMENT '自由流通市值(单位:万元)', + `price_change_rate` DECIMAL(6,4) NULL COMMENT '涨跌幅(百分比,如1.2937=1.2937%)', + `pe_ttm` DECIMAL(10,2) NULL COMMENT '市盈率PE(TTM)', + `pe_ttm_median` DECIMAL(10,2) NULL COMMENT '市盈率PE(TTM)中位值', + `high_price` DECIMAL(10,2) NULL COMMENT '最高价(指数点位)', + `low_price` DECIMAL(10,2) NULL COMMENT '最低价(指数点位)', + `up_count` INT NULL COMMENT '成份股上涨家数', + `down_count` INT NULL COMMENT '成份股下跌家数', + `limit_up_count` INT NULL COMMENT '成份股涨停家数', + `limit_down_count` INT NULL COMMENT '成份股跌停家数', + `no_change_count` INT NULL COMMENT '成份股平盘家数', + `suspend_count` INT NULL COMMENT '成份股停牌家数', + `new_high_count` INT NULL COMMENT '近期创历史新高家数', + `new_low_count` INT 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 (`industry_index_code`, `trade_date`), + -- 索引:优化按日期查询所有行业指数的场景 + INDEX `idx_t_industry_index_trade_date` (`trade_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='东财二级行业指数每日数据'; \ No newline at end of file diff --git a/sql_refacor0120/t_industry_index_with_flags.sql b/sql_refacor0120/t_industry_index_with_flags.sql new file mode 100644 index 0000000..99170e2 --- /dev/null +++ b/sql_refacor0120/t_industry_index_with_flags.sql @@ -0,0 +1,32 @@ +-- 行业指数表:存储东财二级行业指数基础信息及每日成交数据(包含新高新低标志字段) +CREATE TABLE `t_industry_index` ( + `industry_index_code` VARCHAR(20) NOT NULL COMMENT '行业指数代码(如802089.EI)', + `industry_index_name` VARCHAR(50) NOT NULL COMMENT '行业指数名称(如"银行")', + `component_count` INT NULL COMMENT '成份个数(行业包含个股数量)', + `trade_date` DATE NOT NULL COMMENT '交易日期', + `open_price` DECIMAL(10,2) NULL COMMENT '开盘价(指数点位)', + `close_price` DECIMAL(10,2) NOT NULL COMMENT '收盘价(指数点位)', + `volume` BIGINT NULL COMMENT '成交量(指数成交总量)', + `turnover` DECIMAL(20,2) NULL COMMENT '成交额(单位:万元)', + `total_market_cap` DECIMAL(20,2) NULL COMMENT '总市值(单位:万元)', + `free_circulation_cap` DECIMAL(20,2) NULL COMMENT '自由流通市值(单位:万元)', + `price_change_rate` DECIMAL(6,4) NULL COMMENT '涨跌幅(百分比,如1.2937=1.2937%)', + `pe_ttm` DECIMAL(10,2) NULL COMMENT '市盈率PE(TTM)', + `pe_ttm_median` DECIMAL(10,2) NULL COMMENT '市盈率PE(TTM)中位值', + `high_price` DECIMAL(10,2) NULL COMMENT '最高价(指数点位)', + `low_price` DECIMAL(10,2) NULL COMMENT '最低价(指数点位)', + `up_count` INT NULL COMMENT '成份股上涨家数', + `down_count` INT NULL COMMENT '成份股下跌家数', + `limit_up_count` INT NULL COMMENT '成份股涨停家数', + `limit_down_count` INT NULL COMMENT '成份股跌停家数', + `no_change_count` INT NULL COMMENT '成份股平盘家数', + `suspend_count` INT NULL COMMENT '成份股停牌家数', + `new_high_flag` TINYINT NULL COMMENT '近期创历史新高(1=是,0=否)', + `new_low_flag` TINYINT NULL COMMENT '近期创历史新低(1=是,0=否)', + `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`), + -- 索引:优化按日期查询所有行业指数的场景 + INDEX `idx_t_industry_index_trade_date` (`trade_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='东财二级行业指数每日数据'; \ No newline at end of file