|
@@ -9,53 +9,53 @@
|
|
|
</sql>
|
|
|
|
|
|
<select id="listNearbyMerchants" resultType="com.chelvc.cloud.vehicle.client.dto.MerchantDTO">
|
|
|
- select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,
|
|
|
+ select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,c.name as mainBusinessName,
|
|
|
round(st_distance_sphere(
|
|
|
point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
|
|
|
)) distance
|
|
|
- from `merchant` mt
|
|
|
+ from `merchant` mt left join category c on mt.main_business = c.id
|
|
|
where mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE'
|
|
|
order by distance asc limit #{size}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="listNearbyMerchantPaging" resultType="com.chelvc.cloud.vehicle.client.dto.MerchantDTO">
|
|
|
- select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,
|
|
|
+ select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,c.name as mainBusinessName,
|
|
|
round(st_distance_sphere(
|
|
|
point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
|
|
|
)) distance
|
|
|
- from `merchant` mt
|
|
|
+ from `merchant` mt left join category c on mt.main_business = c.id
|
|
|
where mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE'
|
|
|
order by distance asc
|
|
|
</select>
|
|
|
|
|
|
<select id="listRecommendMerchants" resultType="com.chelvc.cloud.vehicle.client.dto.MerchantDTO">
|
|
|
- select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,
|
|
|
+ select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,c.name as mainBusinessName,
|
|
|
round(st_distance_sphere(
|
|
|
point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
|
|
|
)) distance
|
|
|
- from `merchant` mt
|
|
|
+ from `merchant` mt left join category c on mt.main_business = c.id
|
|
|
where mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE' and mt.recommend = 1
|
|
|
order by distance asc limit #{size}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="listRecommendMerchantPaging" resultType="com.chelvc.cloud.vehicle.client.dto.MerchantDTO">
|
|
|
- select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,
|
|
|
+ select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,c.name as mainBusinessName,
|
|
|
round(st_distance_sphere(
|
|
|
point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
|
|
|
)) distance
|
|
|
- from `merchant` mt
|
|
|
+ from `merchant` mt left join category c on mt.main_business = c.id
|
|
|
where mt.region between #{param.code} and #{param.boundary} and mt.status = 'ONLINE' and mt.recommend = 1
|
|
|
order by distance asc
|
|
|
</select>
|
|
|
|
|
|
<select id="listSimpleMerchants" resultType="com.chelvc.cloud.vehicle.client.dto.MerchantDTO">
|
|
|
- select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,
|
|
|
+ select mt.id, mt.name, mt.logo, mt.score, mt.sale, mt.address,mt.business_status,c.name as mainBusinessName,
|
|
|
round(st_distance_sphere(
|
|
|
point(mt.longitude, mt.latitude), point(#{longitude}, #{latitude})
|
|
|
)) distance
|
|
|
- from `merchant` mt
|
|
|
+ from `merchant` mt left join category c on mt.main_business = c.id
|
|
|
<where>
|
|
|
<if test="offset != null">
|
|
|
mt.id > #{offset}
|