package com.ruoyi.promotion.controller.inner;
|
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.security.annotation.InnerAuth;
|
import com.ruoyi.promotion.service.IPromotionWishRecommendService;
|
import com.ruoyi.system.api.domain.PromotionWishRecommend;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
/**
|
* <p>
|
* 心愿求购平台推荐商品 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-10-29
|
*/
|
@RestController
|
@RequestMapping("/inner/promotion-wish-recommend")
|
@RequiredArgsConstructor
|
public class PromotionWishRecommendController {
|
|
private final IPromotionWishRecommendService promotionWishRecommendService;
|
|
/**
|
*
|
* @param id
|
* @return
|
*/
|
@InnerAuth
|
@GetMapping("/{id}")
|
public R<PromotionWishRecommend> getById(@PathVariable("id") Long id) {
|
return R.ok(promotionWishRecommendService.getById(id));
|
}
|
|
/**
|
* 扣减推荐商品库存
|
* @param goodsQuantity
|
* @param id
|
* @return
|
*/
|
@InnerAuth
|
@PostMapping("/subAvailableNum")
|
R<Integer> subRecommendAvailableNum(@RequestParam("goodsQuantity") Integer goodsQuantity,
|
@RequestParam("id") Long id) {
|
return R.ok(promotionWishRecommendService.subRecommendAvailableNum(goodsQuantity, id));
|
}
|
|
/**
|
* 恢复荐商品可购数量
|
* @param goodsQuantity
|
* @param id
|
* @return
|
*/
|
@InnerAuth
|
@PostMapping("/addAvailableNum")
|
R<?> addRecommendAvailableNum(@RequestParam("goodsQuantity") Integer goodsQuantity,
|
@RequestParam("id") Long id) {
|
promotionWishRecommendService.addRecommendAvailableNum(goodsQuantity, id);
|
return R.ok();
|
}
|
}
|