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


	<select id="getNewHolder" resultType="com.jxy.marketall.dto.HolderDto">
        SELECT
			DATE_FORMAT(unixdt,'%Y-%m-%d') AS dateTime,
			holder_0 ,
			holder_1 ,
			holder_2 ,
			holder_3 ,
			holder_4 ,
			holder_5 ,
			holder_6 ,
			holder_7 ,
			holder_15 ,
			holder_30 ,
			holder_60 ,
			holder_90 ,
			holder_180 ,
			holder_360 as holder1y,
			holder_540 as holder1p5y,
			holder_720 as holder2y,
			holder_1080 as holder3y,
			holder_1440 as holder4y,
			holder_1800 as holder5y,
			holder_2160 as holder6y,
			holder_2520 as holder7y,
			holder_2880 as holder8y,
			holder_3240 as holder9y,
			holder_3600 as holder10y,
			holder_3960 as holder11y
		FROM
			`holder3`
		ORDER BY
			unixdt DESC
			LIMIT 1
		</select>

	<select id="getHolderByTime" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.HolderDto">
        SELECT
			DATE_FORMAT(unixdt,'%Y-%m-%d') AS dateTime,
			holder_0 ,
			holder_1 ,
			holder_2 ,
			holder_3 ,
			holder_4 ,
			holder_5 ,
			holder_6 ,
			holder_7 ,
			holder_15 ,
			holder_30 ,
			holder_60 ,
			holder_90 ,
			holder_180 ,
			holder_360 as holder1y,
			holder_540 as holder1p5y,
			holder_720 as holder2y,
			holder_1080 as holder3y,
			holder_1440 as holder4y,
			holder_1800 as holder5y,
			holder_2160 as holder6y,
			holder_2520 as holder7y,
			holder_2880 as holder8y,
			holder_3240 as holder9y,
			holder_3600 as holder10y,
			holder_3960 as holder11y
		FROM
			`holder3`
		<where>
			<if test="vo.start != null and vo.start != ''">
				and date_format(unixdt,'%y%m%d') = date_format(#{vo.start},'%y%m%d')
			</if>
		</where>
		limit 1
		</select>
</mapper>
