<?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.jxy.marketall.mapper.UtxosMapper">

    <select id="getNewUtxos" resultType="com.jxy.marketall.dto.UtxosDto">
        SELECT
			DATE_FORMAT(unixdt,'%Y-%m-%d') AS dateTime,
			total_address,
			total_balance,
			total_rcap,
			miner_address,
			miner_balance,
			balance_0,
			balance_01,
			balance_001,
			balance_1,
			balance_10,
			balance_100,
			balance_1000,
			balance_10000
		FROM
			utxosv3
		ORDER BY
			unixdt DESC
			LIMIT 1
	</select>

	<select id="getUtxosList" resultType="com.jxy.marketall.entity.Utxos">
		SELECT
			DATE_FORMAT(unixdt,'%Y-%m-%d') AS dateTime,
			total_address,
			total_balance,
			total_rcap,
			miner_address,
			miner_balance,
			balance_0,
			balance_01,
			balance_001,
			balance_1,
			balance_10,
			balance_100,
			balance_1000,
			balance_10000
		FROM
			`utxosv3`
		ORDER BY
		unixdt
	</select>

	<select id="getCapRealList" resultType="com.jxy.marketall.dto.CapRealDto">
        SELECT distinct
			DATE_FORMAT(unixdt,'%Y-%m-%d') AS `time`,
			total_rcap as capReal
		FROM
			`utxosv3` u
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
			`time`
	</select>
	<select id="getLastUtxos" resultType="com.jxy.marketall.entity.Utxos">
SELECT
			DATE_FORMAT(unixdt,'%Y-%m-%d') AS dateTime,
			total_address totalAddress,
			total_balance totalBalance,
			total_rcap totalRcap,
			miner_address minerAddress,
			miner_balance minerBalance,
			balance_0 balance0,
			balance_01 balance01,
			balance_001 balance001,
			balance_1 balance1,
			balance_10 balance10,
			balance_100 balance100,
			balance_1000 balance1000,
			balance_10000 balance10000
		FROM
			utxosv3
		ORDER BY
			unixdt DESC
			LIMIT 1
	</select>


</mapper>
