feat:分页查询排队列表响应参数增加商品名称
This commit is contained in:
parent
b93c5e0661
commit
c9340a8156
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
@ -213,6 +223,14 @@ public class StorePinkServiceImpl extends ServiceImpl<StorePinkMapper, StorePink
|
|||||||
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) {
|
||||||
storePinkResponse.setPhone(user.getPhone());
|
storePinkResponse.setPhone(user.getPhone());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user