diff --git a/cds-platform-2025.V1/cds-modules/cds-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java b/cds-platform-2025.V1/cds-modules/cds-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java index 4e76f2c..24a8b51 100644 --- a/cds-platform-2025.V1/cds-modules/cds-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java +++ b/cds-platform-2025.V1/cds-modules/cds-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java @@ -518,10 +518,10 @@ public class SysUserServiceImpl implements ISysUserService, UserService { */ private void insertUserPost(SysUserBo user, boolean clear) { Long[] posts = user.getPostIds(); - if (posts.length >1) { - throw new ServiceException("用户" + user.getUserName() + "不能添加多个岗位"); - } if (ArrayUtil.isNotEmpty(posts)) { + if (posts.length >1) { + throw new ServiceException("用户" + user.getUserName() + "不能添加多个岗位"); + } if (clear) { // 删除用户与岗位关联 userPostMapper.delete(new LambdaQueryWrapper().eq(SysUserPost::getUserId, user.getUserId()));