1,取查詢結果最後一頁。注意:查詢最後一頁在併發的時候會有問題。 可能是倒數第一頁,也可能是倒數第二頁,這樣這個功能就不好用了。
Integer recordCounts = Integer.valueOf( vars.get("recordCount"));
if(recordCounts%5 == 0 ){
vars.put("newrecordCounts",recordCounts.toString());
}else{
recordCounts=recordCounts/5+1;
vars.put("newrecordCounts",recordCounts.toString());
}
2,根據唯一值取在數組中的位置,然後根據這個位置取其他數組的值。
int i=1;
String strtemplateId = vars.get("templateId");
int counttm = Integer.parseInt(vars.get("templateIds_matchNr"));
for(i=counttm;i<=counttm;i--){
String strtemplateIds = vars.get("templateIds_" + i.toString());
if(strtemplateIds.equals(strtemplateId)){
String newmainId = vars.get("mainIds_" + i.toString());
vars.put("newmainIds",newmainId);
break;
}
}