package com.controller; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.Service.treeService; import com.entity.Employee; import com.entity.Tree; @Controller @RequestMapping("tree") public class treeController { @Autowired private treeService treeService; @RequestMapping("gettree") @ResponseBody public List<Tree> gettree(HttpSession session){ List<Tree> lt = treeService.findTree(); List<Tree> children1 = new ArrayList<Tree>(); List<Tree> children2 = new ArrayList<Tree>(); List<Tree> child1 = new ArrayList<Tree>(); List<Tree> child = new ArrayList<Tree>(); for(Tree t:lt){ if(t.getLv()==5){ children1.add(new Tree(t.getId(),t.getText(), t.getUrl())); }else if(t.getLv()==7){ children2.add(new Tree(t.getId(),t.getText(), t.getUrl())); }else if(t.getLv()==2){ child1.add(new Tree(t.getId(),t.getText(), children1)); }else if(t.getLv()==3){ child1.add(new Tree(t.getId(),t.getText(), children2)); }else if(t.getLv()==1){ child.add(new Tree(t.getId(),t.getText(), child1)); } } Employee emp = (Employee) session.getAttribute("emp"); if (emp.getPositionId()!=null && emp.getPositionId()==1||emp.getPositionId()==2) { for(Tree t:lt){ if(t.getLv()==4){ children1.add(new Tree(t.getId(),t.getText(), t.getUrl())); }else if(t.getLv()==6){ children2.add(new Tree(t.getId(),t.getText(), t.getUrl())); } } } return child; } }
最近下载更多
kkkaaaa LV3
2023年5月18日
wanglinddad LV54
2022年2月24日
bin2337 LV4
2021年11月24日
1294800221 LV1
2021年8月30日
zhangx105888 LV1
2021年7月28日
01 LV1
2021年7月13日
457229171 LV7
2021年7月3日
xufei123 LV4
2021年6月2日
pengkui LV14
2021年5月3日
wangyan111111 LV8
2021年3月18日