jiangqs
2023-05-09 9552ca1443fb4401e4361a2f8b38c6a52eb151d0
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
package com.ruoyi.order.controller.business;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.order.domain.dto.AppConsumerPageDto;
import com.ruoyi.order.domain.dto.MerGoodsPageDto;
import com.ruoyi.order.domain.dto.MerShopGoodsEditDto;
import com.ruoyi.order.domain.vo.AppConsumerPageVo;
import com.ruoyi.order.domain.vo.MerGoodsPageVo;
import com.ruoyi.order.service.goods.GoodsService;
import com.ruoyi.system.api.domain.dto.MerBaseDto;
import com.ruoyi.system.api.domain.poji.member.Member;
import com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
/**
 * @author jqs34
 * @ClassName MerGoodsController
 * @description: TODO
 * @date 2023年05月04日
 * @version: 1.0
 */
@Api(value = "商户端商品相关接口", tags = "商户端商品相关接口", description = "商户端商品相关接口")
@RestController
@RequestMapping("/mer/goods")
public class MerGoodsController {
 
    @Autowired
    private GoodsService goodsService;
 
    @RequestMapping(value = "/pageMerShopGoods", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取商户商品列表")
    public R<Page<MerGoodsPageVo>> pageMerShopGoods(@RequestBody MerGoodsPageDto merGoodsPageDto) {
        Long userId = SecurityUtils.getUserId();
        Page<MerGoodsPageVo> page = new Page<>();
        page.setSize(merGoodsPageDto.getPageSize());
        page.setCurrent(merGoodsPageDto.getPageNum());
        page.setOptimizeCountSql(false);
        List<MerGoodsPageVo> merGoodsPageVoList = goodsService.pageMerShopGoods(page,merGoodsPageDto);
        return R.ok(page.setRecords(merGoodsPageVoList));
    }
 
    @RequestMapping(value = "/editMerShopGoods", method = RequestMethod.POST)
    @ApiOperation(value = "编辑商户商品价格")
    public R editMerShopGoods(@RequestBody MerShopGoodsEditDto merShopGoodsEditDto) {
        Long userId = SecurityUtils.getUserId();
        merShopGoodsEditDto.setUserId(userId);
        goodsService.editMerShopGoods(merShopGoodsEditDto);
        return R.ok();
    }
}