| | |
| | | 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.GoodsBrandDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsBrandQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsBrandVO; |
| | | import com.ruoyi.goods.service.IGoodsBrandService; |
| | | 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; |
| | | |
| | |
| | | * @author mitao |
| | | * @since 2024-05-16 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/mgt/goods-brand") |
| | | @RequiredArgsConstructor |
| | | @Api(value = "管理后台商品品牌相关接口", tags = {"管理后台接口"}) |
| | | public class MgtGoodsBrandController { |
| | | |
| | | private final IGoodsBrandService goodsBrandService; |
| | | |
| | | /** |
| | | * 获取商品品牌列表的分页数据 |
| | | * |
| | | * @param query 商品信息查询对象,用于指定分页查询的条件 |
| | | * @return 返回一个包含商品品牌分页数据的结果对象,其中包含了分页信息和商品品牌列表 |
| | | */ |
| | | @ApiOperation(value = "获取商品品牌列表的分页数据", notes = "获取商品品牌列表的分页数据") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<GoodsBrandVO>> getGoodsBrandPage( |
| | | @Validated @RequestBody GoodsBrandQuery query) { |
| | | return R.ok(goodsBrandService.getGoodsBrandPage(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加/编辑商品品牌 |
| | | * |
| | | * @param dto 商品品牌数据传输对象,包含商品品牌的详细信息,通过验证后将数据持久化。 |
| | | * @return 返回操作结果,如果操作成功,返回一个成功的标识。 |
| | | */ |
| | | @ApiOperation(value = "添加/编辑 商品品牌", notes = "添加/编辑 商品品牌") |
| | | @PostMapping("/save") |
| | | public R<Void> saveGoodsBrand(@Validated @RequestBody GoodsBrandDTO dto) { |
| | | // 调用服务层方法,保存商品品牌信息 |
| | | goodsBrandService.saveGoodsBrand(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除商品品牌 |
| | | * |
| | | * @param id 商品品牌的ID,用于指定要删除的品牌 |
| | | * @return 返回操作结果,如果删除成功,则返回成功状态 |
| | | */ |
| | | @ApiOperation(value = "删除商品品牌", notes = "删除商品品牌") |
| | | @DeleteMapping("/{id}") |
| | | public R<Void> deleteGoodsBrand(@PathVariable("id") Long id) { |
| | | // 通过ID删除商品品牌 |
| | | goodsBrandService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |