fix: 角色可分配权限优化

This commit is contained in:
萌狼蓝天 2024-11-07 21:16:55 +08:00
parent f18a16ddb9
commit 74807cfa96
2 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.Objects;
@RestController @RestController
@Tag(name="系统认证接口") @Tag(name="系统认证接口")
@ -146,6 +147,9 @@ public class AuthController {
) )
@PostMapping("/role-menu-add") @PostMapping("/role-menu-add")
public ResponseEntity addRoleMenu(@RequestBody SystemRoleMenu srm) { public ResponseEntity addRoleMenu(@RequestBody SystemRoleMenu srm) {
if(Objects.equals(srm.getMenuId(), "") || Objects.equals(srm.getRoleId(), "")){
return ResponseEntity.ok(ResponseResult.error("请选择合适的角色和功能"));
}
return ResponseEntity.ok(authService.addRoleMenu(srm)); return ResponseEntity.ok(authService.addRoleMenu(srm));
} }
} }

View File

@ -22,7 +22,7 @@ public class SystemController {
@Operation( @Operation(
summary = "菜单 加载", summary = "菜单 加载",
description = "加载用户拥有的菜单(用于显示在左侧", description = "加载用户拥有的菜单(用于显示在左侧,被删除的菜单不会加载",
tags = {"系统相关接口"} tags = {"系统相关接口"}
) )
@GetMapping("/menu") @GetMapping("/menu")
@ -31,7 +31,7 @@ public class SystemController {
} }
@Operation( @Operation(
summary = "菜单 加载 全部", summary = "菜单 加载 全部",
description = "加载用户拥有的所有菜单,常常用于管理菜单", description = "加载用户拥有的所有菜单,常常用于管理菜单(被删除的菜单也会加兹安)",
tags = {"系统相关接口"} tags = {"系统相关接口"}
) )
@GetMapping("/menu-all") @GetMapping("/menu-all")