|
|
@ -71,6 +71,15 @@ public class SecMenuController { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
secMenu = new SecMenu(); |
|
|
|
secMenu = new SecMenu(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (secMenu.getMenuPSid() != null) { |
|
|
|
|
|
|
|
// 查询父类菜单
|
|
|
|
|
|
|
|
SecMenu parentMenu = secMenuService.queryDetail(secMenu.getMenuPSid()); |
|
|
|
|
|
|
|
if (parentMenu == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
secMenu.setMenuFullUrl(secMenu.getMenuFullUrl()+"/"+secMenu.getMenuUrl()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
secMenu.setMenuType(body.getMenuType()); |
|
|
|
secMenu.setMenuType(body.getMenuType()); |
|
|
|
secMenu.setMenuName(body.getMenuName()); |
|
|
|
secMenu.setMenuName(body.getMenuName()); |
|
|
|
secMenu.setMenuUrl(body.getMenuUrl()); |
|
|
|
secMenu.setMenuUrl(body.getMenuUrl()); |
|
|
@ -105,6 +114,24 @@ public class SecMenuController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/delMenu",method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "删除菜单") |
|
|
|
|
|
|
|
public ResponseData delMenu(@RequestBody JSONObject body) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (body == null || body.getLong("menuId") == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
secMenuService.delete(body.getLong("menuId")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/assignMenu",method = RequestMethod.POST) |
|
|
|
@RequestMapping(value="/assignMenu",method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "分配菜单") |
|
|
|
@ApiOperation(value = "分配菜单") |
|
|
@ -129,7 +156,7 @@ public class SecMenuController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/queryMenuList",method = RequestMethod.GET) |
|
|
|
@RequestMapping(value="/queryMenuList",method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "查询菜单列表") |
|
|
|
@ApiOperation(value = "查询菜单列表") |
|
|
|
public ResponseData queryMenuList() { |
|
|
|
public ResponseData queryMenuList() { |
|
|
@ -202,15 +229,15 @@ public class SecMenuController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/queryRoleMenuTree2",method = RequestMethod.GET) |
|
|
|
@RequestMapping(value="/queryRoleMenuTreeCustomized",method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "查询角色菜单树") |
|
|
|
@ApiOperation(value = "查询角色菜单树") |
|
|
|
public ResponseData queryRoleMenuTree2(@RequestParam(value = "roleId" , required = false) Long roleId) { |
|
|
|
public ResponseData queryRoleMenuTreeCustomized(@RequestParam(value = "roleId" , required = false) Long roleId) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> mapList = new ArrayList<>(); |
|
|
|
List<Map<String,Object>> mapList = new ArrayList<>(); |
|
|
|
Map<String,Object> map; |
|
|
|
Map<String,Object> map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取全部菜单
|
|
|
|
List<SecMenu> menuList = secMenuService.getAllList(); |
|
|
|
List<SecMenu> menuList = secMenuService.getAllList(); |
|
|
|
|
|
|
|
|
|
|
|
// 获取最顶层菜单
|
|
|
|
// 获取最顶层菜单
|
|
|
@ -222,7 +249,7 @@ public class SecMenuController { |
|
|
|
for (SecMenu topLevelMenu : topLevelMenuList) { |
|
|
|
for (SecMenu topLevelMenu : topLevelMenuList) { |
|
|
|
if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { |
|
|
|
if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { |
|
|
|
map = new HashMap<>(); |
|
|
|
map = new HashMap<>(); |
|
|
|
map.put("key", topLevelMenu.getId()); |
|
|
|
map.put("key", ""+topLevelMenu.getId()); |
|
|
|
map.put("title", topLevelMenu.getMenuName()); |
|
|
|
map.put("title", topLevelMenu.getMenuName()); |
|
|
|
// 获取下级菜单
|
|
|
|
// 获取下级菜单
|
|
|
|
map.put("children", recursionMenu2(menuList, topLevelMenu.getId())); |
|
|
|
map.put("children", recursionMenu2(menuList, topLevelMenu.getId())); |
|
|
@ -255,7 +282,7 @@ public class SecMenuController { |
|
|
|
for (SecMenu menu : collect) { |
|
|
|
for (SecMenu menu : collect) { |
|
|
|
if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { |
|
|
|
if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { |
|
|
|
map = new HashMap<>(); |
|
|
|
map = new HashMap<>(); |
|
|
|
map.put("key", menu.getId()); |
|
|
|
map.put("key", ""+menu.getId()); |
|
|
|
map.put("title", menu.getMenuName()); |
|
|
|
map.put("title", menu.getMenuName()); |
|
|
|
// 获取下级菜单
|
|
|
|
// 获取下级菜单
|
|
|
|
List<Map<String, Object>> recursioned = recursionMenu2(dataSource, menu.getId()); |
|
|
|
List<Map<String, Object>> recursioned = recursionMenu2(dataSource, menu.getId()); |
|
|
|