rentaiming
2024-05-27 43c263df4d8ce0cc830f287780c29db8a2b47f0f
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
package com.ruoyi.goods.controller.management;
 
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.goods.controller.management.dto.GoodsFlavorTypeDTO;
import com.ruoyi.goods.controller.management.dto.GoodsFlavorTypeQuery;
import com.ruoyi.goods.controller.management.vo.GoodsFlavorTypeVO;
import com.ruoyi.goods.service.IGoodsFlavorTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
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-05-16
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/mgt/goods-flavor-type")
@Api(value = "管理后台商品香型相关接口", tags = {"管理后台接口"})
public class MgtGoodsFlavorTypeController {
 
    private final IGoodsFlavorTypeService goodsFlavorTypeService;
 
    /**
     * 获取商品香型列表的分页数据
     *
     * @param query 商品香型查询条件,通过验证的请求体参数
     * @return 返回商品香型列表的分页数据,封装在R对象中,其中PageDTO包含分页信息和香型数据列表
     */
    @ApiOperation(value = "获取商品香型列表的分页数据", notes = "获取商品香型列表的分页数据")
    @PostMapping("/page")
    public R<PageDTO<GoodsFlavorTypeVO>> getGoodsFlavorTypePage(
            @Validated @RequestBody GoodsFlavorTypeQuery query) {
        return R.ok(goodsFlavorTypeService.getGoodsFlavorTypePage(query));
    }
 
    /**
     * 添加/编辑 商品香型
     *
     * @param dto 商品香型数据传输对象,通过验证的请求体参数
     * @return 返回添加/编辑操作的结果,封装在R对象中
     */
    @ApiOperation(value = "添加/编辑 商品香型", notes = "添加/编辑 商品香型")
    @PostMapping("/save")
    public R<Void> saveGoodsFlavorType(@Validated @RequestBody GoodsFlavorTypeDTO dto) {
        goodsFlavorTypeService.saveGoodsFlavorType(dto);
        return R.ok();
    }
 
    /**
     * 删除商品香型
     *
     * @param id 商品香型的ID,用于指定要删除的具体商品香型
     * @return 返回操作结果,如果删除成功,则返回一个成功的响应码
     */
    @ApiOperation(value = "删除商品香型", notes = "删除商品香型")
    @DeleteMapping("/{id}")
    public R<Void> deleteGoodsFlavorType(@PathVariable("id") Long id) {
        goodsFlavorTypeService.removeById(id);
        return R.ok();
    }
 
}