feat(goods): 添加商品分类接口参数校验- 在添加和修改商品分类接口中引入 @Valid 注解
This commit is contained in:
parent
887ab084e9
commit
eeab201625
@ -9,6 +9,7 @@ import com.wzj.soopin.goods.domain.vo.ProductCategoryVO;
|
||||
import com.wzj.soopin.goods.service.ProductCategoryService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
@ -65,14 +66,14 @@ public class ProductCategoryController extends BaseController {
|
||||
@Operation(summary = "获取商品分类详细信息")
|
||||
@Log(title = "商品分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public R add(@RequestBody ProductCategory productCategory) {
|
||||
public R add(@RequestBody @Valid ProductCategory productCategory) {
|
||||
return R.ok(service.save(productCategory));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改商品分类")
|
||||
@Log(title = "商品分类", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public R edit(@RequestBody ProductCategory productCategory) {
|
||||
public R edit(@RequestBody @Valid ProductCategory productCategory) {
|
||||
return R.ok(service.updateById(productCategory));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user