//modified by ken-zhh 2007-6-8 11:37 用于去除小項查詢出來相同的數據
//對schemas按照Sportsitem表id排序 Collections.sort(schemas, new Comparator(){
public int compare(final Object o1, final Object o2 ){
return (int)(((Matchschema) o1).getSportsitem().getItemid()-((Matchschema)o2).getSportsitem().getItemid());
}
});
//對去除重復后的schemas進行編號,主要用于javascript的小項數組的索引 int index = 0;
for (int j = 0; j < schemas.size(); j++) {
//從第二項開始,如果與前一項相等,就不提取數據,去取重復 if(j != 0){
if(schemas.get(j).getSportsitem().getItemid() == schemas.get(j-1).getSportsitem().getItemid()){
continue;
}
}
//拼湊javascript小項數組的代碼 Matchschema schema = schemas.get(j);
js.append("select2[").append(i + 1).append("][").append(index + 1)
.append("] = new Option(\"").append(
schema.getSportsitem().getName()).append(
"\", \"").append(
schema.getSportsitem().getItemid()).append(
"\");\n");
index ++ ;
posted on 2007-06-11 14:35
kenzhang 閱讀(536)
評論(0) 編輯 收藏