瀏覽代碼

商家距离改为整数类型

qizai 1 年之前
父節點
當前提交
4ca97e921c

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

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

+ 1 - 1
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/entity/Merchant.java

@@ -122,5 +122,5 @@ public class Merchant extends ModifyEntity<Long> {
      * 距离(米)
      */
     @TableField(exist = false)
-    private Double distance;
+    private Integer distance;
 }

+ 4 - 4
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})
-        ),1) distance
+        )) 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})
-        ),1) distance
+        )) 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})
-        ),1) distance
+        )) distance
         from `merchant` mt
         <if test="categoryId != null or (keyword != null and !keyword.isEmpty())">
             left join `goods` gs on gs.merchant_id = mt.id
@@ -75,7 +75,7 @@
         mt.create_time as createTime,
         round(st_distance_sphere(
         point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
-        ), 1) distance
+        )) distance
         from `merchant` mt
         where mt.id = #{id} and mt.region = #{param.region}
     </select>