处理创建组织时候,用户数量限制参数异常

This commit is contained in:
yangsb
2024-04-19 09:23:10 +08:00
parent f6738b08d0
commit 29be924b51
@@ -15,6 +15,7 @@ import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.infra.api.file.FileApi;
import com.cf.imes.module.system.api.user.dto.OrganAdminUserRespDTO;
@@ -90,9 +91,11 @@ public class AdminUserServiceImpl implements AdminUserService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long createUser(UserSaveReqVO createReqVO) {
Long organId = createReqVO.getOrganId() == null ? OrganContextHolder.getOrganId(): createReqVO.getOrganId();
// 校验账户配合
organService.handleOrganInfo(organ -> {
long count = userMapper.selectCount();
long count = userMapper.selectCount(new LambdaQueryWrapperX<AdminUserDO>().eq(AdminUserDO::getOrganId, organId));
//long count = userMapper.selectCount();
if (count >= organ.getAccountCount()) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_COUNT_MAX, organ.getAccountCount());
}