/*
页号正确取值范围是1..pagetotal 如果pageindex=0返回pagetotal
希望每页记录数,如果pagesize = 0 表明用户想一次性获取所有数据
数据总页数,系统给调用方返回数据总页数
*/
int Toolkit::getRowNumStartEnd(int &iRowStart,int &iRowEnd,int iCountNum,const ::CC::PageObject& inpageObject,::CC::PageObject& outpageObject)
{
ACE_DEBUG( ( LM_ERROR, "[%D %T] [INFO] [ODB](%N:%l)\t iPageindex[%d]iPagesize[%d]iPagetotal[%d] \n",
inpageObject.iPageindex,
inpageObject.iPagesize,
inpageObject.iPagetotal) );
if ( inpageObject.iPagesize == 0 )
{
iRowStart=1;
iRowEnd=iCountNum;
}else{
outpageObject = inpageObject;
outpageObject.iPagetotal=iCountNum/inpageObject.iPagesize;
if (iCountNum%inpageObject.iPagesize>0)
{
outpageObject.iPagetotal=outpageObject.iPagetotal+1;
}
if (inpageObject.iPageindex == 0)
{
return 100;
}
if ( inpageObject.iPageindex>outpageObject.iPagetotal || inpageObject.iPageindex < 0 )
{
outpageObject.iPageindex=outpageObject.iPagetotal;
}
iRowStart=outpageObject.iPageindex*inpageObject.iPagesize-inpageObject.iPagesize+1;
if (outpageObject.iPageindex*inpageObject.iPagesize>iCountNum)
{
iRowEnd=iCountNum;
}else{
iRowEnd=outpageObject.iPageindex*inpageObject.iPagesize;
}
}
return CC::iCcok;
}
阅读(1366) | 评论(0) | 转发(0) |