|
@@ -50,6 +50,36 @@
|
|
|
order by distance asc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="merchantPagingList" resultType="com.chelvc.cloud.vehicle.client.dto.MerchantDTO">
|
|
|
+ select mt.id, mt.name, mt.logo, mt.score,mt.opening, mt.sale, mt.address,mt.business_status,c.name as mainBusinessName,mt.main_business,
|
|
|
+ round(st_distance_sphere(
|
|
|
+ point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
|
|
|
+ )) distance
|
|
|
+ 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'
|
|
|
+ <if test="param.keyword != null and !param.keyword.isEmpty()">
|
|
|
+ and (mt.name like concat('%', #{param.keyword}, '%')
|
|
|
+ or mt.id in (select gds.merchant_id from goods gds where gds.name like concat('%', #{param.keyword}, '%')))
|
|
|
+ </if>
|
|
|
+ <if test="param.categoryId != null">
|
|
|
+ and (mt.main_business = #{param.categoryId} or mt.ancillary_business like concat('%',#{param.categoryId} , '%'))
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="param.sort != null and param.sort.name == 'SYNTHESE'">
|
|
|
+ order by mt.recommend desc
|
|
|
+ </if>
|
|
|
+ <if test="param.sort != null and param.sort.name == 'NEAREST'">
|
|
|
+ order by distance desc
|
|
|
+ </if>
|
|
|
+ <if test="param.sort != null and param.sort.name == 'FAVORITE'">
|
|
|
+ order by mt.score desc
|
|
|
+ </if>
|
|
|
+ <if test="param.sort != null and param.sort.name == 'BESTSELLING'">
|
|
|
+ order by mt.sale desc
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="listSimpleMerchants" resultType="com.chelvc.cloud.vehicle.client.dto.MerchantDTO">
|
|
|
select mt.id, mt.name, mt.logo, mt.score,mt.opening, mt.sale, mt.address,mt.business_status,c.name as mainBusinessName,mt.main_business,
|
|
|
round(st_distance_sphere(
|
|
@@ -62,7 +92,8 @@
|
|
|
</if>
|
|
|
mt.region between #{code} and #{boundary} and mt.status = 'ONLINE'
|
|
|
<if test="keyword != null and !keyword.isEmpty()">
|
|
|
- and mt.name like concat('%', #{keyword}, '%')
|
|
|
+ and (mt.name like concat('%', #{keyword}, '%')
|
|
|
+ or mt.id in (select gds.merchant_id from goods gds where gds.name like concat('%', #{keyword}, '%')))
|
|
|
</if>
|
|
|
<if test="categoryId != null">
|
|
|
and (mt.main_business = #{categoryId} or mt.ancillary_business like concat('%',#{categoryId} , '%'))
|