Ver Fonte

本区没有商家,然后扩大到市级的范围查询

liude há 1 ano atrás
pai
commit
fe8cac2bcc

+ 4 - 0
vehicle-client/src/main/java/com/chelvc/cloud/vehicle/client/param/LocationQueryPagingParam.java

@@ -1,6 +1,7 @@
 package com.chelvc.cloud.vehicle.client.param;
 
 import com.chelvc.framework.common.model.Paging;
+import com.chelvc.framework.common.model.Region;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -53,4 +54,7 @@ public class LocationQueryPagingParam implements Serializable {
     @NotNull(message = "查询类型不能为空")
     private Integer queryType;
 
+    private Integer code;
+
+    private Integer boundary;
 }

+ 7 - 0
vehicle-client/src/main/java/com/chelvc/cloud/vehicle/client/param/LocationQueryParam.java

@@ -5,6 +5,7 @@ import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
 
+import com.chelvc.framework.common.model.Region;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -55,4 +56,10 @@ public class LocationQueryParam implements Serializable {
      * 推荐商家数量
      */
     private Integer recPageSize = 15;
+
+    private Integer code;
+
+    private Integer boundary;
+
+
 }

+ 1 - 1
vehicle-server/src/main/resources/mapper/FavoriteMapper.xml

@@ -30,7 +30,7 @@
         point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
         )) distance from favorite fe
         inner join merchant mt on fe.content_id = mt.id and mt.status = 'ONLINE'
-        and mt.region = #{param.region}
+        and mt.region between #{param.code} and #{param.boundary}
         where fe.user_id = #{userId} and fe.type = #{param.type}
         <if test="param.offset != null">
             and fe.id > #{param.offset}

+ 4 - 4
vehicle-server/src/main/resources/mapper/HotmerchantMapper.xml

@@ -12,8 +12,8 @@
                mt.create_time as createTime FROM
             ( SELECT merchant_id, count( merchant_id ) FROM hot_merchant GROUP BY merchant_id ORDER BY count( merchant_id ) DESC ) t
                 LEFT JOIN merchant mt ON t.merchant_id = mt.id
-                where mt.region = #{param.region} and mt.status = 'ONLINE' and mt.recommend = 1
-                order by distance asc limit 20
+                where mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE' and mt.recommend = 1
+                order by distance asc limit 10
     </select>
 
     <select id="likeMerchant" resultType="com.chelvc.cloud.vehicle.client.dto.MerchantDTO" parameterType="com.chelvc.cloud.vehicle.client.param.LocationQueryParam">
@@ -27,8 +27,8 @@
             FROM
                 ( SELECT merchant_id,user_id, count( merchant_id) FROM hot_merchant GROUP BY merchant_id,user_id ORDER BY count( merchant_id ) DESC ) t
                 LEFT JOIN merchant mt ON t.merchant_id = mt.id where t.user_id = #{userId}
-                and mt.region = #{param.region} and mt.status = 'ONLINE' and mt.recommend = 1
-            order by distance asc limit 20
+                and mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE' and mt.recommend = 1
+            order by distance asc limit 10
     </select>
 
 </mapper>

+ 5 - 5
vehicle-server/src/main/resources/mapper/MerchantMapper.xml

@@ -14,7 +14,7 @@
             point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
         )) distance
         from `merchant` mt
-        where mt.region = #{param.region} and mt.status = 'ONLINE'
+        where mt.region between #{param.code} and #{param.boundary}  and mt.status = 'ONLINE'
         order by distance asc limit #{size}
     </select>
 
@@ -25,7 +25,7 @@
                        point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
                    )) distance
         from `merchant` mt
-        where mt.region = #{param.region} and mt.status = 'ONLINE'
+        where mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE'
         order by distance asc
     </select>
 
@@ -35,7 +35,7 @@
             point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
         )) distance
         from `merchant` mt
-        where mt.region = #{param.region} and mt.status = 'ONLINE' and mt.recommend = 1
+        where mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE' and mt.recommend = 1
         order by distance asc limit #{size}
     </select>
 
@@ -46,7 +46,7 @@
                        point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
                    )) distance
         from `merchant` mt
-        where mt.region = #{param.region} and mt.status = 'ONLINE' and mt.recommend = 1
+        where mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE' and mt.recommend = 1
         order by distance asc
     </select>
 
@@ -92,7 +92,7 @@
         point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
         )) distance
         from `merchant` mt
-        where mt.id = #{id} and mt.region = #{param.region}
+        where mt.id = #{id} and mt.region between #{param.code} and #{param.boundary}
     </select>
 
     <select id="merchantFavorite" resultType="java.lang.Integer">