fix bug 40921 工作组项目--新增--负责人回显是组织机构为null
This commit is contained in:
+19
-2
@@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.SysDepartTreeModel;
|
||||
import com.jero.common.util.ValidUtil;
|
||||
import com.jero.modules.system.model.SysDepartExcel;
|
||||
@@ -222,7 +223,11 @@ public class SysDepartController {
|
||||
if(sysDepart==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDepartService.delete(id);
|
||||
List<SysUser> sysUsers = sysUserDepartService.queryUserByDepId(id);
|
||||
if (!sysUsers.isEmpty()){
|
||||
throw new JeroBootException("删除部门失败,部门下存在未删除用户");
|
||||
}
|
||||
boolean ok = sysDepartService.delete(id);
|
||||
if(ok) {
|
||||
//清除部门树内存
|
||||
//FindsDepartsChildrenUtil.clearSysDepartTreeList();
|
||||
@@ -250,7 +255,19 @@ public class SysDepartController {
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.sysDepartService.deleteBatchWithChildren(Arrays.asList(ids.split(",")));
|
||||
List<String> depNames = new ArrayList<>();
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
for (String id : idList) {
|
||||
List<SysUser> sysUsers = sysUserDepartService.queryUserByDepId(id);
|
||||
if (!sysUsers.isEmpty()){
|
||||
SysDepart sysDepart = sysDepartService.getById(id);
|
||||
depNames.add(sysDepart.getDepartName());
|
||||
}
|
||||
}
|
||||
if (!depNames.isEmpty()) {
|
||||
throw new JeroBootException(depNames + "删除部门失败,部门下存在未删除用户");
|
||||
}
|
||||
this.sysDepartService.deleteBatchWithChildren(idList);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user