<?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.m2pool.oapi.mapper.MinerMapper">

    <select id="getMinerRealHashRateByCoinAndAccountMiner" resultType="com.m2pool.oapi.dto.HashRateRealDto">
        select
            mhs30m mhs,
            mhs24h
        from
            ${vo.coin}_mhs_realv2
        where
            `user` = '${vo.ma}' and miner= '${vo.miner}'
        order by date desc limit 1
    </select>

    <select id="getMinerHashRateHistory24hListByCoinAndAccountMiner"
            resultType="com.m2pool.oapi.dto.HashRateDto">
        select
            `date`,
            mhs
        from
            ${vo.coin}_mhs24h
        <where>
            `user` = '${vo.ma}'
            and miner = '${vo.miner}'
            <if test="vo.start != null and vo.start != ''">
                and `date` &gt; "${vo.start}"
            </if>
            <if test="vo.end != null and vo.end != ''">
                and `date` &lt;= "${vo.end}"
            </if>
        </where>
        order by date
    </select>

    <select id="getMinerHashRateHistory30mListByCoinAndAccountMiner"
            resultType="com.m2pool.oapi.dto.HashRateDto">
        select
            `date`,
            mhs
        from
            ${vo.coin}_mhs30m
        where
            `user` = '${vo.ma}'
            and miner = '${vo.miner}'
            and `date` &gt; "${start}"
        order by date
    </select>

</mapper>
