diff --git a/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TTrends.java b/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TTrends.java index de36eab..b98b467 100644 --- a/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TTrends.java +++ b/newstock-system/src/main/java/com/ruoyi/newstocksystem/domain/TTrends.java @@ -24,6 +24,10 @@ public class TTrends extends BaseEntity @Excel(name = "交易日期", dateFormat = "yyyy-MM-dd") private Date tradeDate; + /** 行业名称(关联t_industry_basic表) */ + @Excel(name = "行业名称") + private String industryName; + /** 所属东财行业代码 */ @Excel(name = "东财行业代码") private String eastmoneyIndustryCode; @@ -84,6 +88,16 @@ public class TTrends extends BaseEntity this.tradeDate = tradeDate; } + public String getIndustryName() + { + return industryName; + } + + public void setIndustryName(String industryName) + { + this.industryName = industryName; + } + public String getEastmoneyIndustryCode() { return eastmoneyIndustryCode; diff --git a/newstock-system/src/main/java/com/ruoyi/newstocksystem/mapper/TIndustryBasicMapper.java b/newstock-system/src/main/java/com/ruoyi/newstocksystem/mapper/TIndustryBasicMapper.java index 3d4ef0c..c44d825 100644 --- a/newstock-system/src/main/java/com/ruoyi/newstocksystem/mapper/TIndustryBasicMapper.java +++ b/newstock-system/src/main/java/com/ruoyi/newstocksystem/mapper/TIndustryBasicMapper.java @@ -66,4 +66,12 @@ public interface TIndustryBasicMapper * @return 结果 */ public int batchUpsertIndustryBasic(List industryBasicList); + + /** + * 根据行业名称查询行业基础数据 + * + * @param industryName 行业名称 + * @return 行业基础数据 + */ + public TIndustryBasic selectTIndustryBasicByName(String industryName); } \ No newline at end of file diff --git a/newstock-system/src/main/java/com/ruoyi/newstocksystem/service/TTrendsService.java b/newstock-system/src/main/java/com/ruoyi/newstocksystem/service/TTrendsService.java index 551bf89..42c84fb 100644 --- a/newstock-system/src/main/java/com/ruoyi/newstocksystem/service/TTrendsService.java +++ b/newstock-system/src/main/java/com/ruoyi/newstocksystem/service/TTrendsService.java @@ -68,10 +68,18 @@ public interface TTrendsService public int batchUpsert(List tTrendsList); /** - * 验证行业代码是否在基础表中存在 + * 验证行业名称是否在基础表中存在 * - * @param industryCode 行业代码 + * @param industryName 行业名称 * @return 是否存在 */ - public boolean validateIndustryCodeExists(String industryCode); + public boolean validateIndustryNameExists(String industryName); + + /** + * 验证行业名称(关联t_industry_basic表)是否在基础表中存在 + * + * @param industryName 行业名称 + * @return 是否存在 + */ + public boolean validateIndustryBasicNameExists(String industryName); } \ No newline at end of file diff --git a/newstock-system/src/main/java/com/ruoyi/newstocksystem/service/impl/TTrendsServiceImpl.java b/newstock-system/src/main/java/com/ruoyi/newstocksystem/service/impl/TTrendsServiceImpl.java index 824e6c8..8e6fc48 100644 --- a/newstock-system/src/main/java/com/ruoyi/newstocksystem/service/impl/TTrendsServiceImpl.java +++ b/newstock-system/src/main/java/com/ruoyi/newstocksystem/service/impl/TTrendsServiceImpl.java @@ -108,8 +108,15 @@ public class TTrendsServiceImpl implements TTrendsService } @Override - public boolean validateIndustryCodeExists(String industryCode) + public boolean validateIndustryNameExists(String industryName) { - return tIndustryBasicMapper.selectTIndustryBasicByCode(industryCode) != null; + // 由于t_trends表现在使用industry_name作为主键的一部分,这里应该验证行业名称 + return tIndustryBasicMapper.selectTIndustryBasicByName(industryName) != null; + } + + @Override + public boolean validateIndustryBasicNameExists(String industryName) + { + return tIndustryBasicMapper.selectTIndustryBasicByName(industryName) != null; } } \ No newline at end of file diff --git a/newstock-system/src/main/resources/mapper/newstocksystem/TIndustryBasicMapper.xml b/newstock-system/src/main/resources/mapper/newstocksystem/TIndustryBasicMapper.xml index c038e72..de8c1cf 100644 --- a/newstock-system/src/main/resources/mapper/newstocksystem/TIndustryBasicMapper.xml +++ b/newstock-system/src/main/resources/mapper/newstocksystem/TIndustryBasicMapper.xml @@ -43,6 +43,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by sort_order asc + + insert into t_industry_basic diff --git a/newstock-system/src/main/resources/mapper/newstocksystem/TStocksInTrendMapper.xml b/newstock-system/src/main/resources/mapper/newstocksystem/TStocksInTrendMapper.xml index 7751303..b9e52a6 100644 --- a/newstock-system/src/main/resources/mapper/newstocksystem/TStocksInTrendMapper.xml +++ b/newstock-system/src/main/resources/mapper/newstocksystem/TStocksInTrendMapper.xml @@ -97,7 +97,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ON DUPLICATE KEY UPDATE rank = VALUES(rank), - momentum_type = VALUES(momentum_type), update_time = VALUES(update_time) \ No newline at end of file diff --git a/newstock-system/src/main/resources/mapper/newstocksystem/TTrendsMapper.xml b/newstock-system/src/main/resources/mapper/newstocksystem/TTrendsMapper.xml index 72da911..12ac1cb 100644 --- a/newstock-system/src/main/resources/mapper/newstocksystem/TTrendsMapper.xml +++ b/newstock-system/src/main/resources/mapper/newstocksystem/TTrendsMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, trade_date, eastmoney_industry_code, eastmoney_industry_name, stocks_count, trend_value, trend_value_change, rank, rank_change, momentum_type, create_time, update_time from t_trends + select id, trade_date, industry_name, eastmoney_industry_code, eastmoney_industry_name, stocks_count, trend_value, trend_value_change, rank, rank_change, momentum_type, create_time, update_time from t_trends