价格区间方法
List<Integer> integers = new ArrayList<Integer>();
integers.add(13);
integers.add(113);
integers.add(14);
integers.add(56);
//最大值 最小值
System.out.println("min:"+Collections.min(integers));
System.out.println("max:"+Collections.max(integers));
//商品规格转换
public GoodsSpecsResonse covSpec(List<ZxGoodsSpecs> specsList)
{
Integer totalNum=0;
String priceBetween = "";
List<String> integerList = new ArrayList<>();
GoodsSpecsResonse resonse=new GoodsSpecsResonse();
for (ZxGoodsSpecs specs: specsList){
//库存总量
totalNum=totalNum+specs.getNum();
integerList.add(specs.getPrice());
resonse.setSmallImg(specs.getSmallImg());
}
resonse.setTotalNum(totalNum);
//价格区间
priceBetween = Collections.min(integerList) +" - " +Collections.max(integerList);
if(Collections.min(integerList).equals(Collections.max(integerList))){
priceBetween = Collections.min(integerList) ;
}
resonse.setPriceBetween(priceBetween);
return resonse;
}