消费赠券 关联内容 先删除
This commit is contained in:
@@ -13,6 +13,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
|||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -43,8 +44,10 @@ public class MkCouponGiftServiceImpl extends ServiceImpl<MkCouponGiftMapper, MkC
|
|||||||
return listAs(new QueryWrapper().eq(MkCouponGift::getSourceId, sourceId).eq(MkCouponGift::getType, type), MkCouponGiftDTO.class);
|
return listAs(new QueryWrapper().eq(MkCouponGift::getSourceId, sourceId).eq(MkCouponGift::getType, type), MkCouponGiftDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void addCouponGift(Long sourceId, String sourceName, Integer type, List<MkCouponGiftDTO> couponGiftList) {
|
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)) {
|
if (CollUtil.isNotEmpty(couponGiftList)) {
|
||||||
List newCoupons = new ArrayList<>();
|
List newCoupons = new ArrayList<>();
|
||||||
for (MkCouponGiftDTO giftDTO : couponGiftList) {
|
for (MkCouponGiftDTO giftDTO : couponGiftList) {
|
||||||
|
|||||||
Reference in New Issue
Block a user