|
@@ -3,8 +3,8 @@
|
|
|
<mapper namespace="com.chelvc.cloud.vehicle.server.dao.MerchantMapper">
|
|
|
<sql id="BASIC_MERCHANT_SELECT">
|
|
|
select mt.id, mt.user_id, mt.name, mt.logo, mt.banners, mt.liaison, mt.mobile, mt.opening, mt.address,
|
|
|
- mt.score, mt.sale, mt.region, mt.longitude, mt.latitude, mt.recommend, mt.status, mt.creator, mt.create_time,
|
|
|
- mt.updater, mt.update_time
|
|
|
+ mt.score, mt.sale, mt.good_review,mt.region, mt.longitude, mt.latitude, mt.recommend, mt.status, mt.creator,
|
|
|
+ mt.create_time,mt.updater, mt.update_time
|
|
|
from `merchant` mt
|
|
|
</sql>
|
|
|
|
|
@@ -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
|
|
@@ -67,4 +67,16 @@
|
|
|
</if>
|
|
|
limit #{size}
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getMerchantById" resultType="com.chelvc.cloud.vehicle.server.entity.Merchant">
|
|
|
+ select mt.id, mt.user_id as userId, mt.name, mt.logo, mt.banners, mt.liaison, mt.mobile,
|
|
|
+ mt.opening, mt.address, mt.score, mt.sale, mt.good_review as goodReview,mt.region, mt.longitude,
|
|
|
+ mt.latitude, mt.recommend, mt.status, mt.creator,
|
|
|
+ mt.create_time as createTime,
|
|
|
+ round(st_distance_sphere(
|
|
|
+ point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
|
|
|
+ )) distance
|
|
|
+ from `merchant` mt
|
|
|
+ where mt.id = #{id} and mt.region = #{param.region}
|
|
|
+ </select>
|
|
|
</mapper>
|