spring data jpa 使用MySQL距離函式
PageRequest pageable = PageRequest.of(
0,
20
Sort.Direction.ASC,
"st_distance (point (longitude, latitude),point('120.38','37.94'))"
)
List list = mUserRepo.findAll(query, pageable).content
如代碼所示,query是查詢條件,插入st_distance就不能用了,寫sql的話是可以用的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/41346.html
標籤:Java相關
