This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/java/com/nis/web/controller/SystemController.java

106 lines
2.9 KiB
Java
Raw Normal View History

2017-12-29 16:18:40 +08:00
package com.nis.web.controller;
2018-11-07 13:48:19 +08:00
import java.util.ArrayList;
import java.util.List;
2017-12-29 16:18:40 +08:00
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
2018-11-07 13:48:19 +08:00
import org.springframework.stereotype.Controller;
2017-12-29 16:18:40 +08:00
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
2018-11-07 13:48:19 +08:00
import com.nis.domain.SysMenu;
import com.nis.util.StringUtil;
import com.nis.web.security.UserUtils;
@Controller
2017-12-29 16:18:40 +08:00
@RequestMapping("${adminPath}/sys/")
public class SystemController extends BaseController{
@RequestMapping("index")
public String index(HttpServletRequest request, HttpServletResponse response,ModelMap model){
return "/sys/sysIndex";
}
2018-11-07 13:48:19 +08:00
@RequestMapping("help")
public String help(HttpServletRequest request, HttpServletResponse response,ModelMap model){
List<SysMenu> menuList = UserUtils.getMenuTreeList();
2018-11-07 13:48:19 +08:00
List<SysMenu> newList = new ArrayList();
try {
for(SysMenu menu:menuList){
if(menu.getIsTop()==1 && !StringUtil.isEmpty(menu.getChildren())){
boolean topShow = false;
for(SysMenu second:menu.getChildren()){
boolean secondShow = false;
if(second.getIsShow()==1){
if(!StringUtil.isEmpty(second.getMenuBg())){
secondShow = true;
}
if(!StringUtil.isEmpty(second.getChildren())){
for(SysMenu third:second.getChildren()){
boolean thirdShow = false;
if(third.getIsShow()==1){
if(!StringUtil.isEmpty(third.getMenuBg())){
thirdShow = true;
secondShow = true;
}
if(!StringUtil.isEmpty(third.getChildren())){
for(SysMenu fourth:third.getChildren()){
if(!StringUtil.isEmpty(fourth.getMenuBg())&&fourth.getIsShow()==1){
newList.add(fourth);
thirdShow = true;
secondShow = true;
}
2018-11-20 17:37:04 +08:00
}
}
}
if(thirdShow){
newList.add(third);
}
2018-11-07 13:48:19 +08:00
}
}
if(secondShow){
newList.add(second);
topShow = true;
}
2018-11-07 13:48:19 +08:00
}
}
if(topShow){
newList.add(menu);
}
2018-11-07 13:48:19 +08:00
}
/*if(menu.getChildren()!=null && menu.getChildren().size()>0 && menu.getIsShow()==1){
2018-11-07 13:48:19 +08:00
newList.add(menu);
}else if(menu.getMenuBg()!=null && !"".equals(menu.getMenuBg())){
newList.add(menu);
}else if(menu.getId()==1){
newList.add(menu);
}*/
/*if((menu.getParentIds().startsWith("0,1,86,")
|| menu.getId()==86
||menu.getId()==0
||menu.getId()==1)
&& menu.getIsShow()==1
){
System.out.println(menu.getParentIds());
newList.add(menu);
}*/
2018-11-07 13:48:19 +08:00
}
} catch (Exception e) {
logger.error("help error",e);
2018-11-07 13:48:19 +08:00
}
logger.info("menuSize:"+newList.size());
2018-11-07 13:48:19 +08:00
model.addAttribute("menuList",newList);
return "/help";
}
2017-12-29 16:18:40 +08:00
}