购物车为空时报错
This commit is contained in:
@@ -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异常
|
||||||
|
|||||||
@@ -248,7 +248,11 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
|
|||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.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>()
|
new LambdaQueryWrapper<DesignerEntity>()
|
||||||
.select(DesignerEntity::getUserId, DesignerEntity::getShopName)
|
.select(DesignerEntity::getUserId, DesignerEntity::getShopName)
|
||||||
.in(DesignerEntity::getUserId, sellerIds)
|
.in(DesignerEntity::getUserId, sellerIds)
|
||||||
@@ -257,9 +261,9 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
|
|||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
DesignerEntity::getUserId,
|
DesignerEntity::getUserId,
|
||||||
designer -> designer,
|
designer -> designer,
|
||||||
// 如果 sellerIds 中有重复的 userId,保留第一个
|
|
||||||
(existing, replacement) -> existing
|
(existing, replacement) -> existing
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
List<ListingMallVO> listingMallVOS = listingIds.stream()
|
List<ListingMallVO> listingMallVOS = listingIds.stream()
|
||||||
.filter(entityMap::containsKey)
|
.filter(entityMap::containsKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user