设置语言和资料接口
下载接口
This commit is contained in:
@@ -49,4 +49,12 @@ public class ListingMallController {
|
||||
List<ListingMallVO> result = listingMallService.getListingSummaries(listingIds);
|
||||
return Response.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取商品 listing 图片 URL 列表", description = "返回指定商品ID的 listing 分类图片 URL 列表")
|
||||
@GetMapping("/mall/main-product/urls")
|
||||
public Response<List<String>> getListingUrls(
|
||||
@Parameter(description = "商品ID") @RequestParam Long id) {
|
||||
List<String> urls = listingMallService.getListingUrls(id);
|
||||
return Response.success(urls);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,4 +35,12 @@ public interface ListingMallService {
|
||||
* @return 商品简要信息列表
|
||||
*/
|
||||
List<ListingMallVO> getListingSummaries(List<Long> listingIds);
|
||||
|
||||
/**
|
||||
* 获取商品的 listing 图片 URL 列表
|
||||
*
|
||||
* @param id 商品ID
|
||||
* @return listing 图片 URL 列表
|
||||
*/
|
||||
List<String> getListingUrls(Long id);
|
||||
}
|
||||
|
||||
@@ -170,6 +170,29 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getListingUrls(Long id) {
|
||||
List<ListingImageEntity> images = listingImageMapper.selectList(
|
||||
new LambdaQueryWrapper<ListingImageEntity>()
|
||||
.eq(ListingImageEntity::getListingId, id)
|
||||
.orderByAsc(ListingImageEntity::getSortOrder));
|
||||
|
||||
Map<String, List<String>> imageMap = images.stream()
|
||||
.filter(img -> StringUtils.hasText(img.getCategory()))
|
||||
.sorted(Comparator.comparing(ListingImageEntity::getCategory)
|
||||
.thenComparing(ListingImageEntity::getSortOrder, Comparator.nullsLast(Comparator.naturalOrder())))
|
||||
.collect(Collectors.groupingBy(
|
||||
ListingImageEntity::getCategory,
|
||||
Collectors.mapping(ListingImageEntity::getImageUrl, Collectors.toList())
|
||||
));
|
||||
|
||||
return imageMap.entrySet().stream()
|
||||
.filter(entry -> !entry.getKey().equals("firstFrame") && !entry.getKey().equals("gif"))
|
||||
.flatMap(entry -> entry.getValue().stream())
|
||||
.distinct()
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ListingMallVO> getListingSummaries(List<Long> listingIds) {
|
||||
if (listingIds == null || listingIds.isEmpty()) {
|
||||
|
||||
@@ -59,5 +59,5 @@ public class OrderInfoEntity implements Serializable {
|
||||
private Integer deleted;
|
||||
|
||||
/** 交易流水号 */
|
||||
private String paymentId;
|
||||
private Long paymentId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user