购物车为空时报错

This commit is contained in:
litianxiang
2026-05-29 14:28:20 +08:00
parent 54ad0ac05b
commit 269db8a060
2 changed files with 17 additions and 13 deletions

View File

@@ -54,7 +54,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
public Response<?> handleException(Exception e) {
log.error("系统异常: ", e);
return Response.error("系统繁忙,请稍后再试");
return Response.error(e.getMessage());
}
/**
* 处理MinIO异常

View File

@@ -248,7 +248,11 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
.distinct()
.toList();
Map<Long, DesignerEntity> designerMap = designerMapper.selectList(
Map<Long, DesignerEntity> designerMap;
if (CollectionUtils.isEmpty(sellerIds)) {
designerMap = Map.of();
} else {
designerMap = designerMapper.selectList(
new LambdaQueryWrapper<DesignerEntity>()
.select(DesignerEntity::getUserId, DesignerEntity::getShopName)
.in(DesignerEntity::getUserId, sellerIds)
@@ -257,9 +261,9 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
.collect(Collectors.toMap(
DesignerEntity::getUserId,
designer -> designer,
// 如果 sellerIds 中有重复的 userId保留第一个
(existing, replacement) -> existing
));
}
List<ListingMallVO> listingMallVOS = listingIds.stream()
.filter(entityMap::containsKey)