feat:分页查询排队列表响应参数增加商品名称

This commit is contained in:
不睡觉的月亮 2025-12-05 10:05:31 +08:00
parent b93c5e0661
commit c9340a8156
2 changed files with 21 additions and 0 deletions

View File

@ -47,6 +47,9 @@ public class StorePinkAdminListResponse {
@ApiModelProperty(value = "拼团商品") @ApiModelProperty(value = "拼团商品")
private String title; private String title;
@ApiModelProperty(value = "商品名称")
private String productName;
@ApiModelProperty(value = "手机号码") @ApiModelProperty(value = "手机号码")
private String phone; private String phone;

View File

@ -196,6 +196,16 @@ public class StorePinkServiceImpl extends ServiceImpl<StorePinkMapper, StorePink
} }
List<Integer> userIds = storePinks.stream().map(StorePink::getUid).collect(Collectors.toList()); List<Integer> userIds = storePinks.stream().map(StorePink::getUid).collect(Collectors.toList());
HashMap<Integer, User> userHashMap = userService.getMapListInUid(userIds); HashMap<Integer, User> userHashMap = userService.getMapListInUid(userIds);
// 批量查询商品信息
List<Integer> productIds = storePinks.stream().map(StorePink::getPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
Map<Integer, StoreProduct> productMap = new HashMap<>();
if (CollUtil.isNotEmpty(productIds)) {
List<StoreProduct> products = storeProductService.listByIds(productIds);
productMap = products.stream().collect(Collectors.toMap(StoreProduct::getId, p -> p));
}
Map<Integer, StoreProduct> finalProductMap = productMap;
List<StorePinkAdminListResponse> list = storePinks.stream().map(pink -> { List<StorePinkAdminListResponse> list = storePinks.stream().map(pink -> {
StorePinkAdminListResponse storePinkResponse = new StorePinkAdminListResponse(); StorePinkAdminListResponse storePinkResponse = new StorePinkAdminListResponse();
BeanUtils.copyProperties(pink, storePinkResponse); BeanUtils.copyProperties(pink, storePinkResponse);
@ -212,6 +222,14 @@ public class StorePinkServiceImpl extends ServiceImpl<StorePinkMapper, StorePink
if(Objects.nonNull(combination)){ if(Objects.nonNull(combination)){
storePinkResponse.setTitle(combination.getTitle()); storePinkResponse.setTitle(combination.getTitle());
} }
// 设置商品名称
if (pink.getPid() != null) {
StoreProduct product = finalProductMap.get(pink.getPid());
if (product != null) {
storePinkResponse.setProductName(product.getStoreName());
}
}
User user = userHashMap.get(pink.getUid()); User user = userHashMap.get(pink.getUid());
if (null != user) { if (null != user) {