rentaiming
2024-07-18 c23f48c5ec15476299edadd91fa18f908d710a4f
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
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.GoodsInfoTitleDTO;
import com.ruoyi.goods.controller.management.dto.GoodsInfoTitleQuery;
import com.ruoyi.goods.controller.management.vo.GoodsInfoTitleVO;
import com.ruoyi.goods.service.IGoodsInfoTitleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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-info-title")
@Api(value = "管理后台商品信息标题相关接口", tags = {"管理后台-商品信息标题相关接口"})
public class MgtGoodsInfoTitleController {
 
    private final IGoodsInfoTitleService goodsInfoTitleService;
 
    /**
     * 获取商品信息标题列表的分页数据。
     *
     * @param query 商品信息标题查询条件对象,通过验证后传入。
     * @return 返回一个包含商品信息标题分页数据的结果对象。
     */
    @ApiOperation("获取商品信息标题列表的分页数据")
    @PostMapping("/page")
    public R<PageDTO<GoodsInfoTitleVO>> getGoodsInfoTitlePage(
            @Validated @RequestBody GoodsInfoTitleQuery query) {
        return R.ok(goodsInfoTitleService.getGoodsInfoTitlePage(query));
    }
 
    /**
     * 添加/编辑商品信息标题。 该接口用于接收商品信息标题的数据,并将其保存。
     *
     * @param dto 商品信息标题数据传输对象,经过验证确保数据的合法性。
     * @return 返回操作结果,如果操作成功,返回一个成功的标识。
     */
    @ApiOperation("添加/编辑 商品信息标题")
    @PostMapping("/save")
    public R<Void> saveGoodsInfoTitle(@Validated @RequestBody GoodsInfoTitleDTO dto) {
        goodsInfoTitleService.saveGoodsInfoTitle(dto);
        return R.ok();
    }
 
    /**
     * 删除商品信息标题
     *
     * @param id 商品信息标题的ID,用于指定要删除的商品信息标题。
     * @return 返回一个表示操作结果的R<Void>对象,如果操作成功,R对象的status为200;否则根据具体情况进行相应处理。
     */
    @ApiOperation("删除商品信息标题")
    @DeleteMapping("/{id}")
    public R<Void> deleteGoodsInfoTitle(
            @ApiParam(name = "id", value = "商品信息标题id", required = true) @PathVariable("id") Long id) {
        goodsInfoTitleService.delete(id);
        return R.ok();
    }
 
}