From 47fd21e1d1c14cdaf9b337eb19d0d7b0df585e3c Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 14 Nov 2024 10:34:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=20=E7=BD=AE=E7=A9=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/service/impl/TbActivateServiceImpl.java | 11 ++++++++++- .../service/impl/TbShopShareRecordServiceImpl.java | 8 +++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java index f7a25436..23583aff 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java @@ -6,6 +6,7 @@ import cn.ysk.cashier.mybatis.mapper.TbActivateMapper; import cn.ysk.cashier.mybatis.service.TbActivateService; import cn.ysk.cashier.mybatis.service.TbShopCouponService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -44,7 +45,15 @@ public class TbActivateServiceImpl extends ServiceImpl 0) { - activateMapper.updateById(activate); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("id", activate.getId()).setEntity(activate); + if (Objects.isNull(activate.getCouponId())) { + updateWrapper.set("couponId", null); + } + if (Objects.isNull(activate.getGiftPoints())) { + updateWrapper.set("giftPoints", null); + } + activateMapper.update(updateWrapper); } else { activateMapper.insert(activate); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java index e79672d3..fbadec6a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java @@ -54,14 +54,14 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl coupons, boolean isReward) { + public void giveCoupon(TbShopShare shopShare, TbShopUser tbShopUser, List coupons ,Integer flowId, boolean isReward) { for (TbShopShare.ShareCoupons newCoupon : coupons) { TbShopCoupon tbShopCoupon = couponMapper.selectById(newCoupon.getCouponId()); Date start = new Date(); @@ -89,6 +89,7 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl