From 42775cae36ea5ac786b6539ab73a38d9db844057 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 14 Nov 2024 13:53:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E5=88=B8=20?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java | 5 +++++ .../mybatis/service/impl/TbShopCouponServiceImpl.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java index 676a0c34..ece33c8c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java @@ -44,6 +44,11 @@ public interface TbActivateInRecordMapper extends BaseMapper " order by inRecord.use_end_time asc") List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); + @Select("SELECT sum( over_num ) from tb_activate_in_record" + + " where coupon_id = #{couponId} and now() < use_end_time group by coupon_id ") + int countNoUseCoupon(@Param("couponId") Integer couponId); + + @Update("update tb_activate_in_record" + " set over_num = #{overNum}" + " where id = #{id}") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 560fef57..b2a80ac0 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -160,6 +160,10 @@ public class TbShopCouponServiceImpl extends ServiceImpl 0) { + throw new BadRequestException("该优惠券有发放后未使用,无法删除"); + } } tbShopCouponmapper.deleteBatchIds(Arrays.asList(ids)); for (Integer id : ids) {