mitao
2025-01-26 d8f625aa7687319971cfb82e1d10625fcd745085
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package com.ruoyi.promotion.controller.management;
 
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.promotion.controller.management.dto.MgtPromotionWishQuery;
import com.ruoyi.promotion.controller.management.dto.MgtPromotionWishRecommendDTO;
import com.ruoyi.promotion.controller.management.vo.MgtPromotionWishVO;
import com.ruoyi.promotion.service.IPromotionWishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * <p>
 * 心愿求购 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-10-29
 */
@Validated
@RestController
@RequiredArgsConstructor
@Api(tags = {"【09.25】管理后台心愿求购管理相关接口"})
@RequestMapping("/mgt/promotion-wish")
public class MgtPromotionWishController {
 
    private final IPromotionWishService promotionWishService;
 
    /**
     * 获取心愿求购列表
     *
     * @param query
     * @return
     */
    @PostMapping("/page")
    @ApiOperation(value = "获取心愿求购列表")
    public R<PageDTO<MgtPromotionWishVO>> queryPage(
            @Valid @RequestBody MgtPromotionWishQuery query) {
        return R.ok(promotionWishService.queryPage(query));
    }
 
    /**
     * 查看详情
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    @ApiOperation(value = "查看详情")
    public R<MgtPromotionWishVO> getDetails(
            @ApiParam(name = "id", value = "心愿求购id", required = true) @NotNull(message = "心愿求购id不能为空") @PathVariable("id") Long id) {
        return R.ok(promotionWishService.getDetails(id));
    }
 
    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除心愿求购")
    public R<?> deleteById(
            @ApiParam(name = "id", value = "心愿求购id", required = true) @NotNull(message = "心愿求购id不能为空") @PathVariable("id") Long id) {
        promotionWishService.deleteById(id);
        return R.ok();
    }
 
    /**
     * 推荐商品
     * @param dto
     * @return
     */
    @PostMapping("/recommend")
    @ApiOperation(value = "推荐商品")
    public R<?> recommend(@Valid @RequestBody MgtPromotionWishRecommendDTO dto) {
        promotionWishService.recommend(dto);
        return R.ok();
    }
 
    /**
     * 删除推荐商品
     * @param id
     * @return
     */
    @DeleteMapping("/recommend/{id}")
    @ApiOperation(value = "删除推荐商品")
    public R<?> deleteRecommend(
            @ApiParam(name = "id", value = "推荐商品id", required = true) @NotNull(message = "推荐商品id不能为空") @PathVariable("id") Long id) {
        promotionWishService.deleteRecommend(id);
        return R.ok();
    }
 
    /**
     * 展示隐藏
     * @param id
     * @return
     */
    @ApiOperation("展示隐藏")
    @GetMapping("/show-hide/{id}")
    public R<?> showHide(
            @ApiParam(name = "id", value = "求购id", required = true) @NotNull(message = "求购id不能为空") @PathVariable("id") Long id) {
        promotionWishService.showHide(id);
        return R.ok();
    }
}