| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.domain.SysMenu;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * 菜单信息
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/menu")
|
| | | @AllArgsConstructor
|
| | | public class SysMenuController extends BaseController
|
| | | {
|
| | | @Autowired
|
| | | private ISysMenuService menuService;
|
| | |
|
| | | /**
|
| | |
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
| | | {
|
| | | if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
| | | if (!menuService.checkMenuNameUnique(menu))
|
| | | {
|
| | | return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
| | | }
|
| | |
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
| | | {
|
| | | if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
| | | if (!menuService.checkMenuNameUnique(menu))
|
| | | {
|
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
| | | }
|