🎨 完善用户权限判断
This commit is contained in:
parent
823ef3d1c4
commit
58c9a2995d
@ -26,6 +26,7 @@ import javax.annotation.Resource;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/product")
|
@RequestMapping("/api/v1/product")
|
||||||
|
@RequiresRoles(value = {"blog_admin", "admin"}, logical = Logical.OR)
|
||||||
public class ProductController {
|
public class ProductController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -38,14 +39,12 @@ public class ProductController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/post")
|
@PostMapping("/post")
|
||||||
@RequiresRoles(value = {"blog_admin", "admin"}, logical = Logical.OR)
|
|
||||||
public GlobalResult<Product> add(@RequestBody ProductDTO product) {
|
public GlobalResult<Product> add(@RequestBody ProductDTO product) {
|
||||||
Product newProduct = productService.postProduct(product);
|
Product newProduct = productService.postProduct(product);
|
||||||
return GlobalResultGenerator.genSuccessResult(newProduct);
|
return GlobalResultGenerator.genSuccessResult(newProduct);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/post")
|
@PutMapping("/post")
|
||||||
@RequiresRoles(value = {"blog_admin", "admin"}, logical = Logical.OR)
|
|
||||||
public GlobalResult<Product> update(@RequestBody ProductDTO product) {
|
public GlobalResult<Product> update(@RequestBody ProductDTO product) {
|
||||||
if (product.getIdProduct() == null || product.getIdProduct() == 0) {
|
if (product.getIdProduct() == null || product.getIdProduct() == 0) {
|
||||||
throw new IllegalArgumentException("产品主键参数异常!");
|
throw new IllegalArgumentException("产品主键参数异常!");
|
||||||
|
Loading…
Reference in New Issue
Block a user