refactor: 移除接口单独添加Authorization(已配置全局)

This commit is contained in:
hxr 2024-03-04 00:03:30 +08:00
parent ff4d57c2e9
commit fcf0c3fdc5
3 changed files with 18 additions and 20 deletions

View File

@ -15,7 +15,6 @@ import com.youlai.system.service.SysDictService;
import com.youlai.system.service.SysDictTypeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;

View File

@ -10,7 +10,6 @@ import com.youlai.system.model.vo.RouteVO;
import com.youlai.system.service.SysMenuService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -36,28 +35,28 @@ public class SysMenuController {
private final SysMenuService menuService;
@Operation(summary = "菜单列表",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "菜单列表")
@GetMapping
public Result<List<MenuVO>> listMenus( @ParameterObject MenuQuery queryParams) {
List<MenuVO> menuList = menuService.listMenus(queryParams);
return Result.success(menuList);
}
@Operation(summary = "菜单下拉列表",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "菜单下拉列表")
@GetMapping("/options")
public Result listMenuOptions() {
List<Option> menus = menuService.listMenuOptions();
return Result.success(menus);
}
@Operation(summary = "路由列表",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "路由列表")
@GetMapping("/routes")
public Result<List<RouteVO>> listRoutes() {
List<RouteVO> routeList = menuService.listRoutes();
return Result.success(routeList);
}
@Operation(summary = "菜单表单数据",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "菜单表单数据")
@GetMapping("/{id}/form")
public Result<MenuForm> getMenuForm(
@Parameter(description = "菜单ID") @PathVariable Long id
@ -66,7 +65,7 @@ public class SysMenuController {
return Result.success(menu);
}
@Operation(summary = "新增菜单",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "新增菜单")
@PostMapping
@PreAuthorize("@ss.hasPerm('sys:menu:add')")
@PreventDuplicateResubmit
@ -76,7 +75,7 @@ public class SysMenuController {
return Result.judge(result);
}
@Operation(summary = "修改菜单",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "修改菜单")
@PutMapping(value = "/{id}")
@PreAuthorize("@ss.hasPerm('sys:menu:edit')")
@CacheEvict(cacheNames = "menu", key = "'routes'")
@ -87,7 +86,7 @@ public class SysMenuController {
return Result.judge(result);
}
@Operation(summary = "删除菜单",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "删除菜单")
@DeleteMapping("/{id}")
@PreAuthorize("@ss.hasPerm('sys:menu:delete')")
@CacheEvict(cacheNames = "menu", key = "'routes'")
@ -98,7 +97,7 @@ public class SysMenuController {
return Result.judge(result);
}
@Operation(summary = "修改菜单显示状态",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "修改菜单显示状态")
@PatchMapping("/{menuId}")
public Result updateMenuVisible(
@Parameter(description = "菜单ID") @PathVariable Long menuId,

View File

@ -11,7 +11,7 @@ import com.youlai.system.model.vo.RolePageVO;
import com.youlai.system.service.SysRoleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
@ -29,7 +29,7 @@ public class SysRoleController {
private final SysRoleService roleService;
@Operation(summary = "角色分页列表",security = {@SecurityRequirement(name = "Authorization")} )
@Operation(summary = "角色分页列表" )
@GetMapping("/page")
public PageResult<RolePageVO> getRolePage(
@ParameterObject RolePageQuery queryParams
@ -38,14 +38,14 @@ public class SysRoleController {
return PageResult.success(result);
}
@Operation(summary = "角色下拉列表",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "角色下拉列表")
@GetMapping("/options")
public Result<List<Option>> listRoleOptions() {
List<Option> list = roleService.listRoleOptions();
return Result.success(list);
}
@Operation(summary = "新增角色",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "新增角色")
@PostMapping
@PreAuthorize("@ss.hasPerm('sys:role:add')")
@PreventDuplicateResubmit
@ -54,7 +54,7 @@ public class SysRoleController {
return Result.judge(result);
}
@Operation(summary = "角色表单数据",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "角色表单数据")
@GetMapping("/{roleId}/form")
public Result<RoleForm> getRoleForm(
@Parameter(description ="角色ID") @PathVariable Long roleId
@ -63,7 +63,7 @@ public class SysRoleController {
return Result.success(roleForm);
}
@Operation(summary = "修改角色",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "修改角色")
@PutMapping(value = "/{id}")
@PreAuthorize("@ss.hasPerm('sys:role:edit')")
public Result updateRole(@Valid @RequestBody RoleForm roleForm) {
@ -71,7 +71,7 @@ public class SysRoleController {
return Result.judge(result);
}
@Operation(summary = "删除角色",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "删除角色")
@DeleteMapping("/{ids}")
@PreAuthorize("@ss.hasPerm('sys:role:delete')")
public Result deleteRoles(
@ -81,7 +81,7 @@ public class SysRoleController {
return Result.judge(result);
}
@Operation(summary = "修改角色状态",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "修改角色状态")
@PutMapping(value = "/{roleId}/status")
public Result updateRoleStatus(
@Parameter(description ="角色ID") @PathVariable Long roleId,
@ -91,7 +91,7 @@ public class SysRoleController {
return Result.judge(result);
}
@Operation(summary = "获取角色的菜单ID集合",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "获取角色的菜单ID集合")
@GetMapping("/{roleId}/menuIds")
public Result<List<Long>> getRoleMenuIds(
@Parameter(description ="角色ID") @PathVariable Long roleId
@ -100,7 +100,7 @@ public class SysRoleController {
return Result.success(menuIds);
}
@Operation(summary = "分配菜单权限给角色",security = {@SecurityRequirement(name = "Authorization")})
@Operation(summary = "分配菜单权限给角色")
@PutMapping("/{roleId}/menus")
public Result assignMenusToRole(
@PathVariable Long roleId,