package com.ruoyi.promotion.service.impl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.ruoyi.promotion.mapper.PromotionWishRecommendMapper;
|
import com.ruoyi.promotion.service.IPromotionWishRecommendService;
|
import com.ruoyi.system.api.domain.PromotionWishRecommend;
|
import org.springframework.stereotype.Service;
|
|
/**
|
* <p>
|
* 心愿求购平台推荐商品 服务实现类
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-10-29
|
*/
|
@Service
|
public class PromotionWishRecommendServiceImpl extends
|
ServiceImpl<PromotionWishRecommendMapper, PromotionWishRecommend> implements
|
IPromotionWishRecommendService {
|
/**
|
* 扣减推荐商品库存
|
* @param goodsQuantity
|
* @param id
|
* @return
|
*/
|
@Override
|
public Integer subRecommendAvailableNum(Integer goodsQuantity, Long id) {
|
return baseMapper.subRecommendAvailableNum(goodsQuantity, id);
|
}
|
/**
|
* 恢复荐商品可购数量
|
* @param goodsQuantity
|
* @param id
|
* @return
|
*/
|
@Override
|
public void addRecommendAvailableNum(Integer goodsQuantity, Long id) {
|
this.lambdaUpdate()
|
.setSql("available_num = available_num +" + goodsQuantity)
|
.eq(PromotionWishRecommend::getId, id).update();
|
}
|
}
|