long转化为int:
long l;
Long.valueOf( l ).intValue();
warehouseTransferQuery.setSupplyWarehouseIdArray(warehouseTransferQuery.getSupplyWarehouseIdStr().split(","));
BeanUtils.copyList(tempList, WarehouseTransferVO.class);
String转化为Long数组
Long[] idArr = Arrays.stream(ids.split(",")).map(Long::parseLong).toArray(Long[]::new);
LambdaQueryWrapper query = Wrappers.lambdaQuery()
.eq(CityProductSpecificationPO::getSplitBasicSpecificationId, splitProductBasicSpeId)
.eq(CityProductSpecificationPO::getShopId, shopId)
.orderByAsc(CityProductSpecificationPO::getId)
.select(CityProductSpecificationPO::getId, CityProductSpecificationPO::getSpecificationRelationNum, CityProductSpecificationPO::getQuantity);
cityProductSpecificationCoreService.list(query);
if (Objects.isNull(splitSpecification)){
return;
}
// 保留两位小数,四舍五入
refundAmount = refundAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
list.forEach(item -> {
list1.add(item);
});
boolean b = list.containsAll(list1);
list1.addAll(list);
List list4 = list.stream().filter(item -> item.equals(1)).collect(Collectors.toList());
//1.提取出list对象中的一个属性
List stIdList1 = stuList.stream().map(Person::getId).collect(Collectors.toList());
//2.提取出list对象中的一个属性并去重
List stIdList2 = stuList.stream().map(Person::getId).distinct().collect(Collectors.toList());
//从一个Person对象的List集合,取出id和name组成一个map集合
Map<String, String> collect = list.stream().collect(Collectors.toMap(p -> p.getId(), p -> p.getName()));
Assert.notNull(specificationPO, “商品规格id” + productInfoVO.getSpecificationId() + “不存在”);