zoujiajian 3 лет назад
Родитель
Сommit
cb9874c09e

+ 7 - 1
netflix-dao/src/main/resources/mapper/GroupRelationMapper.xml

@@ -158,7 +158,7 @@
     </select>
 
     <select id="getTicketGoodsId" resultType="java.lang.Long">
-        select sku.goods_id from (select * from `groups_relation` where status in
+        select distinct goods_id from (select sku.goods_id from (select * from `groups_relation` where status in
         <foreach collection="status" item="item" open="(" separator="," close=")">
             #{item}
         </foreach>
@@ -167,6 +167,12 @@
             #{item}
         </foreach>)gr left join groups_trips gt on gt.id = gr.groups_id
         left join goods_don_sku sku on sku.id = gt.sku_id
+        union all
+        select goods_id from order_don o where user_id in
+        <foreach collection="list" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        and relation_id = 0 and status not in ('close','noPayment','refund'))s
     </select>
 
     <select id="getRecommendGoodsViews" resultType="com.cyksj.model.views.UserRecommendGoodsFrontView">

+ 9 - 5
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -470,13 +470,17 @@ public class GroupRelationController {
         List<Long> userIds = userService.getRelationUserIdList(userId, null);
         List<Long> filter_goods_id = relationMapper.getTicketGoodsId(userIds, List.of("validity", "overdue", "outside"));
         //用户是否购买过奈飞产品
-        int count = orderDonService.count(Wrappers.lambdaQuery(OrderDon.class)
-                .eq(OrderDon::getGoodsId, 1)
-                .notIn(OrderDon::getStatus, Constant.noOrderAllStatus));
         Boolean isPayNf = false;
-        if (count > 0) {
-            //优先展示路由器、ai、流媒体
+        if (filter_goods_id.contains(1l)) {
             isPayNf = true;
+        } else {
+            int count = orderDonService.count(Wrappers.lambdaQuery(OrderDon.class)
+                    .eq(OrderDon::getGoodsId, 1)
+                    .notIn(OrderDon::getStatus, Constant.noOrderAllStatus));
+            if (count > 0) {
+                //优先展示路由器、ai、流媒体
+                isPayNf = true;
+            }
         }
         Page<UserRecommendGoodsFrontView> page = groupRelationFrontService.getRecommendGoodsViews(isPayNf, filter_goods_id, start, limit);
         return GatewayResponse.SUCCESS.newBuilder().toResult(page);