| | |
| | | import com.gkhy.exam.common.domain.entity.SysMenu; |
| | | import com.gkhy.exam.common.utils.StringUtils; |
| | | import com.gkhy.exam.system.service.ISysMenuService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | * |
| | | * @author expert |
| | | */ |
| | | @Api(tags = "菜单信息") |
| | | @RestController |
| | | @RequestMapping("/system/menu") |
| | | public class SysMenuController |
| | |
| | | * 获取菜单列表 |
| | | */ |
| | | //@PreAuthorize("hasAnyAuthority('system:menu:list')") |
| | | @ApiOperation(value = "获取菜单列表") |
| | | @GetMapping("/list") |
| | | public CommonResult list(SysMenu menu) |
| | | { |
| | |
| | | * 根据菜单编号获取详细信息 |
| | | */ |
| | | //@PreAuthorize("hasAnyAuthority('system:menu:query')") |
| | | @ApiOperation(value = "根据菜单编号获取详细信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", name = "menuId", dataType = "int", required = true, value = "menuId"), |
| | | }) |
| | | @GetMapping(value = "/{menuId}") |
| | | public CommonResult getInfo(@PathVariable Long menuId) |
| | | { |
| | |
| | | * 获取菜单下拉树列表 |
| | | */ |
| | | @GetMapping("/treeselect") |
| | | @ApiOperation(value = "获取菜单下拉树列表") |
| | | public CommonResult treeselect(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | |
| | | /** |
| | | * 加载对应角色菜单列表树 |
| | | */ |
| | | @ApiOperation(value = "加载对应角色菜单列表树") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", name = "roleId", dataType = "int", required = true, value = "roleId"), |
| | | }) |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public CommonResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | |
| | | * 新增菜单 |
| | | */ |
| | | //@PreAuthorize("hasAnyAuthority('system:menu:add')") |
| | | @ApiOperation(value = "新增菜单") |
| | | @PostMapping |
| | | public CommonResult add(@Validated @RequestBody SysMenu menu) |
| | | { |
| | |
| | | //@PreAuthorize("hasAnyAuthority('system:menu:edit')") |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "修改菜单") |
| | | public CommonResult edit(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | |
| | | * 删除菜单 |
| | | */ |
| | | //@PreAuthorize("hasAnyAuthority('system:menu:remove')") |
| | | @ApiOperation(value = "删除菜单") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", name = "menuId", dataType = "int", required = true, value = "menuId"), |
| | | }) |
| | | @DeleteMapping("/{menuId}") |
| | | |
| | | public CommonResult remove(@PathVariable("menuId") Long menuId) |
| | | { |
| | | if (menuService.hasChildByMenuId(menuId)) |