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

	<select id="selectETHTopAddrByPage" parameterType="com.jxy.marketall.vo.ETHTopAddrVo" resultType="com.jxy.marketall.dto.ETHTopAddrDto">
		SELECT
			a.address as address,
			e.tag as tag,
			a.balance as balance,
			t.abbr as abbr
		FROM
			rt_ethtopaddrv1 a
			left join eth e on a.address= e.address
			left join rt_ethtokenaddrv1 t on a.address= t.address
		<where>
			<if test="vo.balance != null and vo.balance != ''">
				and a.balance &gt;= #{vo.balance}
			</if>
			<if test="vo.address != null and vo.address != ''">
				and a.address =  #{vo.address}
			</if>
		</where>
		order by a.balance desc
	</select>

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

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

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

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

	<select id="selectLastETHBigTx" resultType="com.jxy.marketall.entity.EthBigTx">
		SELECT
			unixdt as date,
			fromaddress as fromAddress,
			toaddress as toAddress,
			amount,
			height,
			txid as txId,
			buyprice,
			sellprice as sellPrice,
			profit
		FROM
			ethbigtxv3
		ORDER BY
		unixdt desc limit 1
	</select>

	<select id="selectLastETHTopAddrChange" resultType="com.jxy.marketall.dto.EthTopAddrChangeDto">
		SELECT
			unixdt as date,
			fromaddress as fromAddress,
			toaddress as toAddress,
			amount,
			height,
			txid as txId
		FROM
			rt_ethtopaddrchangev1
		ORDER BY
		unixdt desc limit 1
	</select>

	<select id="selectLastUSDTBigTx" resultType="com.jxy.marketall.entity.USDTBigTx">
		select
			unixdt as date,
			fromaddress as fromAddress,
			toaddress as toAddress,
			amount,
			height,
			txid as txId
		from
			ethtokenbigtxv3
		where
			abbr = 'USDT'
		order by
			unixdt desc limit 1
	</select>

	<select id="selectLastUSDCBigTx" resultType="com.jxy.marketall.entity.USDCBigTx">
		select
			unixdt as date,
			fromaddress as fromAddress,
			toaddress as toAddress,
			amount,
			height,
			txid as txId
		from
			ethtokenbigtxv3
		where
			abbr = 'USDC'
		order by
			unixdt desc limit 1
	</select>

	<select id="selectLastBUSDBigTx" resultType="com.jxy.marketall.entity.USDTBigTx">
		select
			unixdt as date,
			fromaddress as fromAddress,
			toaddress as toAddress,
			amount,
			height,
			txid as txId
		from
			ethtokenbigtxv3
		where
			abbr = 'BUSD'
		order by
			unixdt desc limit 1
	</select>

	<select id="selectLastETHVolume" resultType="com.jxy.marketall.dto.EthVolumeDto">
		SELECT
			unixdt as date,
			volume
		from
			ethindsv3
		order by
			unixdt desc limit 1
	</select>

	<select id="selectLastETHFees" resultType="com.jxy.marketall.dto.ETHFeesDto">
		SELECT
			unixdt as date,
			fees,
			burnts
		FROM
			ethindsv3
		order by
			unixdt desc limit 1
	</select>

	<select id="selectLastUSDTVolume" resultType="com.jxy.marketall.dto.USDVolumeDto">
		select
			unixdt as dateTime,
			volume
		from
			ethtokenvolumev3
		WHERE
			abbr = "USDT"
		order by
			unixdt desc limit 1
	</select>

	<select id="selectLastUSDCVolume" resultType="com.jxy.marketall.dto.USDVolumeDto">
		select
			unixdt as dateTime,
			volume
		from
			ethtokenvolumev3
		WHERE
			abbr = "USDC"
		order by
			unixdt desc limit 1
	</select>

	<select id="selectLastBUSDVolume" resultType="com.jxy.marketall.dto.USDVolumeDto">
		select
			unixdt as dateTime,
			volume
		from
			ethtokenvolumev3
		WHERE
			abbr = "BUSD"
		order by
			unixdt desc limit 1
	</select>

	<select id="selectETHBigTxList" parameterType="com.jxy.marketall.vo.ETHVo" resultType="com.jxy.marketall.dto.EthBigTxDto">
		SELECT
			unixdt as date,
			fromaddress as fromAddress,
			a1.abbr AS fromAbbr,
			toaddress as toAddress,
			a2.abbr AS toAbbr,
			amount,
			height,
			txid as txId,
			buyprice as buyPrice,
			sellprice as sellPrice,
			profit
		FROM
			ethbigtxv3 e
			LEFT JOIN ethtokenaddrv3 a1 ON e.fromaddress = a1.address
			LEFT JOIN ethtokenaddrv3 a2 ON e.toaddress = a2.address
		<where>
			<if test="vo.amount != null and vo.amount != ''">
				amount &gt;= #{vo.amount}
			</if>
			<if test="vo.address != null and vo.address != ''">
				and fromaddress = #{vo.address} or toaddress = #{vo.address}
			</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="selectEthTopAddrChangeList" parameterType="com.jxy.marketall.vo.ETHVo" resultType="com.jxy.marketall.dto.EthTopAddrChangeDto">
		SELECT
			e.unixdt as date,
			e.fromaddress as fromAddress,
			a1.tag AS fromTag,
			e.toaddress as toAddress,
			a2.tag AS toTag,
			e.amount,
			e.height,
			e.txid as txId
		FROM
			rt_ethtopaddrchangev1 e
			LEFT JOIN eth a1 ON e.fromaddress = a1.address
			LEFT JOIN eth a2 ON e.toaddress = a2.address
		<where>
			<if test="vo.amount != null and vo.amount != ''">
				amount &gt;= #{vo.amount}
			</if>
			<if test="vo.address != null and vo.address != ''">
				and fromaddress = #{vo.address} or toaddress = #{vo.address}
			</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="selectNewContractByPage" parameterType="com.jxy.marketall.vo.ETHTopAddrVo" resultType="com.jxy.marketall.dto.EthNewContractDto">
		SELECT
		unixdt as date,
		address,
		height,
		txid as txId
		FROM
		ethcnewv3
		<where>
			<if test="vo.address != null and vo.address != ''">
				and address = #{vo.address}
			</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="selectUSDTBigTxList" parameterType="com.jxy.marketall.vo.USDTVo" resultType="com.jxy.marketall.dto.USDBigTxDto">
		SELECT
		unixdt as date,
		fromaddress as fromAddress,
		a1.abbr AS fromAbbr,
		toaddress as toAddress,
		a2.abbr AS toAbbr,
		amount,
		height,
		txid as txId
		FROM
		ethtokenbigtxv3 e
		LEFT JOIN ethtokenaddrv3 a1 ON e.fromaddress = a1.address
		LEFT JOIN ethtokenaddrv3 a2 ON e.toaddress = a2.address
		<where>
			e.abbr = 'USDT'
			<if test="usdtVo.amount != null and usdtVo.amount != ''">
				and amount &gt;= #{usdtVo.amount}
			</if>
			<if test="usdtVo.address != null and usdtVo.address != ''">
				and fromaddress = #{usdtVo.address} or toaddress = #{usdtVo.address}
			</if>
			<if test="usdtVo.txId != null and usdtVo.txId != ''">
				and txid = #{usdtVo.txId}
			</if>
			<if test="usdtVo.start != null and usdtVo.start != ''">
				and unixdt &gt;= #{usdtVo.start}
			</if>
			<if test="usdtVo.end != null and usdtVo.end != ''">
				and unixdt &lt;= #{usdtVo.end}
			</if>
		</where>
			order by
			unixdt desc
	</select>

	<select id="selectUSDCBigTxList" parameterType="com.jxy.marketall.vo.USDCVo" resultType="com.jxy.marketall.dto.USDBigTxDto">
		SELECT
		unixdt as date,
		fromaddress as fromAddress,
		a1.abbr AS fromAbbr,
		toaddress as toAddress,
		a2.abbr AS toAbbr,
		amount,
		height,
		txid as txId
		FROM
		ethtokenbigtxv3 e
		LEFT JOIN ethtokenaddrv3 a1 ON e.fromaddress = a1.address
		LEFT JOIN ethtokenaddrv3 a2 ON e.toaddress = a2.address
		<where>
			e.abbr = 'USDC'
			<if test="usdcVo.amount != null and usdcVo.amount != ''">
				and amount &gt;= #{usdcVo.amount}
			</if>
			<if test="usdcVo.address != null and usdcVo.address != ''">
				and fromaddress = #{usdcVo.address} or toaddress = #{usdcVo.address}
			</if>
			<if test="usdcVo.txId != null and usdcVo.txId != ''">
				and txid = #{usdcVo.txId}
			</if>
			<if test="usdcVo.start != null and usdcVo.start != ''">
				and unixdt &gt;= #{usdcVo.start}
			</if>
			<if test="usdcVo.end != null and usdcVo.end != ''">
				and unixdt &lt;= #{usdcVo.end}
			</if>
		</where>
		order by
		unixdt desc
	</select>

	<select id="selectBUSDBigTxList" parameterType="com.jxy.marketall.vo.USDTVo" resultType="com.jxy.marketall.dto.USDBigTxDto">
		SELECT
		unixdt as date,
		fromaddress as fromAddress,
		a1.abbr AS fromAbbr,
		toaddress as toAddress,
		a2.abbr AS toAbbr,
		amount,
		height,
		txid as txId
		FROM
		ethtokenbigtxv3 e
		LEFT JOIN ethtokenaddrv3 a1 ON e.fromaddress = a1.address
		LEFT JOIN ethtokenaddrv3 a2 ON e.toaddress = a2.address
		<where>
			e.abbr = 'BUSD'
			<if test="usdtVo.amount != null and usdtVo.amount != ''">
				and amount &gt;= #{usdtVo.amount}
			</if>
			<if test="usdtVo.address != null and usdtVo.address != ''">
				and fromaddress = #{usdtVo.address} or toaddress = #{usdtVo.address}
			</if>
			<if test="usdtVo.txId != null and usdtVo.txId != ''">
				and txid = #{usdtVo.txId}
			</if>
			<if test="usdtVo.start != null and usdtVo.start != ''">
				and unixdt &gt;= #{usdtVo.start}
			</if>
			<if test="usdtVo.end != null and usdtVo.end != ''">
				and unixdt &lt;= #{usdtVo.end}
			</if>
		</where>
		order by
		unixdt desc
	</select>

	<select id="getETHVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.EthVolumeDto">
		SELECT
		unixdt as date,
		volume,
		price
		FROM
		ethindsv3 e
		<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
		unixdt
	</select>

	<select id="getETHFeesList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.ETHFeesDto">
		SELECT distinct
		unixdt as date,
		fees,
		burnts
		FROM
		ethindsv3
		<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
		unixdt
	</select>

	<select id="getUSDTVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.USDVolumeDto">
		SELECT distinct
		unixdt as dateTime,
		volume
		FROM
		ethtokenvolumev3
		<where>
			abbr = 'USDT'
			<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
	</select>

	<select id="getUSDCVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.USDVolumeDto">
		SELECT distinct
		unixdt as dateTime,
		volume
		FROM
		ethtokenvolumev3
		<where>
			abbr = 'USDC'
			<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
	</select>

	<select id="getBUSDVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.USDVolumeDto">
		SELECT distinct
		unixdt as dateTime,
		volume
		FROM
		ethtokenvolumev3
		<where>
			abbr = 'BUSD'
			<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
	</select>


	<select id="getETHTokenVolumeList" parameterType="com.jxy.marketall.vo.ETHTokenVolumeVo" resultType="com.jxy.marketall.dto.ETHTokenVolumeDto">
		SELECT
			e.unixdt as dateTime,
			e.abbr,
			e.address,
			e.volume
		FROM
		ethtokenvolumev3 e
		left join ethtokenaddrv3 a on e.address = a.address
		<where>
			a.unit != 0 and e.volume != 0
			<if test="vo.address != null and vo.address != ''">
				and e.address = #{vo.address}
			</if>
			<if test="vo.abbr != null and vo.abbr != ''">
				and e.abbr = #{vo.abbr}
			</if>
			<if test="vo.start != null and vo.start != ''">
				and e.unixdt &gt;= #{vo.start}
			</if>
			<if test="vo.end != null and vo.end != ''">
				and e.unixdt &lt;= #{vo.end}
			</if>
		</where>
		order BY
		e.unixdt
	</select>

	<select id="getETHTokenBigtxList" parameterType="com.jxy.marketall.vo.ETHTokenVo" resultType="com.jxy.marketall.dto.ETHTokenBigtxDto">
		SELECT
		e.unixdt as dateTime,
		e.abbr,
		e.caddress,
		e.fromaddress as fromAddress,
		a1.abbr as fromAbbr,
		e.toaddress as toAddress,
		a2.abbr as toAbbr,
		e.amount,
		e.height,
		e.txid as txId
		FROM
		ethtokenbigtxv3 e
		LEFT JOIN ethtokenaddrv3 a1 ON e.fromaddress = a1.address
		LEFT JOIN ethtokenaddrv3 a2 ON e.toaddress = a2.address
		<where>
			amount &lt; 10000000000
			<if test="vo.amount != null and vo.amount !=0">
				and amount &gt;= #{vo.amount}
			</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>
			<if test="vo.address != null and vo.address != ''">
				and fromaddress = #{vo.address} or toaddress = #{vo.address}
			</if>
			<if test="vo.abbr != null and vo.abbr != ''">
				and e.abbr = #{vo.abbr}
			</if>
			<if test="vo.txId != null and vo.txId != ''">
				and txid = #{vo.txId}</if>
		</where>
			ORDER BY
			unixdt desc limit #{vo.page},#{vo.limit}
	</select>

	<select id="selectETHTokenBigtxDayCountList" resultType="com.jxy.marketall.dto.CountDto">
        SELECT
        	DATE_FORMAT( unixdt, '%Y-%m-%d' ) AS dataTime,
        	count(*) AS num
        FROM
        	ethtokenbigtxv3
        where
        	amount &lt; 10000000000
        GROUP BY
        	dataTime
	</select>

	<select id="selectLastETHTokenBigTx" resultType="com.jxy.marketall.dto.ETHTokenBigtxDto">
		SELECT
			unixdt as dateTime,
			abbr,
			caddress,
			fromaddress as fromAddress,
			toaddress as toAddress,
			amount,
			height,
			txid as txId
		FROM
			ethtokenbigtxv3 e
		order by
			unixdt desc limit 1
	</select>

	<select id="getETHTokenVolumeAbbrs" resultType="com.jxy.marketall.dto.ETHTokenVolumeAbbrsDto">
		select
			(@i:=@i+1) as id,
			a.address as address,
			a.abbr as abbr
		from
		 (select distinct address,abbr from ethtokenvolumev3) as a,(select @i:=0) as i;
	</select>

	<select id="getETHTokenAbbrs" resultType="com.jxy.marketall.dto.ETHTokenAbbrsDto">
		select
			(@i:=@i+1) as id,
			a.abbr as abbr
		from
		 (select distinct abbr from ethtokenaddrv3) as a,(select @i:=0) as i;
	</select>

	<select id="getCsupplyList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.ComDataDto">
		SELECT distinct
			unixdt as date,
			csupply as value
		FROM
		ethindsv3
		<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
		unixdt
	</select>

	<select id="getRewardList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as date,
		reward as value,
		price
		FROM
		ethindsv3
		<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
		unixdt
	</select>

	<select id="getAddressList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.ETHAddressDto">
		SELECT distinct
		unixdt as date,
		active_address as activeAddress,
		send_address as sendAddress,
		receive_address as receiveAddress,
		price
		FROM
		ethindsv3
		<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
		unixdt
	</select>

	<select id="getVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		volume as value,
		price
		FROM
		ethindsv3
		<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
		unixdt
	</select>

	<select id="getCnewList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as date,
		cnew as value,
		price
		FROM
		ethindsv3
		<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
		unixdt
	</select>


	<select id="getTokenVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.ComDataDto">

		SELECT distinct
		unixdt as date,
		volume as value
		FROM
		ethtokenvolumev3
		<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
		unixdt
	</select>


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

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

	<select id="selectLastTronUSDTVolume" resultType="com.jxy.marketall.dto.TronVolumeDto">
		SELECT
			unixdt as dateTime,
			volume_change as volumeChange,
			volume_self as volumeSelf,
			bigvolume as bigVolume
		FROM
			tronusdtvolumev1
		ORDER BY
		unixdt desc limit 1
	</select>

	<select id="selectLastTronUSDCVolume" resultType="com.jxy.marketall.dto.TronVolumeDto">
		SELECT
			unixdt as dateTime,
			volume_change as volumeChange,
			volume_self as volumeSelf,
			bigvolume as bigVolume
		FROM
			tronusdcvolumev1
		ORDER BY
		unixdt desc limit 1
	</select>

	<select id="selectLastTronUSDTBigTx" resultType="com.jxy.marketall.entity.TronUSDTBigTx">
		select
			unixdt as date,fromaddress,toaddress,fromtag,totag,amount,height,txid
		from
			tronusdtbigtxv1
		order by
			unixdt desc limit 1
	</select>

	<select id="selectLastTronUSDCBigTx" resultType="com.jxy.marketall.entity.TronUSDCBigTx">
		select
			unixdt as date,fromaddress,toaddress,fromtag,totag,amount,height,txid
		from
			tronusdcbigtxv1
		order by
			unixdt desc limit 1
	</select>

	<select id="getTronUSDTVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.entity.TronUSDTVolume">
		SELECT DISTINCT
		unixdt as date,
		volume_change as volumeChange,
		volume_self as volumeSelf,
		bigvolume as bigVolume
		FROM
		tronusdtvolumev1
		<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
		unixdt
	</select>

	<select id="getTronUSDTVolumeLastMonthList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.entity.TronUSDTVolume">
		SELECT DISTINCT
		unixdt as date,
		volume_change as volumeChange,
		volume_self as volumeSelf,
		bigvolume as bigVolume
		FROM
		tronusdtvolumev1
		ORDER BY
		unixdt desc limit 30
	</select>

	<select id="getTronUSDCVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.entity.TronUSDCVolume">
		SELECT DISTINCT
			unixdt as date,
			volume_change as volumeChange,
			volume_self as volumeSelf,
			bigvolume as bigVolume
		FROM
			tronusdcvolumev1
		<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
		unixdt
	</select>

	<select id="getTronUSDCVolumeLastMonthList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.entity.TronUSDCVolume">
		SELECT
		unixdt as date,
		volume_change as volumeChange,
		volume_self as volumeSelf,
		bigvolume as bigVolume
		FROM
		tronusdcvolumev1
		ORDER BY
		unixdt desc limit 30
	</select>

	<select id="selectTronUSDTBigTxList" parameterType="com.jxy.marketall.vo.TronUSDTVo" resultType="com.jxy.marketall.entity.TronUSDTBigTx">
		select
		unixdt as date,fromaddress,toaddress,fromtag,totag,amount,height,txid
		from
		tronusdtbigtxv1
		<where>
			<if test="vo.amount != null and vo.amount != ''">
				amount &gt;= #{vo.amount}
			</if>
			<if test="vo.address != null and vo.address != ''">
				and fromaddress = #{vo.address} or toaddress = #{vo.address}
			</if>
			<if test="vo.tag != null and vo.tag != ''">
				and fromtag = #{vo.tag} or tag = #{vo.tag}
			</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="selectTronUSDCBigTxList" parameterType="com.jxy.marketall.vo.TronUSDCVo" resultType="com.jxy.marketall.entity.TronUSDCBigTx">
		select
		unixdt as date,fromaddress,toaddress,fromtag,totag,amount,height,txid
		from
		tronusdcbigtxv1
		<where>
			<if test="vo.amount != null and vo.amount != ''">
				amount &gt;= #{vo.amount}
			</if>
			<if test="vo.address != null and vo.address != ''">
				and fromaddress = #{vo.address} or toaddress = #{vo.address}
			</if>
			<if test="vo.tag != null and vo.tag != ''">
				and fromtag = #{vo.tag} or tag = #{vo.tag}
			</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="getPiCycleTIList" resultType="com.jxy.marketall.dto.PiCycleTIDto">
		SELECT distinct
			unixdt as date,
			ma350x2,
			ma111,
			price
		FROM
			nochainv2a
		ORDER BY
			unixdt
	</select>

	<select id="getGoldenRatioMultiplier" resultType="com.jxy.marketall.dto.GoldenRatioMultiplierDto">
		SELECT distinct
			unixdt as date,
			ma350x1,
			ma350x1r6,
			ma350x2,
			ma350x3,
			ma350x5,
			price
		FROM
			nochainv2a
		ORDER BY
			unixdt
	</select>

	<select id="getETHTokenBigtxCount" resultType="java.lang.Integer">
		SELECT
			count(*)
		FROM
			ethtokenbigtxv3 e
			LEFT JOIN ethtokenaddrv3 a1 ON e.fromaddress = a1.address
			LEFT JOIN ethtokenaddrv3 a2 ON e.toaddress = a2.address
		<where>
			amount &lt; 10000000000
			<if test="vo.amount != null and vo.amount != ''">
				and amount &gt;= #{vo.amount}
			</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>
			<if test="vo.address != null and vo.address != ''">
				and fromaddress = #{vo.address} or toaddress = #{vo.address}
			</if>
			<if test="vo.abbr != null and vo.abbr != ''">
				and e.abbr = #{vo.abbr}
			</if>
			<if test="vo.txId != null and vo.txId != ''">
				and txid = #{vo.txId}</if>
		</where>
	</select>

	<select id="getPriceList" resultType="com.jxy.marketall.dto.PriceDataDto">
		SELECT
			unixdt as time,
			price as value
		FROM
			ethindsv3
		<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
		unixdt
	</select>

</mapper>
