List for追加或修改内容

作者: adm 分类: java 发布时间: 2021-06-07

List for 修改值

List<QwAllianceCouponEntity> card= qwAllianceCouponDao.selectUserCouponList();
for (int i=0;i<card.size();i++){
long t=card.get(i).getExpTime();
Dates d=new Dates();
String af=d.timestampToDate(t);
card.get(i).setOutTime(af);
card.get(i).setAvatar("http://xxx.com"+card.get(i).getAvatar());
card.get(i).setSurplus(card.get(i).getCavNums()-card.get(i).getUseNums());

}

List for追加新的key value

public List cargoDetails(String orderGoodsId,long orderId){
QueryWrapper<OrderGoodsEntity> wrapper=new QueryWrapper<>();
List<String> oods= Arrays.asList(orderGoodsId.split(","));
wrapper.in("id", oods);
List<OrderGoodsEntity> orderGoods=orderGoodsMapper.selectList(wrapper);

ArrayList<Map<String,String>> arrayList=new ArrayList();

for (int i=0;i<orderGoods.size();i++) {
Map<String,String> map=new HashMap<>();
map.put("qiao",orderGoods.get(i).getProductNo());
map.put("li",orderGoods.get(i).getGoodsName());
arrayList.add(i, map);
}

return arrayList;
}

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!