|
|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.business.mapper;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -27,7 +28,7 @@ public interface BusHotelMapper extends BaseMapper<BusHotel> {
|
|
|
* @param sort 0推荐排序 1 距离优先 2低价优先 3评分优先 4评论数优先
|
|
|
* @return
|
|
|
*/
|
|
|
- @Select("<script>SELECT h.*, ROUND(6378.138*2*ASIN(SQRT(power(SIN((28.205783*PI()/180-(h.lat)*PI()/180)/2),2)+COS(28.205783*PI()/180)*COS((h.lat)*PI()/180)*power(SIN((112.986861*PI()/180-(h.lng)*PI()/180)/2),2)))*1000,2) AS distance,ifnull(c.commentNum,0) as commentNum,ifnull(c.score,0) as score,ifnull(market_price,0) as market_price FROM bus_hotel_info h\n" +
|
|
|
+ @Select("<script>SELECT h.*, ROUND(6378.138*2*ASIN(SQRT(power(SIN((${lat}*PI()/180-(h.lat)*PI()/180)/2),2)+COS(${lat}*PI()/180)*COS((h.lat)*PI()/180)*power(SIN((${lng}*PI()/180-(h.lng)*PI()/180)/2),2)))*1000,2) AS distance,ifnull(c.commentNum,0) as commentNum,ifnull(c.score,0) as score,ifnull(market_price,0) as min_price FROM bus_hotel_info h\n" +
|
|
|
"left join (select hotel_id,count(0) as commentNum,AVG(score) as score from ces_order_comment where comment_type=1 group by hotel_id) c\n" +
|
|
|
"on c.hotel_id=h.id\n" +
|
|
|
"left join (select hotel_id,min(market_price) as market_price from ces_room_layout where invalid=0 group by hotel_id) l\n" +
|
|
|
@@ -37,11 +38,11 @@ public interface BusHotelMapper extends BaseMapper<BusHotel> {
|
|
|
"<if test='keyWord != null and keyWord !=\"\"'> and (h.address LIKE concat(concat('%',#{keyWord}),'%') or h.name LIKE concat(concat('%',#{keyWord}),'%')) </if>" +
|
|
|
"<if test='sort != null and sort ==0'> order by h.create_time desc </if>" +
|
|
|
"<if test='sort != null and sort ==1'> order by distance asc </if>" +
|
|
|
- "<if test='sort != null and sort ==2'> order by market_price asc </if>" +
|
|
|
+ "<if test='sort != null and sort ==2'> order by min_price asc </if>" +
|
|
|
"<if test='sort != null and sort ==3'> order by score desc </if>" +
|
|
|
"<if test='sort != null and sort ==4'> order by commentNum desc </if>" +
|
|
|
"</script>")
|
|
|
- public List<BusHotel> pageList(Page<BusHotel> page,@Param("tenantId") String tenantId, @Param("keyWord") String keyWord, @Param("sort") Integer sort);
|
|
|
+ public List<BusHotel> pageList(Page<BusHotel> page,@Param("tenantId") String tenantId, @Param("keyWord") String keyWord, @Param("sort") Integer sort, @Param("lat") BigDecimal lat, @Param("lng") BigDecimal lng);
|
|
|
|
|
|
}
|
|
|
|