| | |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| | | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; |
| | | import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.GROUP_MEMBER_NOT_IN_GROUP; |
| | |
| | | } else if (groupId != null && userId != null) { |
| | | member = groupMemberService.getGroupMember(groupId, userId); |
| | | } else { |
| | | // 避免 selectByGroupIdAndUserId 收到 null 参数走全表扫 / 抛 SQL 异常 |
| | | throw new IllegalArgumentException("参数缺失:需传 id 或 (groupId, userId)"); |
| | | // 避免 selectByGroupIdAndUserId 收到 null 参数走全表扫 / 抛 SQL 异常。 |
| | | // 这里属于客户端参数问题,抛业务异常返回 400,不要用 IllegalArgumentException 变成 500 |
| | | throw exception0(BAD_REQUEST.getCode(), "参数缺失:需传 id 或 (groupId, userId)"); |
| | | } |
| | | if (member == null) { |
| | | return success(null); |