-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from NARAE-FLIWITH/feat/areaBased
feat: 위치기반 모든 유형 관광지 목록 조회
- Loading branch information
Showing
3 changed files
with
26 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/com/narae/fliwith/repository/LocationRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
package com.narae.fliwith.repository; | ||
|
||
import com.narae.fliwith.domain.Location; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface LocationRepository extends JpaRepository<Location, Long> { | ||
@Query(value = "select * from location l " + | ||
"where (6371 * acos(cos(radians(:curLat)) * cos(radians(l.latitude)) " + | ||
"* cos(radians(l.longitude) - radians(:curLong)) " + | ||
"+ sin(radians(:curLat)) * sin(radians(l.latitude)))) <= 3", nativeQuery = true) | ||
List<Location> findNearEverySpotType(@Param("curLat")Double curLatitude, @Param("curLong")Double curLongitude); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters