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

	<select id="selectShortTimeDataByCondition" parameterType="com.jxy.marketall.vo.BiAnVo" resultType="com.jxy.marketall.entity.BiAn" statementType="STATEMENT">
        SELECT
            id,
            open_time,
            open_price,
            high_price,
            low_price,
            close_price,
            volume,
            close_time,
            quality,
            num,
            buy_volume,
            buy_quality,
            symbol
        FROM
            ${biAnVo.symbol}
        <where>
            <if test="biAnVo.start != null and biAnVo.start != ''">
                and open_time &gt;= "${biAnVo.start}"
            </if>
            <if test="biAnVo.end != null and biAnVo.end != ''">
                and open_time &lt;= "${biAnVo.end}"
            </if>
        </where>
        ORDER BY open_time
	</select>

    <select id="selectFirstData" parameterType="com.jxy.marketall.vo.BiAnVo" resultType="com.jxy.marketall.entity.BiAn" statementType="STATEMENT">
        SELECT
        id,
        open_time,
        open_price,
        high_price,
        low_price,
        close_price,
        volume,
        close_time,
        quality,
        num,
        buy_volume,
        buy_quality,
        symbol
        FROM
        ${biAnVo.symbol}
        ORDER BY open_time
        limit 1
    </select>

    <select id="selectLongTimeDataByCondition" parameterType="com.jxy.marketall.vo.BiAnVo" resultType="com.jxy.marketall.entity.BiAn" statementType="STATEMENT">
        SELECT
        id,
        open_time,
        open_price,
        high_price,
        low_price,
        close_price,
        volume,
        close_time,
        quality,
        num,
        buy_volume,
        buy_quality,
        symbol
        FROM
        ${biAnVo.symbol}
        <where>
            <if test="biAnVo.start != null and biAnVo.start != ''">
                and open_time &gt;= "${biAnVo.start}"
            </if>
            <if test="biAnVo.end != null and biAnVo.end != ''">
                and open_time &lt;= "${biAnVo.end}"
            </if>
        </where>
        ORDER BY open_time
    </select>

    <select id="selectDataByClosePrice" parameterType="com.jxy.marketall.vo.BiAnVo" resultType="com.jxy.marketall.dto.BiAnClosePriceAndValueDto" statementType="STATEMENT">
        SELECT
        close_price as closePrice,
        open_time as date,
        volume
        FROM
        ${biAnVo.symbol}
        <where>
            <if test="biAnVo.start != null and biAnVo.start != ''">
                and open_time &gt;= "${biAnVo.start}"
            </if>
            <if test="biAnVo.end != null and biAnVo.end != ''">
                and open_time &lt;= "${biAnVo.end}"
            </if>
        </where>
        ORDER BY close_price
    </select>

</mapper>


