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.GoodsSeriesDTO;
|
import com.ruoyi.goods.controller.management.dto.GoodsSeriesQuery;
|
import com.ruoyi.goods.controller.management.vo.GoodsSeriesVO;
|
import com.ruoyi.goods.service.IGoodsSeriesService;
|
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-series")
|
@Api(value = "管理后台商品系列相关接口", tags = {"管理后台接口"})
|
public class MgtGoodsSeriesController {
|
|
private final IGoodsSeriesService goodsSeriesService;
|
|
/**
|
* 获取商品系列列表的分页数据
|
*
|
* @param query 商品系列查询条件,用于筛选和排序等操作
|
* @return 返回商品系列的分页数据,包含分页信息和商品系列列表
|
*/
|
@ApiOperation(value = "获取商品系列列表的分页数据", notes = "获取商品系列列表的分页数据")
|
@PostMapping("/page")
|
public R<PageDTO<GoodsSeriesVO>> getGoodsSeriesPage(
|
@Validated @RequestBody GoodsSeriesQuery query) {
|
return R.ok(goodsSeriesService.getGoodsSeriesPage(query));
|
}
|
|
/**
|
* 新增/编辑商品系列。 该接口用于通过接收商品系列数据对象(GoodsSeriesDTO),来新增或编辑商品系列信息。
|
*
|
* @param dto 商品系列数据传输对象,包含商品系列的详细信息,通过RequestBody接收。 需要进行合法性验证(@Validated)以确保数据的完整性和正确性。
|
* @return R<Void> 返回一个结果对象,表示操作是否成功。如果操作成功,返回状态码200。
|
*/
|
@ApiOperation(value = "新增/编辑 商品系列", notes = "新增/编辑 商品系列")
|
@PostMapping("/save")
|
public R<Void> saveGoodsSeries(@Validated @RequestBody GoodsSeriesDTO dto) {
|
goodsSeriesService.saveGoodsSeries(dto);
|
return R.ok();
|
}
|
|
/**
|
* 删除商品香型
|
*
|
* @param id 商品香型的ID,用于指定要删除的具体商品香型
|
* @return 返回操作结果,如果删除成功,则返回一个成功响应码
|
*/
|
@ApiOperation(value = "删除商品香型", notes = "删除商品香型")
|
@DeleteMapping("/{id}")
|
public R<Void> deleteGoodsSeries(@PathVariable("id") Long id) {
|
goodsSeriesService.removeById(id);
|
return R.ok();
|
}
|
}
|