mitao
2024-11-04 11fa4b3bcdda902de8d9818038a1bd35beaa5ec4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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();
    }
}