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


	<select id="selectMa730ByTime" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.Ma730Dto">
		SELECT
			id,
			unixdt as date,
			price,
			ma730,
			ma730x5,
			ma365,
			ma200
		FROM
			ma730v3a
		<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
			date
	</select>

	<select id="selectMa730Day" resultType="com.jxy.marketall.dto.Ma730Dto">
		SELECT
			id,
			unixdt as `date`,
			price,
			ma730,
			ma730x5,
			ma365,
			ma200
		FROM
			ma730v3aday
		ORDER BY
			unixdt desc limit 1440
	</select>


	<select id="getListByTableAndField" resultType="com.jxy.marketall.dto.DateBigDecimalDto" statementType="STATEMENT">
		SELECT distinct
			unixdt as date,
			${field} as value
		FROM
		   ${table}
			ORDER BY
		unixdt
	</select>

	<select id="getPiCycleTIList" resultType="com.jxy.marketall.dto.PiCycleTIDto">
		SELECT distinct
			unixdt as date,
			ma350x2,
			ma111
		FROM
			nochainv3c
		ORDER BY
			unixdt
	</select>

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

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