parent
698887cba5
commit
26dc129099
@ -0,0 +1,78 @@
|
||||
package com.ruoyi.newstocksystem.service;
|
||||
|
||||
import com.ruoyi.newstocksystem.domain.TStockBasic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 个股基础信息Service接口
|
||||
*
|
||||
* @author lxy
|
||||
* @date 2026-01-21
|
||||
*/
|
||||
public interface IStockBasicService
|
||||
{
|
||||
/**
|
||||
* 根据证券代码查询个股基础信息
|
||||
*
|
||||
* @param stockCode 证券代码
|
||||
* @return 个股基础信息
|
||||
*/
|
||||
public TStockBasic selectStockBasicByCode(String stockCode);
|
||||
|
||||
/**
|
||||
* 查询个股基础信息列表
|
||||
*
|
||||
* @param stockBasic 个股基础信息
|
||||
* @return 个股基础信息集合
|
||||
*/
|
||||
public List<TStockBasic> selectStockBasicList(TStockBasic stockBasic);
|
||||
|
||||
/**
|
||||
* 新增个股基础信息
|
||||
*
|
||||
* @param stockBasic 个股基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStockBasic(TStockBasic stockBasic);
|
||||
|
||||
/**
|
||||
* 修改个股基础信息
|
||||
*
|
||||
* @param stockBasic 个股基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStockBasic(TStockBasic stockBasic);
|
||||
|
||||
/**
|
||||
* 删除个股基础信息
|
||||
*
|
||||
* @param stockCode 证券代码
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStockBasicByCode(String stockCode);
|
||||
|
||||
/**
|
||||
* 批量删除个股基础信息
|
||||
*
|
||||
* @param stockCodes 需要删除的数据证券代码集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStockBasicByCodes(String[] stockCodes);
|
||||
|
||||
/**
|
||||
* 导入个股基础信息数据
|
||||
*
|
||||
* @param stockBasicList 个股基础信息数据
|
||||
* @return 导入条数
|
||||
*/
|
||||
public int importStockBasic(List<TStockBasic> stockBasicList);
|
||||
|
||||
/**
|
||||
* 根据行业指数代码查询个股列表
|
||||
*
|
||||
* @param industryIndexCode 行业指数代码
|
||||
* @return 个股基础信息集合
|
||||
*/
|
||||
public List<TStockBasic> selectStockBasicByIndustryCode(String industryIndexCode);
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package com.ruoyi.newstocksystem.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ruoyi.newstocksystem.domain.TIndustryIndex;
|
||||
import com.ruoyi.newstocksystem.mapper.TIndustryIndexMapper;
|
||||
import com.ruoyi.newstocksystem.service.IIndustryIndexService;
|
||||
|
||||
/**
|
||||
* 行业指数Service实现类
|
||||
*
|
||||
* @author lxy
|
||||
* @date 2026-01-21
|
||||
*/
|
||||
@Service
|
||||
public class IndustryIndexServiceImpl implements IIndustryIndexService
|
||||
{
|
||||
@Autowired
|
||||
private TIndustryIndexMapper industryIndexMapper;
|
||||
|
||||
@Override
|
||||
public TIndustryIndex selectIndustryIndexByCodeAndDate(String industryIndexCode, Date tradeDate)
|
||||
{
|
||||
return industryIndexMapper.selectIndustryIndexByCodeAndDate(industryIndexCode, tradeDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TIndustryIndex> selectIndustryIndexList(TIndustryIndex industryIndex)
|
||||
{
|
||||
return industryIndexMapper.selectIndustryIndexList(industryIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TIndustryIndex> selectDistinctIndustryIndexList()
|
||||
{
|
||||
return industryIndexMapper.selectDistinctIndustryIndexList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertIndustryIndex(TIndustryIndex industryIndex)
|
||||
{
|
||||
return industryIndexMapper.insertIndustryIndex(industryIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateIndustryIndex(TIndustryIndex industryIndex)
|
||||
{
|
||||
return industryIndexMapper.updateIndustryIndex(industryIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteIndustryIndexByCodeAndDate(String industryIndexCode, Date tradeDate)
|
||||
{
|
||||
return industryIndexMapper.deleteIndustryIndexByCodeAndDate(industryIndexCode, tradeDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int importIndustryIndex(List<TIndustryIndex> industryIndexList, Date tradeDate)
|
||||
{
|
||||
if (industryIndexList == null || industryIndexList.isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 设置交易日期
|
||||
for (TIndustryIndex industryIndex : industryIndexList)
|
||||
{
|
||||
if (industryIndex.getTradeDate() == null)
|
||||
{
|
||||
industryIndex.setTradeDate(tradeDate);
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
int batchSize = 500;
|
||||
|
||||
// 分批导入数据
|
||||
for (int i = 0; i < industryIndexList.size(); i += batchSize)
|
||||
{
|
||||
int end = Math.min(i + batchSize, industryIndexList.size());
|
||||
List<TIndustryIndex> batchList = industryIndexList.subList(i, end);
|
||||
count += industryIndexMapper.batchUpsertIndustryIndex(batchList);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectTradeDates()
|
||||
{
|
||||
return industryIndexMapper.selectTradeDates();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
package com.ruoyi.newstocksystem.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ruoyi.newstocksystem.domain.TStockBasic;
|
||||
import com.ruoyi.newstocksystem.mapper.TStockBasicMapper;
|
||||
import com.ruoyi.newstocksystem.service.IStockBasicService;
|
||||
|
||||
/**
|
||||
* 个股基础信息Service实现类
|
||||
*
|
||||
* @author lxy
|
||||
* @date 2026-01-21
|
||||
*/
|
||||
@Service
|
||||
public class StockBasicServiceImpl implements IStockBasicService
|
||||
{
|
||||
@Autowired
|
||||
private TStockBasicMapper stockBasicMapper;
|
||||
|
||||
@Override
|
||||
public TStockBasic selectStockBasicByCode(String stockCode)
|
||||
{
|
||||
return stockBasicMapper.selectStockBasicByCode(stockCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockBasic> selectStockBasicList(TStockBasic stockBasic)
|
||||
{
|
||||
return stockBasicMapper.selectStockBasicList(stockBasic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertStockBasic(TStockBasic stockBasic)
|
||||
{
|
||||
return stockBasicMapper.insertStockBasic(stockBasic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStockBasic(TStockBasic stockBasic)
|
||||
{
|
||||
return stockBasicMapper.updateStockBasic(stockBasic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteStockBasicByCode(String stockCode)
|
||||
{
|
||||
return stockBasicMapper.deleteStockBasicByCode(stockCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteStockBasicByCodes(String[] stockCodes)
|
||||
{
|
||||
return stockBasicMapper.deleteStockBasicByCodes(stockCodes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int importStockBasic(List<TStockBasic> stockBasicList)
|
||||
{
|
||||
if (stockBasicList == null || stockBasicList.isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
int batchSize = 500;
|
||||
|
||||
// 分批导入数据(使用 upsert 方式,自动处理新增和更新)
|
||||
for (int i = 0; i < stockBasicList.size(); i += batchSize)
|
||||
{
|
||||
int end = Math.min(i + batchSize, stockBasicList.size());
|
||||
List<TStockBasic> batchList = stockBasicList.subList(i, end);
|
||||
count += stockBasicMapper.batchUpsertStockBasic(batchList);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockBasic> selectStockBasicByIndustryCode(String industryIndexCode)
|
||||
{
|
||||
return stockBasicMapper.selectStockBasicByIndustryCode(industryIndexCode);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
package com.ruoyi.newstocksystem.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ruoyi.newstocksystem.domain.TStockDailyTrade;
|
||||
import com.ruoyi.newstocksystem.mapper.TStockDailyTradeMapper;
|
||||
import com.ruoyi.newstocksystem.service.IStockDailyTradeService;
|
||||
|
||||
/**
|
||||
* 个股每日交易数据Service实现类
|
||||
*
|
||||
* @author lxy
|
||||
* @date 2026-01-21
|
||||
*/
|
||||
@Service
|
||||
public class StockDailyTradeServiceImpl implements IStockDailyTradeService
|
||||
{
|
||||
@Autowired
|
||||
private TStockDailyTradeMapper stockDailyTradeMapper;
|
||||
|
||||
@Override
|
||||
public TStockDailyTrade selectStockDailyTradeByCodeAndDate(String stockCode, Date tradeDate)
|
||||
{
|
||||
return stockDailyTradeMapper.selectStockDailyTradeByCodeAndDate(stockCode, tradeDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockDailyTrade> selectStockDailyTradeList(TStockDailyTrade stockDailyTrade)
|
||||
{
|
||||
return stockDailyTradeMapper.selectStockDailyTradeList(stockDailyTrade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockDailyTrade> selectStockDailyTradeListWithBasic(TStockDailyTrade stockDailyTrade)
|
||||
{
|
||||
return stockDailyTradeMapper.selectStockDailyTradeListWithBasic(stockDailyTrade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertStockDailyTrade(TStockDailyTrade stockDailyTrade)
|
||||
{
|
||||
return stockDailyTradeMapper.insertStockDailyTrade(stockDailyTrade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStockDailyTrade(TStockDailyTrade stockDailyTrade)
|
||||
{
|
||||
return stockDailyTradeMapper.updateStockDailyTrade(stockDailyTrade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteStockDailyTradeByCodeAndDate(String stockCode, Date tradeDate)
|
||||
{
|
||||
return stockDailyTradeMapper.deleteStockDailyTradeByCodeAndDate(stockCode, tradeDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int importStockDailyTrade(List<TStockDailyTrade> stockDailyTradeList, Date tradeDate)
|
||||
{
|
||||
if (stockDailyTradeList == null || stockDailyTradeList.isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 设置交易日期
|
||||
for (TStockDailyTrade stockDailyTrade : stockDailyTradeList)
|
||||
{
|
||||
if (stockDailyTrade.getTradeDate() == null)
|
||||
{
|
||||
stockDailyTrade.setTradeDate(tradeDate);
|
||||
}
|
||||
// 设置默认值
|
||||
if (stockDailyTrade.getIsLimitUp() == null)
|
||||
{
|
||||
stockDailyTrade.setIsLimitUp(0);
|
||||
}
|
||||
if (stockDailyTrade.getIsLimitDown() == null)
|
||||
{
|
||||
stockDailyTrade.setIsLimitDown(0);
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
int batchSize = 500;
|
||||
|
||||
// 分批导入数据
|
||||
for (int i = 0; i < stockDailyTradeList.size(); i += batchSize)
|
||||
{
|
||||
int end = Math.min(i + batchSize, stockDailyTradeList.size());
|
||||
List<TStockDailyTrade> batchList = stockDailyTradeList.subList(i, end);
|
||||
count += stockDailyTradeMapper.batchUpsertStockDailyTrade(batchList);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectTradeDates()
|
||||
{
|
||||
return stockDailyTradeMapper.selectTradeDates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockDailyTrade> selectLimitUpStockList(TStockDailyTrade stockDailyTrade)
|
||||
{
|
||||
return stockDailyTradeMapper.selectLimitUpStockList(stockDailyTrade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockDailyTrade> selectStrongStockList(TStockDailyTrade stockDailyTrade)
|
||||
{
|
||||
return stockDailyTradeMapper.selectStrongStockList(stockDailyTrade);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
package com.ruoyi.newstocksystem.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ruoyi.newstocksystem.domain.TStockHighLowStatus;
|
||||
import com.ruoyi.newstocksystem.mapper.TStockHighLowStatusMapper;
|
||||
import com.ruoyi.newstocksystem.service.IStockHighLowStatusService;
|
||||
|
||||
/**
|
||||
* 个股新高新低状态Service实现类
|
||||
*
|
||||
* @author lxy
|
||||
* @date 2026-01-21
|
||||
*/
|
||||
@Service
|
||||
public class StockHighLowStatusServiceImpl implements IStockHighLowStatusService
|
||||
{
|
||||
@Autowired
|
||||
private TStockHighLowStatusMapper stockHighLowStatusMapper;
|
||||
|
||||
@Override
|
||||
public TStockHighLowStatus selectStockHighLowStatusByCodeAndDate(String stockCode, Date tradeDate)
|
||||
{
|
||||
return stockHighLowStatusMapper.selectStockHighLowStatusByCodeAndDate(stockCode, tradeDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockHighLowStatus> selectStockHighLowStatusList(TStockHighLowStatus stockHighLowStatus)
|
||||
{
|
||||
return stockHighLowStatusMapper.selectStockHighLowStatusList(stockHighLowStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockHighLowStatus> selectStockHighLowStatusListWithBasic(TStockHighLowStatus stockHighLowStatus)
|
||||
{
|
||||
return stockHighLowStatusMapper.selectStockHighLowStatusListWithBasic(stockHighLowStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertStockHighLowStatus(TStockHighLowStatus stockHighLowStatus)
|
||||
{
|
||||
return stockHighLowStatusMapper.insertStockHighLowStatus(stockHighLowStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStockHighLowStatus(TStockHighLowStatus stockHighLowStatus)
|
||||
{
|
||||
return stockHighLowStatusMapper.updateStockHighLowStatus(stockHighLowStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteStockHighLowStatusByCodeAndDate(String stockCode, Date tradeDate)
|
||||
{
|
||||
return stockHighLowStatusMapper.deleteStockHighLowStatusByCodeAndDate(stockCode, tradeDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int importStockHighLowStatus(List<TStockHighLowStatus> stockHighLowStatusList, Date tradeDate)
|
||||
{
|
||||
if (stockHighLowStatusList == null || stockHighLowStatusList.isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 设置交易日期
|
||||
for (TStockHighLowStatus stockHighLowStatus : stockHighLowStatusList)
|
||||
{
|
||||
if (stockHighLowStatus.getTradeDate() == null)
|
||||
{
|
||||
stockHighLowStatus.setTradeDate(tradeDate);
|
||||
}
|
||||
// 设置默认值
|
||||
if (stockHighLowStatus.getIsNewHigh() == null)
|
||||
{
|
||||
stockHighLowStatus.setIsNewHigh(0);
|
||||
}
|
||||
if (stockHighLowStatus.getIsNewLow() == null)
|
||||
{
|
||||
stockHighLowStatus.setIsNewLow(0);
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
int batchSize = 500;
|
||||
|
||||
// 分批导入数据
|
||||
for (int i = 0; i < stockHighLowStatusList.size(); i += batchSize)
|
||||
{
|
||||
int end = Math.min(i + batchSize, stockHighLowStatusList.size());
|
||||
List<TStockHighLowStatus> batchList = stockHighLowStatusList.subList(i, end);
|
||||
count += stockHighLowStatusMapper.batchUpsertStockHighLowStatus(batchList);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockHighLowStatus> selectNewHighStockList(TStockHighLowStatus stockHighLowStatus)
|
||||
{
|
||||
return stockHighLowStatusMapper.selectNewHighStockList(stockHighLowStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TStockHighLowStatus> selectNewLowStockList(TStockHighLowStatus stockHighLowStatus)
|
||||
{
|
||||
return stockHighLowStatusMapper.selectNewLowStockList(stockHighLowStatus);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.newstocksystem.mapper.TIndustryIndexMapper">
|
||||
<resultMap type="com.ruoyi.newstocksystem.domain.TIndustryIndex" id="IndustryIndexResult">
|
||||
<result property="industryIndexCode" column="industry_index_code" />
|
||||
<result property="industryIndexName" column="industry_index_name" />
|
||||
<result property="componentCount" column="component_count" />
|
||||
<result property="tradeDate" column="trade_date" />
|
||||
<result property="openPrice" column="open_price" />
|
||||
<result property="closePrice" column="close_price" />
|
||||
<result property="volume" column="volume" />
|
||||
<result property="turnover" column="turnover" />
|
||||
<result property="totalMarketCap" column="total_market_cap" />
|
||||
<result property="freeCirculationCap" column="free_circulation_cap" />
|
||||
<result property="priceChangeRate" column="price_change_rate" />
|
||||
<result property="peTtm" column="pe_ttm" />
|
||||
<result property="peTtmMedian" column="pe_ttm_median" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectIndustryIndexVo">
|
||||
select industry_index_code, industry_index_name, component_count, trade_date,
|
||||
open_price, close_price, volume, turnover, total_market_cap,
|
||||
free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median,
|
||||
create_time, update_time
|
||||
from t_industry_index
|
||||
</sql>
|
||||
|
||||
<select id="selectIndustryIndexByCodeAndDate" resultMap="IndustryIndexResult">
|
||||
<include refid="selectIndustryIndexVo" />
|
||||
where industry_index_code = #{param1} and trade_date = #{param2}
|
||||
</select>
|
||||
|
||||
<select id="selectIndustryIndexList" parameterType="com.ruoyi.newstocksystem.domain.TIndustryIndex" resultMap="IndustryIndexResult">
|
||||
<include refid="selectIndustryIndexVo" />
|
||||
<where>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">
|
||||
and industry_index_code = #{industryIndexCode}
|
||||
</if>
|
||||
<if test="industryIndexName != null and industryIndexName != ''">
|
||||
and industry_index_name like concat('%', #{industryIndexName}, '%')
|
||||
</if>
|
||||
<if test="tradeDate != null">
|
||||
and trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
|
||||
and trade_date >= #{params.beginTradeDate}
|
||||
</if>
|
||||
<if test="params.endTradeDate != null and params.endTradeDate != ''">
|
||||
and trade_date <= #{params.endTradeDate}
|
||||
</if>
|
||||
</where>
|
||||
order by trade_date desc, industry_index_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectDistinctIndustryIndexList" resultMap="IndustryIndexResult">
|
||||
select distinct industry_index_code, industry_index_name
|
||||
from t_industry_index
|
||||
order by industry_index_code
|
||||
</select>
|
||||
|
||||
<select id="selectTradeDates" resultType="String">
|
||||
select distinct DATE_FORMAT(trade_date, '%Y-%m-%d') as trade_date
|
||||
from t_industry_index
|
||||
order by trade_date desc
|
||||
</select>
|
||||
|
||||
<insert id="insertIndustryIndex" parameterType="com.ruoyi.newstocksystem.domain.TIndustryIndex">
|
||||
insert into t_industry_index
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">industry_index_code,</if>
|
||||
<if test="industryIndexName != null and industryIndexName != ''">industry_index_name,</if>
|
||||
<if test="componentCount != null">component_count,</if>
|
||||
<if test="tradeDate != null">trade_date,</if>
|
||||
<if test="openPrice != null">open_price,</if>
|
||||
<if test="closePrice != null">close_price,</if>
|
||||
<if test="volume != null">volume,</if>
|
||||
<if test="turnover != null">turnover,</if>
|
||||
<if test="totalMarketCap != null">total_market_cap,</if>
|
||||
<if test="freeCirculationCap != null">free_circulation_cap,</if>
|
||||
<if test="priceChangeRate != null">price_change_rate,</if>
|
||||
<if test="peTtm != null">pe_ttm,</if>
|
||||
<if test="peTtmMedian != null">pe_ttm_median,</if>
|
||||
create_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">#{industryIndexCode},</if>
|
||||
<if test="industryIndexName != null and industryIndexName != ''">#{industryIndexName},</if>
|
||||
<if test="componentCount != null">#{componentCount},</if>
|
||||
<if test="tradeDate != null">#{tradeDate},</if>
|
||||
<if test="openPrice != null">#{openPrice},</if>
|
||||
<if test="closePrice != null">#{closePrice},</if>
|
||||
<if test="volume != null">#{volume},</if>
|
||||
<if test="turnover != null">#{turnover},</if>
|
||||
<if test="totalMarketCap != null">#{totalMarketCap},</if>
|
||||
<if test="freeCirculationCap != null">#{freeCirculationCap},</if>
|
||||
<if test="priceChangeRate != null">#{priceChangeRate},</if>
|
||||
<if test="peTtm != null">#{peTtm},</if>
|
||||
<if test="peTtmMedian != null">#{peTtmMedian},</if>
|
||||
NOW(),
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateIndustryIndex" parameterType="com.ruoyi.newstocksystem.domain.TIndustryIndex">
|
||||
update t_industry_index
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="industryIndexName != null and industryIndexName != ''">industry_index_name = #{industryIndexName},</if>
|
||||
<if test="componentCount != null">component_count = #{componentCount},</if>
|
||||
<if test="openPrice != null">open_price = #{openPrice},</if>
|
||||
<if test="closePrice != null">close_price = #{closePrice},</if>
|
||||
<if test="volume != null">volume = #{volume},</if>
|
||||
<if test="turnover != null">turnover = #{turnover},</if>
|
||||
<if test="totalMarketCap != null">total_market_cap = #{totalMarketCap},</if>
|
||||
<if test="freeCirculationCap != null">free_circulation_cap = #{freeCirculationCap},</if>
|
||||
<if test="priceChangeRate != null">price_change_rate = #{priceChangeRate},</if>
|
||||
<if test="peTtm != null">pe_ttm = #{peTtm},</if>
|
||||
<if test="peTtmMedian != null">pe_ttm_median = #{peTtmMedian},</if>
|
||||
update_time = NOW(),
|
||||
</trim>
|
||||
where industry_index_code = #{industryIndexCode} and trade_date = #{tradeDate}
|
||||
</update>
|
||||
|
||||
<delete id="deleteIndustryIndexByCodeAndDate">
|
||||
delete from t_industry_index where industry_index_code = #{param1} and trade_date = #{param2}
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertIndustryIndex" parameterType="java.util.List">
|
||||
insert into t_industry_index(industry_index_code, industry_index_name, component_count, trade_date,
|
||||
open_price, close_price, volume, turnover, total_market_cap,
|
||||
free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.industryIndexCode}, #{item.industryIndexName}, #{item.componentCount}, #{item.tradeDate},
|
||||
#{item.openPrice}, #{item.closePrice}, #{item.volume}, #{item.turnover}, #{item.totalMarketCap},
|
||||
#{item.freeCirculationCap}, #{item.priceChangeRate}, #{item.peTtm}, #{item.peTtmMedian}, NOW())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchUpsertIndustryIndex" parameterType="java.util.List">
|
||||
insert into t_industry_index(industry_index_code, industry_index_name, component_count, trade_date,
|
||||
open_price, close_price, volume, turnover, total_market_cap,
|
||||
free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.industryIndexCode}, #{item.industryIndexName}, #{item.componentCount}, #{item.tradeDate},
|
||||
#{item.openPrice}, #{item.closePrice}, #{item.volume}, #{item.turnover}, #{item.totalMarketCap},
|
||||
#{item.freeCirculationCap}, #{item.priceChangeRate}, #{item.peTtm}, #{item.peTtmMedian}, NOW())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
industry_index_name = VALUES(industry_index_name),
|
||||
component_count = VALUES(component_count),
|
||||
open_price = VALUES(open_price),
|
||||
close_price = VALUES(close_price),
|
||||
volume = VALUES(volume),
|
||||
turnover = VALUES(turnover),
|
||||
total_market_cap = VALUES(total_market_cap),
|
||||
free_circulation_cap = VALUES(free_circulation_cap),
|
||||
price_change_rate = VALUES(price_change_rate),
|
||||
pe_ttm = VALUES(pe_ttm),
|
||||
pe_ttm_median = VALUES(pe_ttm_median),
|
||||
update_time = NOW()
|
||||
</insert>
|
||||
</mapper>
|
||||
@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.newstocksystem.mapper.TStockBasicMapper">
|
||||
<resultMap type="com.ruoyi.newstocksystem.domain.TStockBasic" id="StockBasicResult">
|
||||
<id property="stockCode" column="stock_code" />
|
||||
<result property="stockName" column="stock_name" />
|
||||
<result property="listingDate" column="listing_date" />
|
||||
<result property="listingDays" column="listing_days" />
|
||||
<result property="isSt" column="is_st" />
|
||||
<result property="isStarSt" column="is_star_st" />
|
||||
<result property="industryIndexCode" column="industry_index_code" />
|
||||
<result property="industryIndexName" column="industry_index_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectStockBasicVo">
|
||||
select stock_code, stock_name, listing_date, listing_days, is_st, is_star_st,
|
||||
industry_index_code, industry_index_name, create_time, update_time
|
||||
from t_stock_basic
|
||||
</sql>
|
||||
|
||||
<select id="selectStockBasicByCode" parameterType="String" resultMap="StockBasicResult">
|
||||
<include refid="selectStockBasicVo" />
|
||||
where stock_code = #{stockCode}
|
||||
</select>
|
||||
|
||||
<select id="selectStockBasicList" parameterType="com.ruoyi.newstocksystem.domain.TStockBasic" resultMap="StockBasicResult">
|
||||
<include refid="selectStockBasicVo" />
|
||||
<where>
|
||||
<if test="stockCode != null and stockCode != ''">
|
||||
and stock_code like concat('%', #{stockCode}, '%')
|
||||
</if>
|
||||
<if test="stockName != null and stockName != ''">
|
||||
and stock_name like concat('%', #{stockName}, '%')
|
||||
</if>
|
||||
<if test="isSt != null">
|
||||
and is_st = #{isSt}
|
||||
</if>
|
||||
<if test="isStarSt != null">
|
||||
and is_star_st = #{isStarSt}
|
||||
</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">
|
||||
and industry_index_code = #{industryIndexCode}
|
||||
</if>
|
||||
<if test="industryIndexName != null and industryIndexName != ''">
|
||||
and industry_index_name like concat('%', #{industryIndexName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by stock_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectStockBasicByIndustryCode" parameterType="String" resultMap="StockBasicResult">
|
||||
<include refid="selectStockBasicVo" />
|
||||
where industry_index_code = #{industryIndexCode}
|
||||
order by stock_code asc
|
||||
</select>
|
||||
|
||||
<insert id="insertStockBasic" parameterType="com.ruoyi.newstocksystem.domain.TStockBasic">
|
||||
insert into t_stock_basic
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="stockCode != null and stockCode != ''">stock_code,</if>
|
||||
<if test="stockName != null and stockName != ''">stock_name,</if>
|
||||
<if test="listingDate != null">listing_date,</if>
|
||||
<if test="listingDays != null">listing_days,</if>
|
||||
<if test="isSt != null">is_st,</if>
|
||||
<if test="isStarSt != null">is_star_st,</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">industry_index_code,</if>
|
||||
<if test="industryIndexName != null and industryIndexName != ''">industry_index_name,</if>
|
||||
create_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="stockCode != null and stockCode != ''">#{stockCode},</if>
|
||||
<if test="stockName != null and stockName != ''">#{stockName},</if>
|
||||
<if test="listingDate != null">#{listingDate},</if>
|
||||
<if test="listingDays != null">#{listingDays},</if>
|
||||
<if test="isSt != null">#{isSt},</if>
|
||||
<if test="isStarSt != null">#{isStarSt},</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">#{industryIndexCode},</if>
|
||||
<if test="industryIndexName != null and industryIndexName != ''">#{industryIndexName},</if>
|
||||
NOW(),
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateStockBasic" parameterType="com.ruoyi.newstocksystem.domain.TStockBasic">
|
||||
update t_stock_basic
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="stockName != null and stockName != ''">stock_name = #{stockName},</if>
|
||||
<if test="listingDate != null">listing_date = #{listingDate},</if>
|
||||
<if test="listingDays != null">listing_days = #{listingDays},</if>
|
||||
<if test="isSt != null">is_st = #{isSt},</if>
|
||||
<if test="isStarSt != null">is_star_st = #{isStarSt},</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">industry_index_code = #{industryIndexCode},</if>
|
||||
<if test="industryIndexName != null and industryIndexName != ''">industry_index_name = #{industryIndexName},</if>
|
||||
update_time = NOW(),
|
||||
</trim>
|
||||
where stock_code = #{stockCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteStockBasicByCode" parameterType="String">
|
||||
delete from t_stock_basic where stock_code = #{stockCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteStockBasicByCodes" parameterType="String">
|
||||
delete from t_stock_basic where stock_code in
|
||||
<foreach item="stockCode" collection="array" open="(" separator="," close=")">
|
||||
#{stockCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertStockBasic" parameterType="java.util.List">
|
||||
insert into t_stock_basic(stock_code, stock_name, listing_date, listing_days,
|
||||
is_st, is_star_st, industry_index_code, industry_index_name, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.stockCode}, #{item.stockName}, #{item.listingDate}, #{item.listingDays},
|
||||
#{item.isSt}, #{item.isStarSt}, #{item.industryIndexCode}, #{item.industryIndexName}, NOW())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchUpsertStockBasic" parameterType="java.util.List">
|
||||
insert into t_stock_basic(stock_code, stock_name, listing_date, listing_days,
|
||||
is_st, is_star_st, industry_index_code, industry_index_name, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.stockCode}, #{item.stockName}, #{item.listingDate}, #{item.listingDays},
|
||||
#{item.isSt}, #{item.isStarSt}, #{item.industryIndexCode}, #{item.industryIndexName}, NOW())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
stock_name = VALUES(stock_name),
|
||||
listing_date = VALUES(listing_date),
|
||||
listing_days = VALUES(listing_days),
|
||||
is_st = VALUES(is_st),
|
||||
is_star_st = VALUES(is_star_st),
|
||||
industry_index_code = VALUES(industry_index_code),
|
||||
industry_index_name = VALUES(industry_index_name),
|
||||
update_time = NOW()
|
||||
</insert>
|
||||
</mapper>
|
||||
@ -0,0 +1,242 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.newstocksystem.mapper.TStockDailyTradeMapper">
|
||||
<resultMap type="com.ruoyi.newstocksystem.domain.TStockDailyTrade" id="StockDailyTradeResult">
|
||||
<result property="stockCode" column="stock_code" />
|
||||
<result property="tradeDate" column="trade_date" />
|
||||
<result property="openPrice" column="open_price" />
|
||||
<result property="closePrice" column="close_price" />
|
||||
<result property="highPrice" column="high_price" />
|
||||
<result property="lowPrice" column="low_price" />
|
||||
<result property="priceChangeRate" column="price_change_rate" />
|
||||
<result property="volume" column="volume" />
|
||||
<result property="turnover" column="turnover" />
|
||||
<result property="freeCirculationCap" column="free_circulation_cap" />
|
||||
<result property="isLimitUp" column="is_limit_up" />
|
||||
<result property="isLimitDown" column="is_limit_down" />
|
||||
<result property="momentum10d" column="momentum_10d" />
|
||||
<result property="momentum20d" column="momentum_20d" />
|
||||
<result property="momentum60d" column="momentum_60d" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.ruoyi.newstocksystem.domain.TStockDailyTrade" id="StockDailyTradeWithBasicResult" extends="StockDailyTradeResult">
|
||||
<result property="stockName" column="stock_name" />
|
||||
<result property="industryIndexCode" column="industry_index_code" />
|
||||
<result property="industryIndexName" column="industry_index_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectStockDailyTradeVo">
|
||||
select stock_code, trade_date, open_price, close_price, high_price, low_price,
|
||||
price_change_rate, volume, turnover, free_circulation_cap,
|
||||
is_limit_up, is_limit_down, momentum_10d, momentum_20d, momentum_60d, create_time
|
||||
from t_stock_daily_trade
|
||||
</sql>
|
||||
|
||||
<sql id="selectStockDailyTradeWithBasicVo">
|
||||
select t.stock_code, t.trade_date, t.open_price, t.close_price, t.high_price, t.low_price,
|
||||
t.price_change_rate, t.volume, t.turnover, t.free_circulation_cap,
|
||||
t.is_limit_up, t.is_limit_down, t.momentum_10d, t.momentum_20d, t.momentum_60d, t.create_time,
|
||||
b.stock_name, b.industry_index_code, b.industry_index_name
|
||||
from t_stock_daily_trade t
|
||||
left join t_stock_basic b on t.stock_code = b.stock_code
|
||||
</sql>
|
||||
|
||||
<select id="selectStockDailyTradeByCodeAndDate" resultMap="StockDailyTradeResult">
|
||||
<include refid="selectStockDailyTradeVo" />
|
||||
where stock_code = #{stockCode} and trade_date = #{tradeDate}
|
||||
</select>
|
||||
|
||||
<select id="selectStockDailyTradeList" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade" resultMap="StockDailyTradeResult">
|
||||
<include refid="selectStockDailyTradeVo" />
|
||||
<where>
|
||||
<if test="stockCode != null and stockCode != ''">
|
||||
and stock_code = #{stockCode}
|
||||
</if>
|
||||
<if test="tradeDate != null">
|
||||
and trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="isLimitUp != null">
|
||||
and is_limit_up = #{isLimitUp}
|
||||
</if>
|
||||
<if test="isLimitDown != null">
|
||||
and is_limit_down = #{isLimitDown}
|
||||
</if>
|
||||
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
|
||||
and trade_date >= #{params.beginTradeDate}
|
||||
</if>
|
||||
<if test="params.endTradeDate != null and params.endTradeDate != ''">
|
||||
and trade_date <= #{params.endTradeDate}
|
||||
</if>
|
||||
</where>
|
||||
order by trade_date desc, stock_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectStockDailyTradeListWithBasic" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade" resultMap="StockDailyTradeWithBasicResult">
|
||||
<include refid="selectStockDailyTradeWithBasicVo" />
|
||||
<where>
|
||||
<if test="stockCode != null and stockCode != ''">
|
||||
and t.stock_code like concat('%', #{stockCode}, '%')
|
||||
</if>
|
||||
<if test="stockName != null and stockName != ''">
|
||||
and b.stock_name like concat('%', #{stockName}, '%')
|
||||
</if>
|
||||
<if test="tradeDate != null">
|
||||
and t.trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">
|
||||
and b.industry_index_code = #{industryIndexCode}
|
||||
</if>
|
||||
<if test="isLimitUp != null">
|
||||
and t.is_limit_up = #{isLimitUp}
|
||||
</if>
|
||||
<if test="isLimitDown != null">
|
||||
and t.is_limit_down = #{isLimitDown}
|
||||
</if>
|
||||
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
|
||||
and t.trade_date >= #{params.beginTradeDate}
|
||||
</if>
|
||||
<if test="params.endTradeDate != null and params.endTradeDate != ''">
|
||||
and t.trade_date <= #{params.endTradeDate}
|
||||
</if>
|
||||
</where>
|
||||
order by t.trade_date desc, t.stock_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectTradeDates" resultType="String">
|
||||
select distinct DATE_FORMAT(trade_date, '%Y-%m-%d') as trade_date
|
||||
from t_stock_daily_trade
|
||||
order by trade_date desc
|
||||
</select>
|
||||
|
||||
<select id="selectLimitUpStockList" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade" resultMap="StockDailyTradeWithBasicResult">
|
||||
<include refid="selectStockDailyTradeWithBasicVo" />
|
||||
<where>
|
||||
t.is_limit_up = 1
|
||||
<if test="tradeDate != null">
|
||||
and t.trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">
|
||||
and b.industry_index_code = #{industryIndexCode}
|
||||
</if>
|
||||
</where>
|
||||
order by t.price_change_rate desc
|
||||
</select>
|
||||
|
||||
<select id="selectStrongStockList" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade" resultMap="StockDailyTradeWithBasicResult">
|
||||
<include refid="selectStockDailyTradeWithBasicVo" />
|
||||
<where>
|
||||
<if test="tradeDate != null">
|
||||
and t.trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">
|
||||
and b.industry_index_code = #{industryIndexCode}
|
||||
</if>
|
||||
</where>
|
||||
order by t.momentum_20d desc, t.momentum_10d desc
|
||||
</select>
|
||||
|
||||
<insert id="insertStockDailyTrade" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade">
|
||||
insert into t_stock_daily_trade
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="stockCode != null and stockCode != ''">stock_code,</if>
|
||||
<if test="tradeDate != null">trade_date,</if>
|
||||
<if test="openPrice != null">open_price,</if>
|
||||
<if test="closePrice != null">close_price,</if>
|
||||
<if test="highPrice != null">high_price,</if>
|
||||
<if test="lowPrice != null">low_price,</if>
|
||||
<if test="priceChangeRate != null">price_change_rate,</if>
|
||||
<if test="volume != null">volume,</if>
|
||||
<if test="turnover != null">turnover,</if>
|
||||
<if test="freeCirculationCap != null">free_circulation_cap,</if>
|
||||
<if test="isLimitUp != null">is_limit_up,</if>
|
||||
<if test="isLimitDown != null">is_limit_down,</if>
|
||||
<if test="momentum10d != null">momentum_10d,</if>
|
||||
<if test="momentum20d != null">momentum_20d,</if>
|
||||
<if test="momentum60d != null">momentum_60d,</if>
|
||||
create_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="stockCode != null and stockCode != ''">#{stockCode},</if>
|
||||
<if test="tradeDate != null">#{tradeDate},</if>
|
||||
<if test="openPrice != null">#{openPrice},</if>
|
||||
<if test="closePrice != null">#{closePrice},</if>
|
||||
<if test="highPrice != null">#{highPrice},</if>
|
||||
<if test="lowPrice != null">#{lowPrice},</if>
|
||||
<if test="priceChangeRate != null">#{priceChangeRate},</if>
|
||||
<if test="volume != null">#{volume},</if>
|
||||
<if test="turnover != null">#{turnover},</if>
|
||||
<if test="freeCirculationCap != null">#{freeCirculationCap},</if>
|
||||
<if test="isLimitUp != null">#{isLimitUp},</if>
|
||||
<if test="isLimitDown != null">#{isLimitDown},</if>
|
||||
<if test="momentum10d != null">#{momentum10d},</if>
|
||||
<if test="momentum20d != null">#{momentum20d},</if>
|
||||
<if test="momentum60d != null">#{momentum60d},</if>
|
||||
NOW(),
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateStockDailyTrade" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade">
|
||||
update t_stock_daily_trade
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="openPrice != null">open_price = #{openPrice},</if>
|
||||
<if test="closePrice != null">close_price = #{closePrice},</if>
|
||||
<if test="highPrice != null">high_price = #{highPrice},</if>
|
||||
<if test="lowPrice != null">low_price = #{lowPrice},</if>
|
||||
<if test="priceChangeRate != null">price_change_rate = #{priceChangeRate},</if>
|
||||
<if test="volume != null">volume = #{volume},</if>
|
||||
<if test="turnover != null">turnover = #{turnover},</if>
|
||||
<if test="freeCirculationCap != null">free_circulation_cap = #{freeCirculationCap},</if>
|
||||
<if test="isLimitUp != null">is_limit_up = #{isLimitUp},</if>
|
||||
<if test="isLimitDown != null">is_limit_down = #{isLimitDown},</if>
|
||||
<if test="momentum10d != null">momentum_10d = #{momentum10d},</if>
|
||||
<if test="momentum20d != null">momentum_20d = #{momentum20d},</if>
|
||||
<if test="momentum60d != null">momentum_60d = #{momentum60d},</if>
|
||||
</trim>
|
||||
where stock_code = #{stockCode} and trade_date = #{tradeDate}
|
||||
</update>
|
||||
|
||||
<delete id="deleteStockDailyTradeByCodeAndDate">
|
||||
delete from t_stock_daily_trade where stock_code = #{stockCode} and trade_date = #{tradeDate}
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertStockDailyTrade" parameterType="java.util.List">
|
||||
insert into t_stock_daily_trade(stock_code, trade_date, open_price, close_price, high_price, low_price,
|
||||
price_change_rate, volume, turnover, free_circulation_cap,
|
||||
is_limit_up, is_limit_down, momentum_10d, momentum_20d, momentum_60d, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.stockCode}, #{item.tradeDate}, #{item.openPrice}, #{item.closePrice}, #{item.highPrice}, #{item.lowPrice},
|
||||
#{item.priceChangeRate}, #{item.volume}, #{item.turnover}, #{item.freeCirculationCap},
|
||||
#{item.isLimitUp}, #{item.isLimitDown}, #{item.momentum10d}, #{item.momentum20d}, #{item.momentum60d}, NOW())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchUpsertStockDailyTrade" parameterType="java.util.List">
|
||||
insert into t_stock_daily_trade(stock_code, trade_date, open_price, close_price, high_price, low_price,
|
||||
price_change_rate, volume, turnover, free_circulation_cap,
|
||||
is_limit_up, is_limit_down, momentum_10d, momentum_20d, momentum_60d, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.stockCode}, #{item.tradeDate}, #{item.openPrice}, #{item.closePrice}, #{item.highPrice}, #{item.lowPrice},
|
||||
#{item.priceChangeRate}, #{item.volume}, #{item.turnover}, #{item.freeCirculationCap},
|
||||
#{item.isLimitUp}, #{item.isLimitDown}, #{item.momentum10d}, #{item.momentum20d}, #{item.momentum60d}, NOW())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
open_price = VALUES(open_price),
|
||||
close_price = VALUES(close_price),
|
||||
high_price = VALUES(high_price),
|
||||
low_price = VALUES(low_price),
|
||||
price_change_rate = VALUES(price_change_rate),
|
||||
volume = VALUES(volume),
|
||||
turnover = VALUES(turnover),
|
||||
free_circulation_cap = VALUES(free_circulation_cap),
|
||||
is_limit_up = VALUES(is_limit_up),
|
||||
is_limit_down = VALUES(is_limit_down),
|
||||
momentum_10d = VALUES(momentum_10d),
|
||||
momentum_20d = VALUES(momentum_20d),
|
||||
momentum_60d = VALUES(momentum_60d)
|
||||
</insert>
|
||||
</mapper>
|
||||
@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.newstocksystem.mapper.TStockHighLowStatusMapper">
|
||||
<resultMap type="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" id="StockHighLowStatusResult">
|
||||
<result property="stockCode" column="stock_code" />
|
||||
<result property="tradeDate" column="trade_date" />
|
||||
<result property="isNewHigh" column="is_new_high" />
|
||||
<result property="newHighDate" column="new_high_date" />
|
||||
<result property="isNewLow" column="is_new_low" />
|
||||
<result property="newLowDate" column="new_low_date" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" id="StockHighLowStatusWithBasicResult" extends="StockHighLowStatusResult">
|
||||
<result property="stockName" column="stock_name" />
|
||||
<result property="industryIndexCode" column="industry_index_code" />
|
||||
<result property="industryIndexName" column="industry_index_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectStockHighLowStatusVo">
|
||||
select stock_code, trade_date, is_new_high, new_high_date, is_new_low, new_low_date, create_time
|
||||
from t_stock_high_low_status
|
||||
</sql>
|
||||
|
||||
<sql id="selectStockHighLowStatusWithBasicVo">
|
||||
select h.stock_code, h.trade_date, h.is_new_high, h.new_high_date, h.is_new_low, h.new_low_date, h.create_time,
|
||||
b.stock_name, b.industry_index_code, b.industry_index_name
|
||||
from t_stock_high_low_status h
|
||||
left join t_stock_basic b on h.stock_code = b.stock_code
|
||||
</sql>
|
||||
|
||||
<select id="selectStockHighLowStatusByCodeAndDate" resultMap="StockHighLowStatusResult">
|
||||
<include refid="selectStockHighLowStatusVo" />
|
||||
where stock_code = #{stockCode} and trade_date = #{tradeDate}
|
||||
</select>
|
||||
|
||||
<select id="selectStockHighLowStatusList" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" resultMap="StockHighLowStatusResult">
|
||||
<include refid="selectStockHighLowStatusVo" />
|
||||
<where>
|
||||
<if test="stockCode != null and stockCode != ''">
|
||||
and stock_code = #{stockCode}
|
||||
</if>
|
||||
<if test="tradeDate != null">
|
||||
and trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="isNewHigh != null">
|
||||
and is_new_high = #{isNewHigh}
|
||||
</if>
|
||||
<if test="isNewLow != null">
|
||||
and is_new_low = #{isNewLow}
|
||||
</if>
|
||||
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
|
||||
and trade_date >= #{params.beginTradeDate}
|
||||
</if>
|
||||
<if test="params.endTradeDate != null and params.endTradeDate != ''">
|
||||
and trade_date <= #{params.endTradeDate}
|
||||
</if>
|
||||
</where>
|
||||
order by trade_date desc, stock_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectStockHighLowStatusListWithBasic" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" resultMap="StockHighLowStatusWithBasicResult">
|
||||
<include refid="selectStockHighLowStatusWithBasicVo" />
|
||||
<where>
|
||||
<if test="stockCode != null and stockCode != ''">
|
||||
and h.stock_code like concat('%', #{stockCode}, '%')
|
||||
</if>
|
||||
<if test="stockName != null and stockName != ''">
|
||||
and b.stock_name like concat('%', #{stockName}, '%')
|
||||
</if>
|
||||
<if test="tradeDate != null">
|
||||
and h.trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">
|
||||
and b.industry_index_code = #{industryIndexCode}
|
||||
</if>
|
||||
<if test="isNewHigh != null">
|
||||
and h.is_new_high = #{isNewHigh}
|
||||
</if>
|
||||
<if test="isNewLow != null">
|
||||
and h.is_new_low = #{isNewLow}
|
||||
</if>
|
||||
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
|
||||
and h.trade_date >= #{params.beginTradeDate}
|
||||
</if>
|
||||
<if test="params.endTradeDate != null and params.endTradeDate != ''">
|
||||
and h.trade_date <= #{params.endTradeDate}
|
||||
</if>
|
||||
</where>
|
||||
order by h.trade_date desc, h.stock_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectNewHighStockList" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" resultMap="StockHighLowStatusWithBasicResult">
|
||||
<include refid="selectStockHighLowStatusWithBasicVo" />
|
||||
<where>
|
||||
h.is_new_high = 1
|
||||
<if test="tradeDate != null">
|
||||
and h.trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">
|
||||
and b.industry_index_code = #{industryIndexCode}
|
||||
</if>
|
||||
</where>
|
||||
order by h.trade_date desc, h.stock_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectNewLowStockList" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" resultMap="StockHighLowStatusWithBasicResult">
|
||||
<include refid="selectStockHighLowStatusWithBasicVo" />
|
||||
<where>
|
||||
h.is_new_low = 1
|
||||
<if test="tradeDate != null">
|
||||
and h.trade_date = #{tradeDate}
|
||||
</if>
|
||||
<if test="industryIndexCode != null and industryIndexCode != ''">
|
||||
and b.industry_index_code = #{industryIndexCode}
|
||||
</if>
|
||||
</where>
|
||||
order by h.trade_date desc, h.stock_code asc
|
||||
</select>
|
||||
|
||||
<insert id="insertStockHighLowStatus" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus">
|
||||
insert into t_stock_high_low_status
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="stockCode != null and stockCode != ''">stock_code,</if>
|
||||
<if test="tradeDate != null">trade_date,</if>
|
||||
<if test="isNewHigh != null">is_new_high,</if>
|
||||
<if test="newHighDate != null">new_high_date,</if>
|
||||
<if test="isNewLow != null">is_new_low,</if>
|
||||
<if test="newLowDate != null">new_low_date,</if>
|
||||
create_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="stockCode != null and stockCode != ''">#{stockCode},</if>
|
||||
<if test="tradeDate != null">#{tradeDate},</if>
|
||||
<if test="isNewHigh != null">#{isNewHigh},</if>
|
||||
<if test="newHighDate != null">#{newHighDate},</if>
|
||||
<if test="isNewLow != null">#{isNewLow},</if>
|
||||
<if test="newLowDate != null">#{newLowDate},</if>
|
||||
NOW(),
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateStockHighLowStatus" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus">
|
||||
update t_stock_high_low_status
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="isNewHigh != null">is_new_high = #{isNewHigh},</if>
|
||||
<if test="newHighDate != null">new_high_date = #{newHighDate},</if>
|
||||
<if test="isNewLow != null">is_new_low = #{isNewLow},</if>
|
||||
<if test="newLowDate != null">new_low_date = #{newLowDate},</if>
|
||||
</trim>
|
||||
where stock_code = #{stockCode} and trade_date = #{tradeDate}
|
||||
</update>
|
||||
|
||||
<delete id="deleteStockHighLowStatusByCodeAndDate">
|
||||
delete from t_stock_high_low_status where stock_code = #{stockCode} and trade_date = #{tradeDate}
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertStockHighLowStatus" parameterType="java.util.List">
|
||||
insert into t_stock_high_low_status(stock_code, trade_date, is_new_high, new_high_date, is_new_low, new_low_date, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.stockCode}, #{item.tradeDate}, #{item.isNewHigh}, #{item.newHighDate}, #{item.isNewLow}, #{item.newLowDate}, NOW())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchUpsertStockHighLowStatus" parameterType="java.util.List">
|
||||
insert into t_stock_high_low_status(stock_code, trade_date, is_new_high, new_high_date, is_new_low, new_low_date, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.stockCode}, #{item.tradeDate}, #{item.isNewHigh}, #{item.newHighDate}, #{item.isNewLow}, #{item.newLowDate}, NOW())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
is_new_high = VALUES(is_new_high),
|
||||
new_high_date = VALUES(new_high_date),
|
||||
is_new_low = VALUES(is_new_low),
|
||||
new_low_date = VALUES(new_low_date)
|
||||
</insert>
|
||||
</mapper>
|
||||
@ -0,0 +1,197 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 股票行情数据 API
|
||||
export default {
|
||||
// ========================= 行业指数相关 =========================
|
||||
|
||||
// 查询行业指数列表
|
||||
listIndustryIndex(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/industryIndex/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// 查询所有行业指数基础信息(去重)
|
||||
getDistinctIndustryIndexList() {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/industryIndex/distinctList',
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
|
||||
// 导出行业指数数据
|
||||
exportIndustryIndex(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/industryIndex/export',
|
||||
method: 'post',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
},
|
||||
|
||||
// 查询行业指数交易日期列表
|
||||
getIndustryIndexTradeDates() {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/industryIndex/tradeDates',
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
|
||||
// ========================= 个股基础信息相关 =========================
|
||||
|
||||
// 查询个股基础信息列表
|
||||
listStockBasic(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockBasic/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// 根据证券代码获取个股基础信息
|
||||
getStockBasicInfo(stockCode) {
|
||||
return request({
|
||||
url: `/newstocksystem/stockdata/stockBasic/${stockCode}`,
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
|
||||
// 导出个股基础信息
|
||||
exportStockBasic(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockBasic/export',
|
||||
method: 'post',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
},
|
||||
|
||||
// 新增个股基础信息
|
||||
addStockBasic(data) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockBasic',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
|
||||
// 修改个股基础信息
|
||||
updateStockBasic(data) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockBasic',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
|
||||
// 删除个股基础信息
|
||||
deleteStockBasic(stockCodes) {
|
||||
return request({
|
||||
url: `/newstocksystem/stockdata/stockBasic/${stockCodes}`,
|
||||
method: 'delete'
|
||||
})
|
||||
},
|
||||
|
||||
// ========================= 个股每日交易数据相关 =========================
|
||||
|
||||
// 查询个股每日交易数据列表
|
||||
listStockDailyTrade(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockDailyTrade/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// 查询个股每日交易数据列表(包含基础信息)
|
||||
listStockDailyTradeWithBasic(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockDailyTrade/listWithBasic',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// 导出个股每日交易数据
|
||||
exportStockDailyTrade(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockDailyTrade/export',
|
||||
method: 'post',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
},
|
||||
|
||||
// 查询个股交易日期列表
|
||||
getStockDailyTradeDates() {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockDailyTrade/tradeDates',
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
|
||||
// 查询涨停股列表
|
||||
listLimitUpStocks(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockDailyTrade/limitUpList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// 查询强势股列表
|
||||
listStrongStocks(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockDailyTrade/strongList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// ========================= 个股新高新低状态相关 =========================
|
||||
|
||||
// 查询个股新高新低状态列表
|
||||
listStockHighLowStatus(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockHighLow/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// 查询个股新高新低状态列表(包含基础信息)
|
||||
listStockHighLowStatusWithBasic(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockHighLow/listWithBasic',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// 查询创新高股票列表
|
||||
listNewHighStocks(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockHighLow/newHighList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
// 查询创新低股票列表
|
||||
listNewLowStocks(query) {
|
||||
return request({
|
||||
url: '/newstocksystem/stockdata/stockHighLow/newLowList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 导入接口 URL 常量
|
||||
export const IMPORT_URLS = {
|
||||
industryIndex: '/newstocksystem/stockdata/industryIndex/importData',
|
||||
stockBasic: '/newstocksystem/stockdata/stockBasic/importData',
|
||||
stockDailyTrade: '/newstocksystem/stockdata/stockDailyTrade/importData'
|
||||
}
|
||||
Loading…
Reference in new issue