1、deptService单测完善;2、贴皮veneer service单测剥离真实db,使用纯mock;

This commit is contained in:
gaoqr
2026-01-22 11:37:22 +08:00
parent f22f3bb2ba
commit 7b919d7adb
4 changed files with 184 additions and 77 deletions
@@ -299,20 +299,18 @@ public class DeptServiceImpl implements DeptService {
* @param deptDO
*/
private void validParentDept(DeptDO deptDO) {
if (ObjectUtil.isNotNull(deptDO) && ObjectUtil.isNotNull(deptDO.getParentId())) {
Long parentId = deptDO.getParentId();
DeptDO parentDept = deptMapper.selectById(parentId);
if (ObjectUtil.equal(parentId, 0L)) {
// 上级部门id是0代表是机构下最顶级的部门
return;
}
if (parentDept == null) {
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
} else if (!CommonStatusEnum.ENABLE.getStatus().equals(parentDept.getStatus())) {
throw new ServiceException(ErrorCodeConstants.DEPT_DISABLE, parentDept.getName());
} else {
validParentDept(parentDept);
}
Long parentId = deptDO.getParentId();
DeptDO parentDept = deptMapper.selectById(parentId);
if (ObjectUtil.equal(parentId, 0L)) {
// 上级部门id是0代表是机构下最顶级的部门
return;
}
if (parentDept == null) {
throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS);
} else if (!CommonStatusEnum.ENABLE.getStatus().equals(parentDept.getStatus())) {
throw new ServiceException(ErrorCodeConstants.DEPT_DISABLE, parentDept.getName());
} else {
validParentDept(parentDept);
}
}