| 
					
				 | 
			
			
				@@ -2,10 +2,12 @@ package com.ozs.web.controller.system; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.core.domain.entity.SysRole; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.utils.poi.ExcelUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.ArrayUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang3.ObjectUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.access.prepost.PreAuthorize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.validation.annotation.Validated; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -117,7 +119,16 @@ public class SysDeptController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        dept.setCreateBy(getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LambdaQueryWrapper<SysDept> wq=new LambdaQueryWrapper<SysDept>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ObjectUtils.isNotEmpty(dept.getDeptCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            wq.eq(SysDept::getDeptCode, dept.getDeptCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysDept sysDept = deptService.getOne(wq); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ObjectUtils.isNotEmpty(sysDept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return error("新增部门'" + dept.getDeptCode() + "'失败,部门编码已存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dept.setCreateBy(getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dept.setUpdateBy(getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return toAjax(deptService.insertDept(dept)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -137,7 +148,16 @@ public class SysDeptController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return error("该部门包含未停用的子部门!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        dept.setUpdateBy(getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LambdaQueryWrapper<SysDept> wq=new LambdaQueryWrapper<SysDept>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ObjectUtils.isNotEmpty(dept.getDeptCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            wq.eq(SysDept::getDeptCode, dept.getDeptCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            wq.ne(SysDept::getDeptId,dept.getDeptId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysDept sysDept = deptService.getOne(wq); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ObjectUtils.isNotEmpty(sysDept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return error("新增部门'" + dept.getDeptCode() + "'失败,部门编码已存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dept.setUpdateBy(getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return toAjax(deptService.updateDept(dept)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |