Parcourir la source

Merge branch 'dev/shop-ranking' of mxys/mxys_backend into dev/inside_address

lzl il y a 9 mois
Parent
commit
efc880f92d

+ 1 - 1
src/main/java/com/sqx/modules/goods/dto/ShopQueryDTO.java

@@ -13,7 +13,7 @@ import lombok.Data;
 public class ShopQueryDTO extends PageQuery {
     private Long userId;
     /**
-     * 1 综合排序(评分),2 商户类型筛选,3 距离排序,4 销量, 5 配送费排序,6 免配送费筛选
+     * 1 系统排序 2评分排序 3销量排序 4店铺创建时间排序
      */
     private Integer screen;
     private Integer shopTypeId;

+ 49 - 33
src/main/resources/mapper/goods/GoodsShopMapper.xml

@@ -217,39 +217,55 @@
     </select>
 
     <select id="selectShop" resultType="com.sqx.modules.goods.entity.GoodsShop">
-        select * from (select gs.*,(st_distance (point (gs.shop_lng,gs.shop_lat),point(#{lng},#{lat}) ) *111195) AS
-        distance
-        from goods_shop gs
-        left join shop_type st on gs.shop_type_id = st.id
-        where gs.status = 1 and gs.city = #{city} and gs.putaway_flag = 0 and gs.is_supplier=1 and (gs.is_conceal =0 or gs.is_conceal is NULL)
-        <if test="impotr!=null and impotr!=''">
-            AND (gs.shop_name LIKE concat('%',#{impotr},'%') or
-            st.shop_type_name like concat('%',#{impotr},'%') or
-            gs.shop_lable LIKE concat('%',#{impotr},'%') or
-            gs.shop_id in (
-            select shop_id from goods where goods_name like concat('%',#{impotr},'%')
-            )
-            )
-        </if>
-
-        <if test="activityId!=null">
-            and gs.activity_id = #{activityId}
-        </if>
-        <if test="shopTypeId!=null">
-            and FIND_IN_SET(#{shopTypeId},gs.shop_type_id)
-        </if>
-        order by gs.is_recommend desc
-        <if test="screen==1">
-            ,gs.sort,gs.shop_score desc, distance asc
-        </if>
-        <if test="screen==3">
-            ,distance asc
-        </if>
-        <if test="screen==4">
-            ,gs.shop_sales desc
-        </if>
-        ) a
-        where distribution_distance >= distance
+        select
+            *
+        from
+            (
+                select
+                    gs.*,
+                    (st_distance (point (gs.shop_lng,gs.shop_lat),point(#{lng}, #{lat}) ) * 111195) AS distance
+                from
+                    goods_shop gs
+                left join shop_type st on gs.shop_type_id = st.id
+                where
+                    gs.status = 1
+                    and gs.city = #{city}
+                    and gs.putaway_flag = 0
+                    and gs.is_supplier=1
+                    and (gs.is_conceal =0 or gs.is_conceal is NULL)
+                <if test="impotr!=null and impotr!=''">
+                    AND (
+                        gs.shop_name LIKE concat('%',#{impotr},'%')
+                        or st.shop_type_name like concat('%',#{impotr},'%')
+                        or gs.shop_lable LIKE concat('%',#{impotr},'%')
+                        or gs.shop_id in (
+                            select shop_id from goods where goods_name like concat('%',#{impotr},'%')
+                        )
+                    )
+                </if>
+                <if test="activityId!=null">
+                    and gs.activity_id = #{activityId}
+                </if>
+                <if test="shopTypeId!=null">
+                    and FIND_IN_SET(#{shopTypeId},gs.shop_type_id)
+                </if>
+                order by
+                    gs.is_recommend desc
+                <if test="screen == 1">
+                    ,gs.sort,gs.shop_score desc, distance asc
+                </if>
+                <if test="screen == 2">
+                    ,gs.shop_score desc
+                </if>
+                <if test="screen == 3">
+                    ,gs.shop_sales desc
+                </if>
+                <if test="screen == 4">
+                    ,gs.create_time desc
+                </if>
+            ) a
+        where
+            distribution_distance >= distance
     </select>
 
     <select id="selectEvaluate" resultType="com.sqx.modules.order.entity.Evaluate">