| | |
| | | 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.Constants;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.ServletUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
| | | Long userId = loginUser.getUser().getUserId();
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, userId);
|
| | | return AjaxResult.success(menuService.buildMenuTree(menus));
|
| | | return AjaxResult.success(menus);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
| | | {
|
| | | return AjaxResult.success(menuService.selectMenuListByRoleId(roleId));
|
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
| | | List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId());
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
| | | {
|
| | | 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());
|
| | | return toAjax(menuService.insertMenu(menu));
|
| | |
| | | {
|
| | | 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());
|
| | | return toAjax(menuService.updateMenu(menu));
|
| | | }
|