Explorar o código

fix 过期优惠卷不展示

zoujiajian %!s(int64=3) %!d(string=hai) anos
pai
achega
2f47df6d46

+ 3 - 2
netflix-dao/src/main/resources/mapper/CouponRecommendMapper.xml

@@ -25,12 +25,13 @@
         (case
         when cu.id is null then 0
         when cu.id is not null and cu.status = 'unused' then 1
-        end) as `order`
+        end) as `order`,
+        if(c.is_valid_time is true and c.valid_end_time < now(),false,true) as flag
         from coupon_recommend cr left join coupon c on c.id = cr.coupon_id
         left join coupon_user cu on cu.coupon_id = c.id and cu.user_id = #{userId}
         where cr.deleted is true and c.deleted is true and cr.status = 1
         <if test='!isNewUser'>
             and c.scope !='newUser'
-        </if>)s where couponStatus != 'used' order by `order`
+        </if>)s where couponStatus != 'used' and flag is true order by `order`
     </select>
 </mapper>

+ 5 - 3
netflix-dao/src/main/resources/mapper/CouponUserMapper.xml

@@ -66,7 +66,7 @@
     <select id="couponCenterList" resultType="com.cyksj.model.views.CouponActiveView">
         select *
         from (select ca.id,
-                     c.id     as coupon_id,
+                     c.id                                                                   as coupon_id,
                      c.name,
                      c.goods_type,
                      c.type,
@@ -88,12 +88,13 @@
                           when cu.id is null then 'collecting'
                           when cu.id is not null and cu.status != 'unused' then 'used'
                           when cu.id is not null and cu.status = 'unused' then 'received'
-                         end) as couponStatus,
+                         end)                                                               as couponStatus,
                      (case
                           when remain_num &lt;= 0 then 2
                           when cu.id is null then 0
                           when cu.id is not null and cu.status = 'unused' then 1
-                         end) as `order`
+                         end)                                                               as `order`,
+                     if(c.is_valid_time is true and c.valid_end_time &lt; now(), false, true) as flag
               from coupon_active ca
                        left join coupon c
                                  on c.id = ca.coupon_id
@@ -104,6 +105,7 @@
         and ca.`status` != 0
              ) s
         where couponStatus != 'used'
+        and flag = 1
         order by `order`
     </select>