jiangqs
2023-06-18 c00d0d3bc399b6648145dfd955cedbea90f5f99d
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package com.ruoyi.goods.controller.concole;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.goods.service.goods.GoodsFileService;
import com.ruoyi.goods.service.goods.GoodsService;
import com.ruoyi.goods.service.goods.ShopGoodsService;
import com.ruoyi.system.api.domain.dto.AppShopGoodsGetDto;
import com.ruoyi.system.api.domain.poji.goods.Goods;
import com.ruoyi.system.api.domain.poji.goods.GoodsFile;
import com.ruoyi.system.api.domain.poji.goods.ShopGoods;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * @author jqs34
 * @ClassName GoodsController
 * @description: TODO
 * @date 2023年05月23日
 * @version: 1.0
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {
 
    @Resource
    private GoodsService goodsService;
 
    @Resource
    private GoodsFileService goodsFileService;
 
    @Resource
    private ShopGoodsService shopGoodsService;
 
    @PostMapping("/getGoods")
    public R<Goods> getGoods(@RequestBody String goodsId)
    {
        Goods goods = goodsService.getById(goodsId);
        return R.ok(goods);
    }
 
    @PostMapping("/getGoodsFile")
    public R<GoodsFile> getGoodsFile(@RequestBody String goodsId)
    {
        GoodsFile goodsFile = goodsFileService.getGoodsPicture(goodsId);
        return R.ok(goodsFile);
    }
 
    @PostMapping("/getShopGoods")
    public R<ShopGoods> getShopGoods(@RequestBody AppShopGoodsGetDto appShopGoodsGetDto)
    {
        ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(appShopGoodsGetDto.getShopId(),appShopGoodsGetDto.getGoodsId());
        return R.ok(shopGoods);
    }
 
    /**
     * @description  删除商品分类
     * @author  jqs
     * @date    2023/6/8 17:08
     * @param classId
     * @return  R
     */
    @PostMapping("/deleteGoodsClass")
    public R deleteGoodsClass(@RequestBody Long classId)
    {
        goodsService.deleteGoodsClass(classId);
        return R.ok();
    }
 
    /**
     * @description  删除商品标签
     * @author  jqs
     * @date    2023/6/8 17:07
     * @param goodsTag
     * @return  R
     */
    @PostMapping("/deleteGoodsTag")
    public R deleteGoodsTag(@RequestBody String goodsTag)
    {
        goodsService.deleteGoodsTag(goodsTag);
        return R.ok();
    }
 
    /**
     * @description  通过id获取商品列表
     * @author  jqs
     * @date    2023/6/13 15:55
     * @param goodsIds
     * @return  R<List<Goods>>
     */
    @PostMapping("/listGoodsByGoodsId")
    public R<List<Goods>> listGoodsByGoodsId(@RequestBody String goodsIds)
    {
        List<Goods> goodsList = goodsService.listGoodsByGoodsId(goodsIds);
        return R.ok(goodsList);
    }
 
 
}