问征夫以前路
感谢所有关心过支持过我的人, 感谢所有恨过我嘲笑过我的人 !
posts - 30,comments - 147,trackbacks - 0
 //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 阅读(522) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: