0
点赞
收藏
分享

微信扫一扫

java奇数次和偶数次进行不同操作


注意要看重点代码,我已经标注
int i=0;
for(Map<String,Object> tid:lists){
Integer tableid = (Integer) tid.get("tableid");
AttributeInfo attributeInfo = layoutService.queryTableInfoByTid(tableid);
Integer outType = attributeInfo.getOut_type();
//类别:tid
if(i%2==0){
leftObject += "{\"id\":"+tableid+",\"outtype\":"+outType+"}";
}else{
rightObject += "{\"id\":"+tableid+",\"outtype\":"+outType+"}";
}
i++;
object = "{\"object\":["+leftObject+","+rightObject+"]}";
model.addAttribute("object",object);
}

举报

相关推荐

0 条评论