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

	<select id="findLastOHLC" resultType="com.jxy.marketall.dto.NDAQOHLCDto">
		select
			date
		from
			NDAQohlc
		ORDER by
			date desc limit 1
	</select>

	<select id="findLastMa" resultType="com.jxy.marketall.dto.NDAQMaDto">
		select
			date
		from
			NDAQma
		ORDER by
			date desc limit 1
	</select>

	<select id="getOHLCList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.NDAQOHLCDto">
        SELECT
			date,
			open_price openPrice,
			high_price highestPrice,
			low_price lowestPrice,
			close_price closePrice,
			amount,
			preClose,
			netChangeRatio,
			increase
		FROM
			`NDAQohlc`
		<where>
			<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 DESC
		</select>

	<select id="getMaList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.NDAQMaDto">
        SELECT
        	date,
			ma5Vol,
			ma5Price,
			ma10Vol,
			ma10Price,
			ma20Vol,
			ma20Price
		FROM
			`NDAQma`
			<where>
			<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 DESC
		</select>


</mapper>
