From 3998771ca3bcc9443217e96cbad5c84ef8074b59 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 2 Feb 2023 14:26:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/cweb/controller/HighCouponController.java | 6 ++++-- .../src/main/java/com/hai/dao/HighCouponMapperExt.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java index 98dba365..00dacaa0 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -121,9 +121,11 @@ public class HighCouponController { try { HighCoupon coupon = highCouponService.getCouponById(couponId); - if (coupon != null & userId != null) { + if (coupon != null) { coupon.setMonthlySales(highCouponService.getMonthlySales(couponId)); - coupon.setNumberUpperLimitStatus(highCouponService.userBuyLimitNumber(userId, coupon.getId())); + if (userId != null) { + coupon.setNumberUpperLimitStatus(highCouponService.userBuyLimitNumber(userId, coupon.getId())); + } } return ResponseMsgUtil.success(coupon); diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java index f22e1092..742c2538 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java @@ -13,6 +13,6 @@ public interface HighCouponMapperExt { * @return */ @Select({"SELECT count(1) FROM `high_child_order` " + - "where goods_type = 1 and goods_id = #{couponId} and child_order_status in (2,3,6,7) and DATE_FORMAT(pay_time,'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m');"}) + " where goods_type = 1 and goods_id = #{couponId} and child_order_status in (2,3,6,7) and DATE_FORMAT(pay_time,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')"}) int getMonthlySales(@Param("couponId") Long couponId); }