HotSpotAreaSMapper.xml
1.11 KB
<?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.zteits.park.mapper.smapper.HotSpotAreaSMapper">
<select id="getParkinglotsInHotSpotRound" resultType="com.zteits.park.domain.ParkinglotMarker">
select parkinglotName, address, totalBerthNum, longitude, latitude, freeBerthNum
from (select pl.pl_name parkinglotName,
pl.pl_address address,
pl.pl_berth_num totalBerthNum,
g.lon_id longitude,
g.lat_id latitude,
(select count(*) from parking_lot_berths b where b.berth_state=0 and b.pl_id=pl.pl_id) freeBerthNum,
ROUND(6378.138*2*ASIN(SQRT(POW(SIN((#{latitude} * PI()/180-g.lat_id*PI()/180)/2),2) + COS(#{latitude} *PI()/180)*COS(g.lat_id*PI()/180)*POW(SIN((#{longitude} *PI()/180-g.lon_id*PI()/180)/2),2)))*1000) length
from parking_lot pl left join parking_lot_geo g on g.pl_no=pl.pl_no and g.geo_type =1 order by length ASC limit 300) where length < #{radius}
</select>
</mapper>