|
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -252,8 +253,10 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|
|
public int insertDept(SysDeptBo bo) {
|
|
public int insertDept(SysDeptBo bo) {
|
|
|
SysDept info = baseMapper.selectById(bo.getParentId());
|
|
SysDept info = baseMapper.selectById(bo.getParentId());
|
|
|
// 如果父节点不为正常状态,则不允许新增子节点
|
|
// 如果父节点不为正常状态,则不允许新增子节点
|
|
|
- if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
|
|
|
|
- throw new ServiceException("部门停用,不允许新增");
|
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(info)) {
|
|
|
|
|
+ if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
|
|
|
|
+ throw new ServiceException("部门停用,不允许新增");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if (bo.getOrderNum() == null || bo.getOrderNum() == 0) {
|
|
if (bo.getOrderNum() == null || bo.getOrderNum() == 0) {
|
|
|
int orderNum = this.getMaxLevelOrderNumb(info.getDeptId());
|
|
int orderNum = this.getMaxLevelOrderNumb(info.getDeptId());
|
|
@@ -270,6 +273,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 新增部门信息
|
|
* 新增部门信息
|
|
|
|
|
+ *
|
|
|
* @param bo 部门业务对象
|
|
* @param bo 部门业务对象
|
|
|
* @return 部门视图
|
|
* @return 部门视图
|
|
|
*/
|
|
*/
|
|
@@ -370,7 +374,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|
|
}
|
|
}
|
|
|
return baseMapper.selectList(Wrappers.lambdaQuery(SysDept.class)
|
|
return baseMapper.selectList(Wrappers.lambdaQuery(SysDept.class)
|
|
|
.select(SysDept::getDeptId)
|
|
.select(SysDept::getDeptId)
|
|
|
- .eq(SysDept::getParentId, deptId).or().eq(SysDept::getDeptId, deptId).or().likeRight(SysDept::getAncestors, sysDeptVo.getAncestors()+","+deptId)
|
|
|
|
|
|
|
+ .eq(SysDept::getParentId, deptId).or().eq(SysDept::getDeptId, deptId).or().likeRight(SysDept::getAncestors, sysDeptVo.getAncestors() + "," + deptId)
|
|
|
).stream().map(SysDept::getDeptId).toList();
|
|
).stream().map(SysDept::getDeptId).toList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -379,6 +383,11 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>().eq(SysDept::getOtherId, otherId));
|
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>().eq(SysDept::getOtherId, otherId));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public SysDeptVo selectVoAllByOtherId(String otherId) {
|
|
|
|
|
+ return baseMapper.selectVoAllByOtherId(otherId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public SysDeptVo selectDeptByParentIdAndName(Long parentId, String deptName) {
|
|
public SysDeptVo selectDeptByParentIdAndName(Long parentId, String deptName) {
|
|
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>()
|
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>()
|
|
@@ -398,4 +407,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|
|
}
|
|
}
|
|
|
return dept.getOrderNum();
|
|
return dept.getOrderNum();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int deleteDeptByOtherId(String otherId) {
|
|
|
|
|
+ return baseMapper.deleteDeptByOtherId(otherId,new Date());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|