Bladeren bron

查询商家距离改为double类型

qizai 1 jaar geleden
bovenliggende
commit
f579d86827

+ 1 - 1
vehicle-api/src/main/java/com/chelvc/cloud/vehicle/api/dto/MerchantDTO.java

@@ -80,7 +80,7 @@ public class MerchantDTO implements Serializable {
     /**
      * 距离(米)
      */
-    private Integer distance;
+    private Double distance;
 
     /**
      * 经度

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

@@ -12,7 +12,7 @@
         select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,
         round(st_distance_sphere(
             point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
-        )) distance
+        ),1) distance
         from `merchant` mt
         where mt.region = #{param.region} and mt.status = 'ONLINE'
         order by distance asc limit #{size}
@@ -22,7 +22,7 @@
         select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,
         round(st_distance_sphere(
             point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
-        )) distance
+        ),1) distance
         from `merchant` mt
         where mt.region = #{param.region} and mt.status = 'ONLINE' and mt.recommend = 1
         order by distance asc limit #{size}
@@ -32,7 +32,7 @@
         select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,
         round(st_distance_sphere(
             point(mt.longitude, mt.latitude), point(#{longitude}, #{latitude})
-        )) distance
+        ),1) distance
         from `merchant` mt
         <if test="categoryId != null or (keyword != null and !keyword.isEmpty())">
             left join `goods` gs on gs.merchant_id = mt.id