【7.6.0】【sys】更新用户部门为空的逻辑补充

pull/57/head
fengshuonan 2023-06-29 10:32:02 +08:00
parent 43acfd697a
commit 0e036b5ec8
2 changed files with 14 additions and 0 deletions

View File

@ -295,6 +295,14 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
// 4. 当前公司下的机构数量
Long userId = LoginContext.me().getLoginUser().getUserId();
UserOrgDTO userMainOrgInfo = sysUserOrgService.getUserMainOrgInfo(userId);
// 当前用户没公司则直接设置为0
if (userMainOrgInfo == null) {
homeCompanyInfo.setCurrentCompanyPersonNum(0L);
homeCompanyInfo.setCurrentCompanyPersonNum(0L);
return homeCompanyInfo;
}
Long companyId = userMainOrgInfo.getCompanyId();
// 获取当前公司的所有子公司数量(含当前公司)

View File

@ -140,6 +140,12 @@ public class SysUserOrgServiceImpl extends ServiceImpl<SysUserOrgMapper, SysUser
queryWrapper.eq(SysUserOrg::getUserId, userId);
queryWrapper.eq(SysUserOrg::getMainFlag, YesOrNotEnum.Y.getCode());
List<SysUserOrg> sysUserOrgList = this.list(queryWrapper);
// 部门为空直接返回null
if (ObjectUtil.isEmpty(sysUserOrgList)) {
return null;
}
if (sysUserOrgList.size() > 1) {
throw new SysException(MAIN_FLAG_COUNT_ERROR, userId);
}