|
@@ -2,23 +2,33 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.chelvc.cloud.vehicle.server.dao.HotMerchantMapper">
|
|
|
|
|
|
- <select id="listHotMerchant" resultType="com.chelvc.cloud.vehicle.api.dto.MerchantDTO">
|
|
|
+ <select id="listHotMerchant" resultType="com.chelvc.cloud.vehicle.api.dto.MerchantDTO" parameterType="com.chelvc.cloud.vehicle.api.param.LocationQueryParam">
|
|
|
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,
|
|
|
+ round(st_distance_sphere(
|
|
|
+ point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
|
|
|
+ )) distance,
|
|
|
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
|
|
|
</select>
|
|
|
|
|
|
- <select id="likeMerchant" resultType="com.chelvc.cloud.vehicle.api.dto.MerchantDTO">
|
|
|
+ <select id="likeMerchant" resultType="com.chelvc.cloud.vehicle.api.dto.MerchantDTO" parameterType="com.chelvc.cloud.vehicle.api.param.LocationQueryParam">
|
|
|
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
|
|
|
+ mt.create_time as createTime,
|
|
|
+ round(st_distance_sphere(
|
|
|
+ point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
|
|
|
+ )) distance
|
|
|
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
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|