当前位置: 首页 JAVA

[Java]重新分配数据

栏目:JAVA 作者:爱豆吧 时间:2022-10-26 15:55:05

  if(selectSpecialist.getCount() !=null){

            selectSpecialist.setCount(selectSpecialist.getCount()*2);
        }
        List<TechnocracyInfoBean> list= technocracyMapper.selectSpecialist(selectSpecialist);
        


                Iterator<TechnocracyInfoBean> iterator = list.iterator();
                while(iterator.hasNext()) {
                    TechnocracyInfoBean next = iterator.next();
                    Integer id = next.getSpecialistId();//数据库查出来的id
                    if (id==selectSpecialist.getOldId()) {//oldId前端传的要移除的id
                        iterator.remove();//移除指定的id数据
                        selectSpecialist.setCount(null);
                        TechnocracyInfoBean data=    technocracyMapper.selSpecialrandomone(selectSpecialist);//随机一条

                        list.add(0,data);//插入替换的数据
                        break;
                    }else{
                        continue;
                    }


        }
阅读:42次

分类栏目