Kaynağa Gözat

部门管理 右击单个删除校验

xieyn 1 yıl önce
ebeveyn
işleme
1247e1b595

+ 6 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java

@@ -221,6 +221,12 @@ public class SysDepartController {
        if(sysDepart==null) {
            result.error500("未找到对应实体");
        }else {
+		   QueryWrapper<SysUser>  queryWrapper = new QueryWrapper();
+		   queryWrapper.eq("depart_ids",id);
+		   List<SysUser> list = sysUserService.list(queryWrapper);
+		   if(list.size()>0){
+			   return result.error500("删除失败!该部门下存在人员,无法删除!");
+		   }
            boolean ok = sysDepartService.delete(id);
            if(ok) {
 	            //清除部门树内存