Kaynağa Gözat

fix 相同优惠到期时间前先使用

zoujiajian 5 ay önce
ebeveyn
işleme
fafef699d4

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

@@ -51,10 +51,10 @@
         and cu.channel != 'exCode'
         and cu.valid_end_time > now()
         <if test="couponId == null">
-            order by isAvailable desc,orderby,couponMoney desc
+            order by isAvailable desc,orderby,couponMoney desc,cu.valid_end_time asc
         </if>
         <if test="couponId != null">
-            order by case when cp.id = #{couponId} then 2 else isAvailable end desc,orderby,couponMoney desc,valid_end_time asc
+            order by case when cp.id = #{couponId} then 2 else isAvailable end desc,orderby,couponMoney desc,cu.valid_end_time asc
         </if>)s where flag = 1 and couponUserStatus != 'used' and orderby != 2
     </select>
 
@@ -313,7 +313,7 @@
                  inner join coupon_sku cs on cs.coupon_id = c.id and cs.sku_id = #{skuId}
                  inner join goods_don_sku sku on sku.id = cs.sku_id and sku.status is true
         and c.use_scope != 'renew'
-        order by couponMoney desc limit 1
+        order by couponMoney desc,cu.valid_end_time asc limit 1
     </select>
 
     <select id="selectNoLoginRecommendCouponReduce" resultType="com.cyksj.model.entity.Coupon">