<?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.BTCBigAmountVoutMapper">


	<select id="selectDayCountList" resultType="com.jxy.marketall.dto.CountDto">
        SELECT
        	DATE_FORMAT( unixdt, '%Y-%m-%d' ) AS dataTime,
        	count(*) AS num
        FROM
        	rt_bigamountvoutv3e
        GROUP BY
        	dataTime
	</select>

	<select id="getLastBigAmountVout" resultType="com.jxy.marketall.entity.BTCBigAmountVout">
        SELECT
        	unixdt AS date,
        	vout,
        	voutn,
        	vouttype,
        	amount,
        	height,
        	txid,
        	floor(days) days,
        	buyprice,
        	sellprice,
        	profit
        FROM
        	rt_bigamountvoutv3e
        ORDER BY
        	unixdt desc limit 1
	</select>

	<select id="getBTCBigAmountVoutDtoList" parameterType="com.jxy.marketall.vo.BTCVo" resultType="com.jxy.marketall.entity.BTCBigAmountVout">
        SELECT DISTINCT
			unixdt as date,
			vout,
			voutn,
			vouttype,
			amount,
			height,
			txid,
			floor(days) days,
			buyprice,
			sellprice,
			profit
        FROM
			rt_bigamountvoutv3e
		<where>
			<if test="vo.amount != null and vo.amount != ''">
				amount &gt;= #{vo.amount}
			</if>
			<if test="vo.vout != null and vo.vout != ''">
				and vout = #{vo.vout}
			</if>
			<if test="vo.txId != null and vo.txId != ''">
				and txid = #{vo.txId}
			</if>
			<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
        	unixdt desc
	</select>

	<select id="getBTCBigAmountVoutDtoList_COUNT" resultType="java.lang.Long">
		SELECT count(1)
		FROM
		rt_bigamountvoutv3e
		<where>
			<if test="vo.amount != null and vo.amount != ''">
				amount &gt;= #{vo.amount}
			</if>
			<if test="vo.vout != null and vo.vout != ''">
				and vout = #{vo.vout}
			</if>
			<if test="vo.txId != null and vo.txId != ''">
				and txid = #{vo.txId}
			</if>
			<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>
	</select>


</mapper>
