Pu Zhibing
2025-03-26 7f26677ab7f9b83697370fa142dd1686cdf4082a
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.ruoyi.other.api.feignClient;
 
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.factory.GoodsClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
 
import java.util.List;
 
/**
 * @author zhibing.pu
 * @Date 2024/11/27 19:56
 */
@FeignClient(contextId = "GoodsClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = GoodsClientFallbackFactory.class)
public interface GoodsClient{
    
    
    /**
     * 根据类型(1=服务商品,2=单品商品)获取商品数据
     * @param type
     * @return
     */
    @PostMapping("/goods/getGoodsByType")
    R<List<Goods>> getGoodsByType(@RequestParam("type") Integer type);
    
    
    /**
     * 根据id获取商品详情
     * @param id
     * @return
     */
    @PostMapping("/goods/getGoodsById")
    R<Goods> getGoodsById(@RequestParam("id") Integer id);
 
 
    @PostMapping("/goods/getGoodsByIds")
    R<List<Goods>> getGoodsById(@RequestParam("ids") String[]  ids);
 
 
    /**
     * 编辑商品信息
     * @param goods
     * @return
     */
    @PostMapping("/goods/editGoods")
    R editGoodsList(@RequestBody List<Goods> goods);
 
    /**
     * 商品销量增加
     */
    @PutMapping("/goods/editGoodsNum")
    R<Void> editGoodsNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("num") Integer num);
 
 
    /**
     * 获取所有商品
     * @return
     */
    @PostMapping("/goods/getAllGoods")
    R<List<Goods>> getAllGoods();
}