<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"  "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
	namespace="cn.tsy.data.idsse.dsds.mapper.sample.SampleDatasetTrackMapper">



	<select id="totalTrack" resultType="map">
		select max(track_time) max_time,min(track_time) min_time,max(track_lon)
		max_lon,min(track_lon) min_lin,max(track_lat) max_lat,min(track_lat)
		min_lat from sample_dataset_track where dataset_id=#{dataset_id};
	</select>

	<select id="listTrack" resultType="map">
		SELECT
		t1.*
		FROM
		sample_dataset_track t1,(
		SELECT
		min( tsy_id ) tsy_id
		FROM
		(
		SELECT
		track_time,
		DATE_FORMAT( track_time, '%Y-%m-%d %H:%i' ) track_minute,
		tsy_id
		FROM
		sample_dataset_track k
		WHERE
		dataset_id = #{dataset_id}
		AND MOD ( MINUTE ( track_time ), ${ticket_minutes} )= 0
		) s
		GROUP BY
		track_minute
		) t2
		WHERE
		t1.tsy_id = t2.tsy_id
		AND t1.dataset_id = #{dataset_id}
		ORDER BY
		t1.track_time
	</select>
</mapper>