实现多个marc库和简单库的合并分页

HttpSession session = request.getSession();
List dBInitList=null;
dBInitList=this.getDbInitList(dbaseS, searchWh,symbol,serverName,userName,passWord);

List list=new ArrayList();
int beginRes=(page-1)*pageSize+1;/**开始数*/
int endRes=page*pageSize;/**结束数*/
int totalCount=0;/**记录总数*/
int alreadyNum=0;/**已经添加到list的记录数*/
int dataValue=0; /**此库的数据数量*/
DbInit dBInit=null;

try {
for (int i = 0; i < dBInitList.size(); i++) {
dBInit= (DbInit) dBInitList.get(i);
dBInit.goTo(0);
Integer marcMarkInteger=marcMark[i];

dataValue=dBInit.getRecordCount();/**记录集数量*/

String serverAndDbName=dBInit.getServerName()+";"+dBInit.getDbName();

//String serverAndDbName=dBInit.getServerName()+";"+dBInit.getDbName();
if (dataValue!=-1) {totalCount+=dataValue;/**总数*/}
if(alreadyNum<pageSize&&dataValue!=-1) {/**如果此页数据没有完全加载,并且此库有数据集,就执行*/
if (totalCount>beginRes&&totalCount>=endRes) {/**到当前库可以完全加载此页数据了*/
//int gotoValue=0;
int value= pageSize-alreadyNum;/**每页大小-已经加载的 得出还需加载记录条数*/
if(alreadyNum==0) {/**在此库完全加载此页数据的情况*/
int valNumber=totalCount-((page-1)*pageSize);/**记录总数减去上页为止加载条数 得出GOTO位置*/
dBInit.goTo(dataValue-valNumber);
//gotoValue=dataValue-valNumber;
}else {/**‘已经有过加载记录的情况,从第一条开始加载’*/}
for (int j = 0; j <value; j++) {
//dBInit.goTo(gotoValue);
//记录字符串;服务名、库名、编号;库类型标记;dBInitList索引
list.add(dBInit.getCurrentRecord()+"δδ"+serverAndDbName+";"+dBInit.getCurrentRecordID()+"δδ"+marcMarkInteger+"δδ"+i);
dBInit.moveNext();

alreadyNum++;/**已经加载数量*/
//gotoValue++;
}
}else if (totalCount>=beginRes&&totalCount<endRes) {/**加载当前库数据还需加载下一个库数据 */
//int gotoValue=0;
int value=totalCount-((page-1)*pageSize);/**记录总数减去上页为止加载条数 得出GOTO位置*/
if (alreadyNum>0) {/**‘已经有过加载记录的情况,从第一条开始加载’*/
value=dataValue;
}else {
dBInit.goTo(dataValue-value);
//gotoValue=dataValue-value;
}
for (int j = 0; j <value; j++) {
//dBInit.goTo(gotoValue);
list.add(dBInit.getCurrentRecord()+"δδ"+serverAndDbName+";"+dBInit.getCurrentRecordID()+"δδ"+marcMarkInteger+"δδ"+i);
dBInit.moveNext();
alreadyNum++;/**已经加载数量*/
//gotoValue++;
}
}
}
}

} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}

你可能感兴趣的:(arc)