@RequestMapping(params = "addArticle") public ModelAndView addArticle(HttpServletRequest req, ItemEntity item) { List<ItemEntity> listEntity = commonItemService.findItemsByParentId("0"); if (StringUtil.isNotEmpty(item.getId())) { item = commonItemService.getEntity(ItemEntity.class, item.getId()); req.setAttribute("itemPage", item); if (item.getLevel() == 3) { // 说明有三级菜单 /* req.setAttribute("secondPage", commonItemService .findItemsByParentId(commonItemService.findParticalItemById( item.getParentId()).getParentId()));*/ req.setAttribute( "secondPage", commonItemService.findItemsCanEnitByParentId( commonItemService.findParticalItemById(item.getParentId()).getParentId())); req.setAttribute("second", item.getParentId()); req.setAttribute( "first", commonItemService.findParticalItemById(item.getParentId()).getParentId()); } else if (item.getLevel() == 2) { req.setAttribute("first", item.getParentId()); req.setAttribute("secondPage", commonItemService.findItemsByParentId(item.getParentId())); } } else { if (listEntity.size() > 0) { req.setAttribute( "secondPage", commonItemService.findItemsCanEnitByParentId(listEntity.get(0).getId())); /*req.setAttribute("secondPage", commonItemService.findItemsCanEnitByParentId(commonItemService.findParticalItemById( listEntity.get(0).getParentId()).getParentId()));*/ } else { return new ModelAndView("upperadmin/item/error"); } } /*List<ItemEntity> listEntity = commonItemService.findItemsByParentId("0");*/ req.setAttribute("itemReplace", listEntity); return new ModelAndView("commonadmin/item/article2"); }
@RequestMapping(params = "reqItems") @ResponseBody public AjaxJson reqItems(String parentId) { AjaxJson j = new AjaxJson(); j.setObj(commonItemService.findItemsCanEnitByParentId(parentId)); j.setSuccess(commonItemService.itemCanEdit(parentId)); return j; }