package link.at17.mid.tushare.dao;

import com.alibaba.fastjson2.JSONObject;

import link.at17.mid.tushare.annotation.BatchInsert;
import link.at17.mid.tushare.annotation.BatchList;
import link.at17.mid.tushare.data.models.StockValue;
import link.at17.mid.tushare.data.models.interfaces.ITsTradeDate;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;

@Component
@Mapper
public interface ThsDailyDao extends ITsTradeDate {
    /**
     * 批量插入/更新日线数据
     * @param list
     */
    @BatchInsert
    int insertOrUpdateList(@BatchList List<JSONObject> list);
    /**
     * 获取板块日线数据
     * @param stockCode 板块代码，不允许为空
     * @param endDate 结束日期，留空则为最新一个交易日
     * @param before 多少个交易日以前，留空则查询上市以来所有数据
     * @return
     */
    List<StockValue> getDailyBeforeTushare(@Param("stockCode") @NonNull String stockCode, @Param("endDate") LocalDateTime endDate, @Param("before") Long before);
}
