package com.m2pool.pool.mapper;

import com.m2pool.common.datasource.annotation.DistributionDB;
import com.m2pool.common.datasource.annotation.HashRateDB;
import com.m2pool.pool.dto.MinerIncomeDto;
import com.m2pool.pool.entity.HourIncome;
import org.apache.ibatis.annotations.Param;

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

/**
 * @Description 矿机收益
 * @Date 2025/8/15 17:47
 * @Author yyb
 */
public interface IncomeMapper {
        /**
         * 获取矿机平均算力
         * @param coin
         * @param start
         * @param end
         * @return
         */
        @HashRateDB
        List<MinerIncomeDto> getMinerAvgPower(@Param("coin")String coin,@Param("start")LocalDateTime start, @Param("end")LocalDateTime end);

        /**
         * 获取有效块数
         * @param coin
         * @param start
         * @param end
         * @return
         */
        @DistributionDB
        BigDecimal getVaildBlcoks(@Param("coin")String coin, @Param("start")LocalDateTime start, @Param("end")LocalDateTime end);

        /**
         * 批量插入小时收益
         * @param list
         * @return
         */
        int batchInsertHourIncomes(@Param("coin")String coin,@Param("list")List<HourIncome> list);
}
