| | |
| | | import org.springframework.stereotype.Service;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.core.text.Convert;
|
| | | import com.ruoyi.common.exception.CustomException;
|
| | | import com.ruoyi.common.exception.ServiceException;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
|
| | | import com.ruoyi.framework.web.domain.TreeSelect;
|
| | |
| | | // 如果父节点不为正常状态,则不允许新增子节点
|
| | | if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
| | | {
|
| | | throw new CustomException("部门停用,不允许新增");
|
| | | throw new ServiceException("部门停用,不允许新增");
|
| | | }
|
| | | dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
| | | return deptMapper.insertDept(dept);
|
| | |
| | | updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
|
| | | }
|
| | | int result = deptMapper.updateDept(dept);
|
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
|
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
| | | && !StringUtils.equals("0", dept.getAncestors()))
|
| | | {
|
| | | // 如果该部门是启用状态,则启用该部门的所有上级部门
|
| | | updateParentDeptStatusNormal(dept);
|