|
|
@ -12,7 +12,9 @@ import org.springframework.web.bind.annotation.PutMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import com.ruoyi.common.core.constant.Constants; |
|
|
|
import com.ruoyi.common.core.constant.UserConstants; |
|
|
|
import com.ruoyi.common.core.constant.UserConstants; |
|
|
|
|
|
|
|
import com.ruoyi.common.core.utils.StringUtils; |
|
|
|
import com.ruoyi.common.core.web.controller.BaseController; |
|
|
|
import com.ruoyi.common.core.web.controller.BaseController; |
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.log.annotation.Log; |
|
|
|
import com.ruoyi.common.log.annotation.Log; |
|
|
@ -96,6 +98,11 @@ public class SysMenuController extends BaseController |
|
|
|
{ |
|
|
|
{ |
|
|
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
|
|
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) |
|
|
|
|
|
|
|
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
|
|
|
|
|
|
|
} |
|
|
|
menu.setCreateBy(SecurityUtils.getUsername()); |
|
|
|
menu.setCreateBy(SecurityUtils.getUsername()); |
|
|
|
return toAjax(menuService.insertMenu(menu)); |
|
|
|
return toAjax(menuService.insertMenu(menu)); |
|
|
|
} |
|
|
|
} |
|
|
@ -112,6 +119,11 @@ public class SysMenuController extends BaseController |
|
|
|
{ |
|
|
|
{ |
|
|
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
|
|
|
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) |
|
|
|
|
|
|
|
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
|
|
|
|
|
|
|
} |
|
|
|
menu.setUpdateBy(SecurityUtils.getUsername()); |
|
|
|
menu.setUpdateBy(SecurityUtils.getUsername()); |
|
|
|
return toAjax(menuService.updateMenu(menu)); |
|
|
|
return toAjax(menuService.updateMenu(menu)); |
|
|
|
} |
|
|
|
} |
|
|
|