批量插入
This commit is contained in:
@@ -49,7 +49,7 @@ public class MkCouponGiftServiceImpl extends ServiceImpl<MkCouponGiftMapper, MkC
|
||||
public void addCouponGift(Long sourceId, String sourceName, Integer type, List<MkCouponGiftDTO> couponGiftList) {
|
||||
remove(new QueryWrapper().eq(MkCouponGift::getSourceId, sourceId).eq(MkCouponGift::getType, type));
|
||||
if (CollUtil.isNotEmpty(couponGiftList)) {
|
||||
List newCoupons = new ArrayList<>();
|
||||
List<MkCouponGift> newCoupons = new ArrayList<>();
|
||||
for (MkCouponGiftDTO giftDTO : couponGiftList) {
|
||||
ShopCoupon coupon = couponMapper.selectOneByQuery(new QueryWrapper().eq(ShopCoupon::getId, giftDTO.getCouponId()));
|
||||
if (coupon == null) {
|
||||
@@ -64,7 +64,7 @@ public class MkCouponGiftServiceImpl extends ServiceImpl<MkCouponGiftMapper, MkC
|
||||
couponGift.setNum(giftDTO.getNum());
|
||||
newCoupons.add(couponGift);
|
||||
}
|
||||
saveBatch(newCoupons);
|
||||
mapper.insertBatchSelective(newCoupons, 50);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
||||
recordList.add(record);
|
||||
}
|
||||
}
|
||||
saveBatch(recordList);
|
||||
mapper.insertBatchSelective(recordList, 50);
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
ShopCoupon newCoupon = new ShopCoupon();
|
||||
newCoupon.setGiftNum(coupon.getGiftNum());
|
||||
|
||||
Reference in New Issue
Block a user