Hibernate3 提供了DetachedCriteria,使得我们可以在Web层构造 S}rW=hO
mQOYjy3
detachedCriteria,然后调用业务层Bean,进行动态条件查询,根 E
Fx@O
v&>TU(x\H
据这一功能,我设计了通用的抽象Bean基类和分页类支持,代码来 I&e,R
Q7]VB p4
自于Quake Wang的javaeye-core包的相应类,然后又做了很多修改 Q\DD^Pbq
o9:GKc
。 :z EhPx;B7
om"q[Tudc
分页支持类: z5CWgN
o >=YoG
java代码: 7b2N'^z}
S|8O$9{x9q
H:ar&o#(
package com.javaeye.common.util; o6$Q>g`]
|xTf:@hgHf
import java.util.List; `3$S^|v
wNuS'P_(:T
publicclass PaginationSupport { $?OuY*ZeY9
*n)3y.s
publicfinalstaticint PAGESIZE = 30; _BcYS
W`C&$v#
privateint pageSize = PAGESIZE; 89B1\ff
:;u~M(R
privateList items; urHQb5|T}
2'"$Y'
privateint totalCount; K%<Z"2!+
3ySP*J5
privateint[] indexes = newint[0]; |5}{4k~9J
n_@YKz;8
privateint startIndex = 0; '|e5 cW6z
9-+6Ed^2
public PaginationSupport(List items, int 3<x_[0v`K1
]?L?q2>&
totalCount){ .E_`*[ 5=
setPageSize(PAGESIZE); cI3uH1;#
setTotalCount(totalCount); AM}-dKei|
setItems(items); 35yhe:$nf
setStartIndex(0); {y|y68y0+
} AA}M"8~2
n<7#?X7
public PaginationSupport(List items, int |B4dFI?
vKDPg p<j
totalCount, int startIndex){ ^!|BKH8>f%
setPageSize(PAGESIZE); C+}uH:I'L
setTotalCount(totalCount); knypSgk_
setItems(items); 8k+Ctk
setStartIndex(startIndex); rQK2&37-,@
} 3}$L4U
|mrAvm}
public PaginationSupport(List items, int c*!bT$]~\
<acAc2
totalCount, int pageSize, int startIndex){ @ky5XV
setPageSize(pageSize); Lm'Ony^F
setTotalCount(totalCount); CQ sVGn{x
setItems(items); \VPU)
setStartIndex(startIndex); 0_Etm83Wq6
} ~9]tt\jN*Y
(XT^<#Ga
publicList getItems(){ pz?.(AmU\
return items; 4|Jy]
} xgJ2W_
w0moC9#$?
publicvoid setItems(List items){ `
M"Zq
this.items = items; ?{cF'RB.
} 5nqj
ZWmmFKFG.
publicint getPageSize(){ G?=X!up(
return pageSize; )y.J2_lI8
} 6}Y^X
nb'],({:9
publicvoid setPageSize(int pageSize){ ]=q?=%H
this.pageSize = pageSize; ctdV4%^{
} ^b;.zhp8;N
VILzx+v
M
publicint getTotalCount(){ l$d 4g?Z
return totalCount; r6 ,5&`&
} 2={`g/WeE
athU
publicvoid setTotalCount(int totalCount){ <J {VTk ~
if(totalCount > 0){ C/_W>H_
this.totalCount = totalCount; .yQDW]q81G
int count = totalCount / +n^$4f
04:^<n+{
pageSize; kP6g0,\|a|
if(totalCount % pageSize > 0) 8K6yqc H
count++; %dO'kU /-
indexes = newint[count]; #=7~.Y
for(int i = 0; i < count; i++){ o*I=6`j
indexes = pageSize * RjSVa.x
cl1h;w9s
i; XLg6?Nu
} 5cgDHs
}else{ (tx6U.Oy
this.totalCount = 0; GvF~h0wMt
} ?o),F^ir
} W84JB3p
%@kmuz??
publicint[] getIndexes(){ 5RI"gf
return indexes; @aY 8VL7C0
} a0CmCv2#
z[}[:H8
publicvoid setIndexes(int[] indexes){ vM1f-I-
this.indexes = indexes; [[Qu|?KEa
} D$I7Gz,w{
a%7%NN*i
publicint getStartIndex(){ l`~*"4|/
return startIndex; M7fw/i
} 68+9^
4}!riWR
publicvoid setStartIndex(int startIndex){ oOmPbAY
if(totalCount <= 0) e%U0^! 8
this.startIndex = 0; a 5:YP
elseif(startIndex >= totalCount) xWU0Ev)4U
this.startIndex = indexes 37 T<LU
GFYAg
[indexes.length - 1]; pI,QkDJ0
elseif(startIndex < 0) 5|9,S
this.startIndex = 0; GTeFDm;T^
else{ O!\P]W4r$
this.startIndex = indexes iLws;3UX;x
o(u&n3Q'
[startIndex / pageSize]; F(Pe@ #)A
} tUDOL-Tv
} i"r&CS)sT
_ohZTT%l
publicint getNextIndex(){ py]m^)yc
int nextIndex = getStartIndex() + xw&[ 9}Y
FL,jlE_
pageSize; 8&IsZPq%l
if(nextIndex >= totalCount) =%%\b_\L
return getStartIndex(); ^}8(o
else 3qXOsa7
return nextIndex; |ITp$_S
} p&>*bF,
hJ (Q^Z
publicint getPreviousIndex(){ N&]v\MjI62
int previousIndex = getStartIndex() - kn^RS1m
C5CUMYU
pageSize; E5~HH($b
if(previousIndex < 0) !\'7j-6
return0; Vl%AN;o
else m$ )yd~
return previousIndex; eB%KXPhMm
} ] QGYEjW
.0:BgM
} -icOg6%
.{1G"(z
!hrXud=#"
9z$]hl
抽象业务类 #v0"hFOH,
java代码: X,C&nqVFm8
`MAee8u'
?l!L
)!2
/** y>Zvos e
* Created on 2005-7-12 s:'M[xI
*/ vIF=kKl9,
package com.javaeye.common.business; 4v_?i@,L
5+vCuVZ
import java.io.Serializable; iS&~oj_-%
import java.util.List; an_qE}P
b'Pq[ )
import org.hibernate.Criteria; |5_bFB+&
import org.hibernate.HibernateException; bY|%ois4
import org.hibernate.Session; e^&QT
import org.hibernate.criterion.DetachedCriteria; IfzHe8>
import org.hibernate.criterion.Projections; l TY%,s
import zpV@{%VSj
>J_{mU
org.springframework.orm.hibernate3.HibernateCallback; Tf7$PSupP
import 1sl^+)z8
BIEc4k5(
org.springframework.orm.hibernate3.support.HibernateDaoS bj\v0NKN4
BF@(`D&>
upport; 1 mhX3
F' s($n
import com.javaeye.common.util.PaginationSupport; ]wh8m1
d"<Q}Ay
public abstract class AbstractManager extends nF~</>
E1IRb':
HibernateDaoSupport { z~Ph=1O>p
C9E l {f
privateboolean cacheQueries = false; 3G9"La,b
|:$D[=
privateString queryCacheRegion; e48`cX\E
vDZhoD=VR
publicvoid setCacheQueries(boolean %VOn;_Q*B
py`RH)
cacheQueries){ xB_F?d40T5
this.cacheQueries = cacheQueries; 1|bu0d\]
} AWHB^}!}
xx0s`5
publicvoid setQueryCacheRegion(String Xt~`EN
A`Q'I$fj
queryCacheRegion){ Ev* b
this.queryCacheRegion = 'bGL@H
j2# nCU54Z
queryCacheRegion; yn<H^c
} Nr=ud QA{
mt3j- Mw
publicvoid save(finalObject entity){ $gT+Ue|7
getHibernateTemplate().save(entity); o"~ODN"L
} 0JQy-hpF
XIh2Y\33ys
publicvoid persist(finalObject entity){ x^Tjs<#
getHibernateTemplate().save(entity); j89|hG)2
} /tl/%:U*.
c|3%0=,`
publicvoid update(finalObject entity){ cE>K:3n
getHibernateTemplate().update(entity); ^0"NcOzzxl
} (__=*ew
:' ?%%P
publicvoid delete(finalObject entity){ )QE7$|s
getHibernateTemplate().delete(entity); .w/#S-at
} >C y
TU$PAwn=
publicObject load(finalClass entity, U^vQr%ha
;ZXP*M9
finalSerializable id){ Epj
return getHibernateTemplate().load 6eE%x?#
";}Lf1M9
(entity, id); I"Y d6M%
;
} W/ZmG]sZE
@?iLz7SPk
publicObject get(finalClass entity, R~8gw^w![
GY<ErS)2
finalSerializable id){ H+vONg
return getHibernateTemplate().get i3t=4[~oL
yjs5=\@
(entity, id); 4O_z|K_k|
} %])-+T
21D4O,yCe
publicList findAll(finalClass entity){ j)ZvlRi,
return getHibernateTemplate().find("from 5,`U3na,
[1B F8:
" + entity.getName()); =Xze ).g
} :khl}|
(1H_V(
publicList findByNamedQuery(finalString m76**X
KK4>8zGR
namedQuery){ kRs[H xI3
return getHibernateTemplate bcL>S$B
/tRzb8`
().findByNamedQuery(namedQuery); B%gk[!d}8
} XRXKO>4q
{Uxah
publicList findByNamedQuery(finalString query, ,OWdp<z
^Dh j<_
finalObject parameter){ o_&.R
return getHibernateTemplate c\FyX\i
6-va;G9Fc
().findByNamedQuery(query, parameter); rubqk4
} v:1l2Y)g
S_LY>k?
publicList findByNamedQuery(finalString query, q88p~Ccoa
nV 38Mj2U
finalObject[] parameters){ ~-x8@ /
return getHibernateTemplate Fn$/ K
|57KTiiNLI
().findByNamedQuery(query, parameters); )?~3fb6^
} g0I<Fan
!+& NG&1
publicList find(finalString query){ 2n+j.
return getHibernateTemplate().find zYpIG8"o5
+4\JY"oi
(query); ,{ CgOz+Ul
} N%;Q[*d@/
fOiLb.BW
publicList find(finalString query, finalObject Z)'jn8?P
]Vhhx`0
parameter){ wOE_2k
return getHibernateTemplate().find A>+5~u
TFbCJ@X
(query, parameter); j>gO]*BX~
} AKx\U?ei7
q_HC68YF,
public PaginationSupport findPageByCriteria Y?%MPaN:
2#_9x7g+
(final DetachedCriteria detachedCriteria){ U#G
uB&V
return findPageByCriteria RyD2LAf)J
0K>rc1dy
(detachedCriteria, PaginationSupport.PAGESIZE, 0); a1ZGMQq!
} %8`zaa
hDmtBdE
public PaginationSupport findPageByCriteria efMv1>{
-qfd)A6]
(final DetachedCriteria detachedCriteria, finalint +f\tqucI3
Xn.zN>mB
startIndex){ ]@l~z0^|[_
return findPageByCriteria "A__z|sQ
NF0IF#;a
(detachedCriteria, PaginationSupport.PAGESIZE, .
)Fn]x"<
}^G'oR1LF
startIndex); meR%);\
} <<(~'$~,L
6`NsX
public PaginationSupport findPageByCriteria [#j|TBMHM
<y*#[:i
(final DetachedCriteria detachedCriteria, finalint /.'1i4Xa1P
HT
A-L>Cee
pageSize, .)|jBC8|}
finalint startIndex){ Y~=5umNSX
return(PaginationSupport) St|sUtj<r
`]5XY8^kI
getHibernateTemplate().execute(new HibernateCallback(){ Ul@ZCv+
publicObject doInHibernate #Vul#JHW
Y+upZ@Ga
(Session session)throws HibernateException { >~BU<#
Criteria criteria = rZGbU&ZM8
?jw)%{iKYV
detachedCriteria.getExecutableCriteria(session); G2a fHL<
int totalCount = <n }=zu
./#K@V1
((Integer) criteria.setProjection(Projections.rowCount z &<Rx[
A6iyJFmD
()).uniqueResult()).intValue(); TM!R[-\
criteria.setProjection Z I}m~7
xO1d^{~^^
(null); V2,.@j#
List items = b4%IyJr
"j$}'uK<
criteria.setFirstResult(startIndex).setMaxResults 42z9N\ f
/unOZVr(
(pageSize).list(); BC@"WlD
PaginationSupport ps = H:[z#f|t
P]y2W#Rs
new PaginationSupport(items, totalCount, pageSize, W:rzfO.`Z
{GWcw<g.B
startIndex); ^D.B^BR
return ps; aOYd"S}u
} `
|]6<<'iW
}, true); MIR17%G
} 9s*Lzi[}
w_U5w
public List findAllByCriteria(final U#F(#3/
T7W+K7kbI
DetachedCriteria detachedCriteria){ W_sDF; JP
return(List) getHibernateTemplate Ce_Z
&?
;V@}
oD+
().execute(new HibernateCallback(){ l^Lg"m2
publicObject doInHibernate s?`)[K'-
<K97eAcW
(Session session)throws HibernateException { ZVGw@3
Criteria criteria = x_@ev-
} KMdfA
detachedCriteria.getExecutableCriteria(session); U-lN_?
return criteria.list(); D 'u+3
} [j!0R'T
}, true); Y7{|EI+@
} {M%"z,GL7J
hD$U8~zK
public int getCountByCriteria(final Me`"@{r|#
v5 9>
DetachedCriteria detachedCriteria){ F~DG:x~
Integer count = (Integer) -d[x09
lN1zfM
getHibernateTemplate().execute(new HibernateCallback(){ 3p^WTQ>(
publicObject doInHibernate tNUcmiY
{UUVN/$
(Session session)throws HibernateException { !tbRqW6v
Criteria criteria = qq?>ulu*W
@Td[rHl
detachedCriteria.getExecutableCriteria(session); '<}7bw}+c
return ? {l2
ow$#kQ&R O
criteria.setProjection(Projections.rowCount sO
]{"(l(
()).uniqueResult(); 4]+ ^K`
} oVhw2pKpM
}, true); m9q%l_
return count.intValue(); 9iOlR=-*
} +(/Z=4;,[
} tL).f:?
O.4"h4{'
Dr2h-
JDhA{VN6
i;tA<-$-
pIrAGA;
用户在web层构造查询条件detachedCriteria,和可选的 -w2ga1
CX:^]wY
startIndex,调用业务bean的相应findByCriteria方法,返回一个 2h:f6=)r/u
$yc,D=*Isi
PaginationSupport的实例ps。 s<dD>SU
cp2fDn
ps.getItems()得到已分页好的结果集 y,r`8
ps.getIndexes()得到分页索引的数组 I^wj7cFo5
ps.getTotalCount()得到总结果数 ,yqzk.
ps.getStartIndex()当前分页索引 feopO
j6~+
ps.getNextIndex()下一页索引 I{AU,
ps.getPreviousIndex()上一页索引 (o:CxhV
>4VU
*c%@f<R~
m0*
B[
FEZ6X
."^dJ |fN
]q3Kd{B
连续看了两篇robbin有关DetachedCriteria的介绍,感觉真的不错 $oQsh|sTI
c@^:tB
,尤其是上面的示例代码,让我着实觉得该对我原来的分页查询做 e-')SB
`%XgGHiE
一下代码重构了。 iR_Syk`G*A
G9a%N
我把原本我的做法也提供出来供大家讨论吧: P3yiJ|vP
(p?3#|^
首先,为了实现分页查询,我封装了一个Page类: =5/;h+bk+3
java代码: 7
b.-&,
t?
A4xk
yki
k4MeB
/*Created on 2005-4-14*/ tZYI{m{
package org.flyware.util.page; PJYA5"}W
u`'z~N4}
/** 4@V]zfu^Q
* @author Joa bZ9NnSuH
* L@4zuzmlb
*/ p<zXuocQ
publicclass Page { 0xxzhlKNL
UjDF
/** imply if the page has previous page */ IeB6r+4|
privateboolean hasPrePage; :|M/+XPu
N39nJqo>"
/** imply if the page has next page */ 7L+X\oaB
privateboolean hasNextPage; U&n>fXTHn
uT/B}`md
/** the number of every page */ {~^)-^Wt:
privateint everyPage; jDX<iX%e
BR^J y<^F'
/** the total page number */ 7ILa H|eN
privateint totalPage; KY`96~z
cQ.;dtT0
/** the number of current page */ hcgc
=$^
privateint currentPage; @,4%8E5
IOkC [([
/** the begin index of the records by the current uK:-g,;
NoO+xLHw8
query */ >NRz*h #
privateint beginIndex; )6Q0f
~{vdP=/WP
yJ8}*Gj&
/** The default constructor */ b!X"2'
public Page(){ 9I\3T6&tr
= (gmd>N
} !Gp3/<"Wy$
p,iCM?[|
/** construct the page by everyPage 2rCY&8
* @param everyPage e4Ox`gLa*p
* */ <i'u96
public Page(int everyPage){ `f+8WPJPZ
this.everyPage = everyPage; ]rg+nc3
} `MsYgd
9V;$v
/** The whole constructor */ R==cz^#
public Page(boolean hasPrePage, boolean hasNextPage, =*g$#l4
l-S'ATZ0p
akhL\-d)al
int everyPage, int totalPage, ,B %fjcn
int currentPage, int beginIndex){ E ;!<Z4
this.hasPrePage = hasPrePage; nF<y7XkO
this.hasNextPage = hasNextPage; %i&/$0.8
this.everyPage = everyPage;
f5aF6FBH
this.totalPage = totalPage; 7y)=#ZG'R
this.currentPage = currentPage; 9c6GYWIFt&
this.beginIndex = beginIndex; rocB"0
} +^*5${g;@H
,MM>cOQ
/** ^.#X<8hr
* @return (]Ye[j^"7
* Returns the beginIndex. +`*qlP;
*/ 'cZMRRc<
publicint getBeginIndex(){ aZj J]~bO
return beginIndex; "%E-X:Il#
} 6~ 7 ;o_>
nuSN)}b<Q
/** Or+*q91j
* @param beginIndex 3qiJwo>
* The beginIndex to set. ])V2}gH
*/ f6B-~x<l
publicvoid setBeginIndex(int beginIndex){ 2f19W#
'0
this.beginIndex = beginIndex; /o~qC<7
} .Iwur;/\
>gk z4.*
/** nn @^K6
* @return 1Xy8|OFc[
* Returns the currentPage. r$GPYyHK
*/ .tRr?*V|l
publicint getCurrentPage(){ R:'Ou:Mh
return currentPage; d>%gW*
} q=6Cc9FN
`DLp<_z>
/** *Y85DEA
* @param currentPage v7i^O`{eD?
* The currentPage to set. ~;M)qR?]W
*/ rv9B}%e
publicvoid setCurrentPage(int currentPage){ yoBgr7gS
this.currentPage = currentPage; vBh;
} pOC% oj
*16<M)7
/** l0gY~T/#3
* @return GE1i+.+-.
* Returns the everyPage. t})lr\
*/ @#RuSc
publicint getEveryPage(){ v(DwU!
return everyPage; q7X}MAW
} .L9']zXc`
nX0HT
)}
/** t,
U)
~wi
* @param everyPage g;pR^D'M5C
* The everyPage to set. &V'519vmoZ
*/ n( g)UNx
publicvoid setEveryPage(int everyPage){ Ve{n<{P
this.everyPage = everyPage; V=pMq?Nr
} pSHSgd~&
lDN"atSf
/** /;?M?o"H
* @return N0i!l|G6
* Returns the hasNextPage. >F1G!#$0
*/ HBH$
publicboolean getHasNextPage(){ =#qZ3 Qz_
return hasNextPage; QK)){cK
} zuSq+pxL@
j 5Qo*p
/** ,P{m k%=9
* @param hasNextPage kb71q:[
* The hasNextPage to set. vw2`:]Q+
*/ <$%X<sDkq
publicvoid setHasNextPage(boolean hasNextPage){ Dj i^+;"&
this.hasNextPage = hasNextPage; r9#
\13-
} eG5Y+iL-V
~C-,G"zw&G
/** dBSbu=^$ )
* @return V
A<5uk04K
* Returns the hasPrePage. .N,&Uv-
*/ Q_]d5pl
publicboolean getHasPrePage(){ glj7$
return hasPrePage; (D<(6?
} =pcF:D#+
<3TA>Dz
/** rq sdE
* @param hasPrePage {%C*{,#+8q
* The hasPrePage to set. KzjC/1sd
*/ K=dR%c(
publicvoid setHasPrePage(boolean hasPrePage){ ]5}=^
this.hasPrePage = hasPrePage;
%@Oma
} S4N(cn&
g:7,~}_}^
/** ZE?f!ifp
* @return Returns the totalPage. UH?
p]4Nz
* Q8D&tJg
*/ &;E5[jO^D
publicint getTotalPage(){ Tlq-m2]
return totalPage; eg/<[ A:
} )? =YT
%'
$o"
/** =-KMb`xT
* @param totalPage p =(@3%k
* The totalPage to set. vAb^]d
*/ S?ujRp
publicvoid setTotalPage(int totalPage){ 7a4o1;l
this.totalPage = totalPage; t23'x0l
} 0Yl4eB-
~g#r6pzN-
} KS}hU~
K+Y^>N 4m
`'I{U5;e
h.eM
RdlO
"{D6J809
上面的这个Page类对象只是一个完整的Page描述,接下来我写了一 R=Zn -q
3S*AxAeg
个PageUtil,负责对Page对象进行构造: ;5_{MCPM
java代码: KLoE&ds
NVKC'==0
p;T{i._iL
/*Created on 2005-4-14*/ DdQ;Q5|
package org.flyware.util.page; q h/F
]rehW}
import org.apache.commons.logging.Log; ;-P)m
import org.apache.commons.logging.LogFactory; dCyqvg6u
H}hFFI)#Oo
/** _VE^/;$"l
* @author Joa 1CU>L[W)
* qfY5Ww$8
*/ az0<5Bq)
publicclass PageUtil { Fm\"{)V:b
E`int?C!
privatestaticfinal Log logger = LogFactory.getLog {S/yL[S.
"@R>J?Cc+
(PageUtil.class); C%d_@*82
KmG
/** hu_ ^OlF
* Use the origin page to create a new page ,.iRnR
* @param page ]i(-I <`
* @param totalRecords SIO&rrT.
* @return o#) {1<0vg
*/ 'c2W}$q
publicstatic Page createPage(Page page, int 6+r$t#
ZkL8 e
totalRecords){ :B3[:MpL}
return createPage(page.getEveryPage(), OsBo+fwT
v+p{|X-
page.getCurrentPage(), totalRecords); |4$M]M f0
} .2d9?p3Y
!!@A8~H
/** ojYbR<jn9
* the basic page utils not including exception mxor1P#|
!cKz7?w
handler R_M?dEtE>
* @param everyPage SJD@&m%?[
* @param currentPage #/PA A
* @param totalRecords ~wg:!VWA)
* @return page EY*(Bw
*/ *6HTV0jv
publicstatic Page createPage(int everyPage, int >WY#4
f{SB1M
currentPage, int totalRecords){ d%l{V6
everyPage = getEveryPage(everyPage); dJ"iEb|4
currentPage = getCurrentPage(currentPage); Y5fLmPza
int beginIndex = getBeginIndex(everyPage, DNGvpKY@
!9 fz(9
currentPage); UK9@oCIB
int totalPage = getTotalPage(everyPage, o7IxJCL=Q
gV&z2S~"
totalRecords); GfM;saTz{
boolean hasNextPage = hasNextPage(currentPage, pr%nbl
nUkaz*4qU
totalPage); ^vG8#A}]
boolean hasPrePage = hasPrePage(currentPage); 9 \^|6k,
}9nDo*A"}
returnnew Page(hasPrePage, hasNextPage, DTWD|M
everyPage, totalPage, M'_9A
currentPage, {Zp\^/
B]tIi^
beginIndex); \Qm CeB
} 'Ei;^Y 1e
$s<Ne{?
privatestaticint getEveryPage(int everyPage){ ~|<m,)!
return everyPage == 0 ? 10 : everyPage; ;5@ t[r
} {rcnM7 S1L
ayAo^q
privatestaticint getCurrentPage(int currentPage){ #r3l[bKK
return currentPage == 0 ? 1 : currentPage; xW92ch+t
} :d ~|jS
6~*9;!th
privatestaticint getBeginIndex(int everyPage, int np~~mdmRK
;E'"Ks[GH
currentPage){ 41fJ%f`
G
return(currentPage - 1) * everyPage; eI@
q|"U
} id$Ul?z8
2B,] -Mu)
privatestaticint getTotalPage(int everyPage, int |ae97 5
<8,cuX\
totalRecords){ @)K%2Y`
int totalPage = 0; cV`E>w=D0
6 PxW8pn
if(totalRecords % everyPage == 0) Mg^e3D1_
totalPage = totalRecords / everyPage; 5Ba[k[b^
else .; )l
totalPage = totalRecords / everyPage + 1 ; _v*
nlc
p019)X|vx
return totalPage; s@fTj$h
} g(#f:"
e)?Fi
privatestaticboolean hasPrePage(int currentPage){ h&kZjQ&
return currentPage == 1 ? false : true; &7_Qd4=08w
} w^]6w\p
'TAUE{{
privatestaticboolean hasNextPage(int currentPage, u a\,->
@JRNb=?a
int totalPage){ mA{~PpSb
return currentPage == totalPage || totalPage == cCR+D.F
N:9>dpP}O
0 ? false : true; mq%<6/YU
} Ye.r%i&