<resultMapid="loopSpeedResult"type="HashMap"><resultcolumn="cab_name"property="cabName"/><resultcolumn="speed"property="speed" /></resultMap><selectid="selectLoopSpeed"parameterType="java.util.Map"resultMap="loopSpeedResult">
SELECT B.cab_name as cab_name, round(avg(speed),2) as speed
FROM table1 as A, table2 as B
Where left(right(B.unit_name,3),2) = '__'
and (B.lon between #{minLon} and #{maxLon} )
and (B.lat between #{minLat} and #{maxLat} )
and stamp <![CDATA[ >= ]]> #{beginTime,jdbcType=TIMESTAMP} and stamp <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
and A.lid = B.id
group by B.id
</select>