|
|
@@ -44,37 +44,62 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询附近站点 -->
|
|
|
+<!-- <select id="findNearbyStations" resultType="bus.model.dto.BStationInfoDto"-->
|
|
|
+<!-- parameterType="bus.model.dto.NearbyRoutesDto" >-->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- id,-->
|
|
|
+<!-- name,-->
|
|
|
+<!-- latitude,-->
|
|
|
+<!-- longitude,-->
|
|
|
+<!-- ROUND(-->
|
|
|
+<!-- 6378.137 * 2 * ASIN(-->
|
|
|
+<!-- SQRT(-->
|
|
|
+<!-- POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +-->
|
|
|
+<!-- COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *-->
|
|
|
+<!-- POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)-->
|
|
|
+<!-- )-->
|
|
|
+<!-- ) * 1000-->
|
|
|
+<!-- , 2) AS distance-->
|
|
|
+<!-- FROM b_station_info-->
|
|
|
+<!-- WHERE-->
|
|
|
+<!-- is_delete = 0-->
|
|
|
+<!-- AND latitude BETWEEN #{latitude} - #{radius} / 111300 AND #{latitude} + #{radius} / 111300-->
|
|
|
+<!-- AND longitude BETWEEN #{longitude} - #{radius} / (111300 * COS(#{latitude} * PI() / 180))-->
|
|
|
+<!-- AND #{longitude} + #{radius} / (111300 * COS(#{latitude} * PI() / 180))-->
|
|
|
+<!-- AND (-->
|
|
|
+<!-- 6378.137 * 2 * ASIN(-->
|
|
|
+<!-- SQRT(-->
|
|
|
+<!-- POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +-->
|
|
|
+<!-- COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *-->
|
|
|
+<!-- POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)-->
|
|
|
+<!-- )-->
|
|
|
+<!-- ) * 1000-->
|
|
|
+<!-- ) <= #{radius}-->
|
|
|
+<!-- ORDER BY distance-->
|
|
|
+<!-- </select>-->
|
|
|
+
|
|
|
<select id="findNearbyStations" resultType="bus.model.dto.BStationInfoDto"
|
|
|
- parameterType="bus.model.dto.NearbyRoutesDto" >
|
|
|
+ parameterType="bus.model.dto.NearbyRoutesDto">
|
|
|
SELECT
|
|
|
- id,
|
|
|
- name,
|
|
|
- latitude,
|
|
|
- longitude,
|
|
|
- ROUND(
|
|
|
- 6378.137 * 2 * ASIN(
|
|
|
- SQRT(
|
|
|
- POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +
|
|
|
- COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *
|
|
|
- POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)
|
|
|
- )
|
|
|
- ) * 1000
|
|
|
- , 2) AS distance
|
|
|
+ id,
|
|
|
+ name,
|
|
|
+ latitude,
|
|
|
+ longitude,
|
|
|
+ ROUND(
|
|
|
+ 6378.137 * 2 * ASIN(
|
|
|
+ SQRT(
|
|
|
+ POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +
|
|
|
+ COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *
|
|
|
+ POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)
|
|
|
+ )
|
|
|
+ ) * 1000
|
|
|
+ , 2) AS distance
|
|
|
FROM b_station_info
|
|
|
WHERE
|
|
|
- is_delete = 0
|
|
|
- AND latitude BETWEEN #{latitude} - #{radius} / 111300 AND #{latitude} + #{radius} / 111300
|
|
|
- AND longitude BETWEEN #{longitude} - #{radius} / (111300 * COS(#{latitude} * PI() / 180))
|
|
|
- AND #{longitude} + #{radius} / (111300 * COS(#{latitude} * PI() / 180))
|
|
|
- AND (
|
|
|
- 6378.137 * 2 * ASIN(
|
|
|
- SQRT(
|
|
|
- POW(SIN((#{latitude} - latitude) * PI() / 180 / 2), 2) +
|
|
|
- COS(#{latitude} * PI() / 180) * COS(latitude * PI() / 180) *
|
|
|
- POW(SIN((#{longitude} - longitude) * PI() / 180 / 2), 2)
|
|
|
- )
|
|
|
- ) * 1000
|
|
|
- ) <= #{radius}
|
|
|
+ is_delete = 0
|
|
|
+ <if test="stationName !=null and stationName != ''">
|
|
|
+ and name like CONCAT('%', #{stationName}, '%')
|
|
|
+ </if>
|
|
|
ORDER BY distance
|
|
|
</select>
|
|
|
|
|
|
@@ -112,6 +137,7 @@
|
|
|
r.id,
|
|
|
r.course_name as courseName,
|
|
|
r.course_code as courseCode,
|
|
|
+ r.course_type as courseType,
|
|
|
r.map_pic_url as mapPicUrl,
|
|
|
r.first_station_name as firstStationName,
|
|
|
r.last_station_name as lastStationName,
|