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
package com.ruoyi.auction.controller.management;
 
 
import com.ruoyi.auction.controller.management.dto.AuctionGoodsDTO;
import com.ruoyi.auction.controller.management.dto.AuctionGoodsQuery;
import com.ruoyi.auction.controller.management.vo.AuctionGoodsVO;
import com.ruoyi.auction.service.IAuctionGoodsService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.page.PageDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * <p>
 * 拍卖商品表 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-05-16
 */
@Api(value = "拍卖商品管理相关接口", tags = {"管理后台接口"})
@RestController
@RequiredArgsConstructor
@RequestMapping("/mgt/auction-goods")
public class MgtAuctionGoodsController {
 
    private final IAuctionGoodsService auctionGoodsService;
 
    /**
     * 获取拍卖商品列表的分页数据
     *
     * @param query 拍卖商品查询对象
     * @return PageDTO<AuctionGoodsVO>
     */
    @ApiOperation(value = "获取拍卖商品列表的分页数据", notes = "获取拍卖商品列表的分页数据")
    @PostMapping("/page")
    public R<PageDTO<AuctionGoodsVO>> getAuctionGoodsPage(
            AuctionGoodsQuery query) {
        return R.ok(auctionGoodsService.getAuctionGoodsPage(query));
    }
 
    /**
     * 查看详情
     *
     * @param id 拍卖商品id
     * @return AuctionGoodsVO
     */
    @ApiOperation(value = "查看详情", notes = "查看详情")
    @GetMapping("/{id}")
    public R<AuctionGoodsVO> getAuctionGoods(@PathVariable("id") Long id) {
        return R.ok(auctionGoodsService.getAuctionGoodsById(id));
    }
 
    /**
     * 添加/编辑 拍卖商品
     *
     * @param dto 拍卖商品数据传输对象
     */
    @ApiOperation(value = "添加/编辑 拍卖商品", notes = "添加/编辑 拍卖商品")
    @PostMapping("/save")
    public R<?> saveAuctionGoods(@Validated @RequestBody AuctionGoodsDTO dto) {
        auctionGoodsService.saveAuctionGoods(dto);
        return R.ok();
    }
 
    @ApiOperation("立即结束")
    @PutMapping("/stop/{id}")
    public R<?> stopAuctionGoods(@PathVariable("id") Long id) {
        auctionGoodsService.stopAuctionGoods(id);
        return R.ok();
    }
}