| | |
| | | package com.ruoyi.goods.controller.mamagement; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsFlavorTypeDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsFlavorTypeQuery; |
| | | import com.ruoyi.goods.controller.mamagement.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; |
| | | |
| | |
| | | @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(); |
| | | } |
| | | |
| | | } |