购物车为空时报错

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

View File

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