ソースを参照

修复商家查询异常问题

woody 1 年間 前
コミット
a846022457

+ 6 - 3
vehicle-server/src/main/resources/mapper/MerchantMapper.xml

@@ -44,12 +44,12 @@
             point(mt.longitude, mt.latitude), point(#{param.longitude}, #{param.latitude})
         )) distance
         from `merchant` mt
-        <if test="param.categoryId != null or (param.keyword != null and !keyword.isEmpty())">
-            inner join `goods` gs on gs.merchant_id = mt.id
+        <if test="param.categoryId != null or (param.keyword != null and !param.keyword.isEmpty())">
+            left join `goods` gs on gs.merchant_id = mt.id
             <if test="param.categoryId != null">
                 and gs.category_id = #{param.categoryId}
             </if>
-            <if test="param.keyword != null and !keyword.isEmpty()">
+            <if test="param.keyword != null and !param.keyword.isEmpty()">
                 and (gs.name like concat('%', #{param.keyword}, '%') or gs.description like concat('%', #{param.keyword}, '%'))
             </if>
             and gs.status = 'ONLINE'
@@ -62,6 +62,9 @@
                 and mt.region = #{region}
             </if>
             and mt.status = 'ONLINE'
+            <if test="param.keyword != null and !param.keyword.isEmpty()">
+                and mt.name like concat('%', #{param.keyword}, '%')
+            </if>
         </where>
         <if test="param.sort != null and param.sort.name == 'SYNTHESE'">
             order by mt.recommend desc