| 
					
				 | 
			
			
				@@ -1,7 +1,11 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.yijia.web.controller.system;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.ArrayList;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Iterator;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yijia.common.core.domain.TreeSelect;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yijia.common.core.domain.model.LoginUser;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.ArrayUtils;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.access.prepost.PreAuthorize;
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -97,6 +101,35 @@ public class SysDeptController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /**
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 获取部门下拉树列表
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/userdepttree")
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult userdepttree(SysDept dept)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LoginUser currentUser = SecurityUtils.getLoginUser();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        System.out.println("sssss1====================="+currentUser.getUser().getDeptId());
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取当前登陆人级别
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysDept deptJb=deptService.selectDeptById(currentUser.getUser().getDeptId());
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<SysDept> depts =new ArrayList<>();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(deptJb!=null ){
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(deptJb.getJiBie()==0){
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dept.setDeptId(null);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                depts = deptService.selectDeptList(dept);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else if(deptJb.getJiBie()==1){
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dept.setParentId(deptJb.getDeptId());
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dept.setDeptId(deptJb.getDeptId());
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                depts= deptService.queryDeptList(dept);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else if(deptJb.getJiBie()==2){
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dept.setDeptId(deptJb.getDeptId());
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                depts= deptService.selectDeptList(dept);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        System.out.println("sssss2====================="+depts);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<TreeSelect> list = deptService.buildDeptTreeSelect(depts);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        System.out.println("sssss3====================="+list);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return AjaxResult.success(list);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /**
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 加载对应角色部门列表树
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping(value = "/roleDeptTreeselect/{roleId}")
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -168,4 +201,6 @@ public class SysDeptController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return toAjax(deptService.deleteDeptById(deptId));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 |