Hibernate3 提供了DetachedCriteria,使得我们可以在Web层构造 =wE1j
I*hCIy#;
detachedCriteria,然后调用业务层Bean,进行动态条件查询,根 ]rU$0)VN
[Vzp D 4
据这一功能,我设计了通用的抽象Bean基类和分页类支持,代码来 D;
i%J
T$)N2]FE
自于Quake Wang的javaeye-core包的相应类,然后又做了很多修改 i^`]TOP
^FJ.C|l(
。 y(!J8(yA
/a@gE^TM
分页支持类: jG~zpZh
Y_S>S(0
java代码: t|XQFb@}
fR]%:'2k
(nL''#Ka
package com.javaeye.common.util; @'XxMO[Z!<
~
A?
import java.util.List; a8$gXX-2
R{N9'2l:
publicclass PaginationSupport { _ljdo`j#N
`q":i>FP2
publicfinalstaticint PAGESIZE = 30; C5k\RS9
1VRexp
privateint pageSize = PAGESIZE; vOMmsU F
q3Tp/M.
privateList items; o$disJ
?2LRMh")$
privateint totalCount; TX/Ng+v S
n_ORD@$]
privateint[] indexes = newint[0]; n^kszIu~
N!RkV\:X
privateint startIndex = 0; U5_1-wV
Wg \`!T
public PaginationSupport(List items, int &\[3m^L
ZoFQJJK56B
totalCount){ xweV8k/
setPageSize(PAGESIZE); YI0ubB
setTotalCount(totalCount); Rd#V,[d
setItems(items); B}Lz#'5_
setStartIndex(0); p:g`K#[F
} gpt98:w:
s{q)P1x
public PaginationSupport(List items, int #I]5)XT
P01o: /}
totalCount, int startIndex){ kWkAfzf4a
setPageSize(PAGESIZE); YTWlR]Tr6?
setTotalCount(totalCount); ~x}/>-d
setItems(items); >'\cNM~nf
setStartIndex(startIndex); &tKr
?l
} WcE{1&PXx
L!fiW`>0G
public PaginationSupport(List items, int 5yC$G{yV
HZ>8@AVa\
totalCount, int pageSize, int startIndex){ (+_i^SqK
setPageSize(pageSize); ah1DuTT/G
setTotalCount(totalCount); 8+gti*C?\
setItems(items); ~i3/Ec0\
setStartIndex(startIndex); ze5Hg'f
} S4qj}`$
Yv
F%<hng%k
publicList getItems(){ 1K<4Kz~
return items; e@B+\1
} \=kre+g
7x,c)QES`
publicvoid setItems(List items){ 67916
this.items = items; z@\r V@W5
} * &iSW~s
[5KzawV
publicint getPageSize(){ HkH!B.H]
return pageSize; y]z^e\qc)
} WGG
Va
E Z^eEDZ
publicvoid setPageSize(int pageSize){ 3F/05}d`
this.pageSize = pageSize; ]yzqBbV
} }M9R5!=q
}PdHR00^
publicint getTotalCount(){ A>SXc%K
return totalCount; q '6gj
} $M `%A
w>RBth^p
publicvoid setTotalCount(int totalCount){ a-P'h1hbH
if(totalCount > 0){ "ZuhN(-`
this.totalCount = totalCount; -85]x)JE
int count = totalCount / ~hJ/&,vH!
;THb6Jz/+
pageSize; J|ni'Hb
if(totalCount % pageSize > 0) ubq4Zv7'
count++; hN~]$"@2
indexes = newint[count]; *Ey5F/N}$H
for(int i = 0; i < count; i++){ ,(%?j]_P2
indexes = pageSize * <4caG2~q
#1>DV@^F
i; q(N2#di
} |sa{!tKJ
}else{
pt`^4}
this.totalCount = 0; iti~RV,
} QH_0U`3
} pI__<
l?_h(Cq<
publicint[] getIndexes(){ '/Y
D$*,
return indexes; j _r?4k
} 8XwZJ\5
"X\|!Mxh
publicvoid setIndexes(int[] indexes){ f^
q0#+k )
this.indexes = indexes; .I6:iB
} }7`HJ>+m)H
Nk~Xz
publicint getStartIndex(){ ]Bpdb'
return startIndex; jGM+
} I|RMxx y;
jafIKSD]%
publicvoid setStartIndex(int startIndex){ P>*g'OK^!G
if(totalCount <= 0) ?A!Lh,
this.startIndex = 0; Xp(e/QB
elseif(startIndex >= totalCount) ;(]O*{F7k
this.startIndex = indexes RoL5uha,l
Bl)znJ^
[indexes.length - 1]; Rn l
4
elseif(startIndex < 0) zjyj,jP
this.startIndex = 0; 8{mQmG4
else{ h)O<bI8
this.startIndex = indexes 6SYQRK
Iyo ey
[startIndex / pageSize]; @B<B#
} DXbzl
+R
} eSV_.uvsb
[1I>Bc&o*
publicint getNextIndex(){ q>$[<TsE&}
int nextIndex = getStartIndex() + I'23$IzPA
n@3(bl5{
pageSize; @;T>*_Yhn
if(nextIndex >= totalCount) |FF"vRi8a7
return getStartIndex(); 3f 1@<7*
else &VY(W{\eY
return nextIndex; (-V=&F_
} "8pfLI
D.e4S6\&
publicint getPreviousIndex(){ UV ?.KVD~
int previousIndex = getStartIndex() - FTB@70
w(lxq:>"
pageSize; gq$]jWtCD
if(previousIndex < 0) /0w?"2-
return0; Yl65|=ne
else ?*I
_'2
return previousIndex; b4_"dg~gK
} =:fFu,+{
\ 2Jr(?U
} (h"Yw
oXCZpS
EYwDv4H,g
\u|8MEB
抽象业务类 8vN} v3HV&
java代码: }v0IzGKs
ELx?ph -9
m?Gb5=qo
/** A+JM* eB
* Created on 2005-7-12 p[Z'Fl
*/ QlbhQkn
package com.javaeye.common.business; DYvi1X6
(#w8/@JxF
import java.io.Serializable; J- %YmUc)
import java.util.List; UOWOOdWSB
*{5L*\AZ
import org.hibernate.Criteria; @ 2mJh^cj
import org.hibernate.HibernateException; :U5>. ):
import org.hibernate.Session; "}uPz4
import org.hibernate.criterion.DetachedCriteria; 7e,EI9?.
import org.hibernate.criterion.Projections; R~-r8dWcw
import "HWl7c3q
e`1,jt'
org.springframework.orm.hibernate3.HibernateCallback; |"[[.Adw9"
import |51z&dG
5 =Os
sAr
org.springframework.orm.hibernate3.support.HibernateDaoS yFt'<{z[nL
cZ(7/Pl
upport; 0:(`t~
_8Si8+j
import com.javaeye.common.util.PaginationSupport; }2sc|K^
b"Hg4i)
public abstract class AbstractManager extends O5PCR6U
cJ 5":^O
HibernateDaoSupport { kcH?l
Z`fm;7NiVG
privateboolean cacheQueries = false; h[()!\vBy
F, ^<
privateString queryCacheRegion; []K5l%
M5C}*c9
publicvoid setCacheQueries(boolean c;,jb
DzLm~
aF
cacheQueries){ {5+t\~q$
this.cacheQueries = cacheQueries; z3IQPl^
} aX=
uJ S+;H
publicvoid setQueryCacheRegion(String }r&^*"
2=
"FC;k
>m
queryCacheRegion){ T-=sC=sS,
this.queryCacheRegion = q9-=>
<De29'},y
queryCacheRegion; xACAtJ'gc
} y8U |A0@$`
IX eb6j8
publicvoid save(finalObject entity){ thk33ss:
getHibernateTemplate().save(entity); f"h{se8C
} a;p3Me7
F+vgkqs@9
publicvoid persist(finalObject entity){ OQ<|XdI$
getHibernateTemplate().save(entity); $CaF"5}?Ke
} XUUl*5^
89F^I"Im(
publicvoid update(finalObject entity){ dMsX}=EI<
getHibernateTemplate().update(entity); zosJ=$L
} *Yk3y-
imdfin?=
publicvoid delete(finalObject entity){ RdlcJxM
getHibernateTemplate().delete(entity); +{
QyB
} |H&2[B"l
o.5w>l!9K
publicObject load(finalClass entity, q#Y%Y
MD ~03
finalSerializable id){ gIS<"smOo
return getHibernateTemplate().load `B;^:u
H"4^
(entity, id); `.+_}.m
} <J=9,tv<
h?2qX
publicObject get(finalClass entity, 4oLrCQZ\
![os5H.b#q
finalSerializable id){ jGM~(;iw6i
return getHibernateTemplate().get t?9F2rh
x|l[fdm5
(entity, id); 9;u$a^R.
} )*N]Q
}p0|.Qu 9
publicList findAll(finalClass entity){ ]}R\[F (_%
return getHibernateTemplate().find("from 50Z$3T
,u|vpN
" + entity.getName()); U/E M(y
} S?nXpYr
Le"$k su>
publicList findByNamedQuery(finalString nG&=$7x^
EzK,SN#
namedQuery){ RE`XyS0Q
return getHibernateTemplate 0|8c2{9X,
}6}Gj8Nb
().findByNamedQuery(namedQuery); ~;W]0d4,\
} AE1!u{
y5>859"h
publicList findByNamedQuery(finalString query, Z^9;sb,x
:(,uaX>{
finalObject parameter){ 4w0 &f
return getHibernateTemplate vBCQ-l<Ub
W[A;VOj0$
().findByNamedQuery(query, parameter); o
Y_(UIa
} O<l_2?S1
M(o?I}
publicList findByNamedQuery(finalString query, y yfm
j,QeL
finalObject[] parameters){ ~a&s5E
{
return getHibernateTemplate F!jYkDY
g7@G&Ro9J\
().findByNamedQuery(query, parameters); Cul^b_UmP#
} ZLe@O~f;%
hdtb.u~
publicList find(finalString query){ ',nGH|K.
return getHibernateTemplate().find ;1}~(I#Y
Pq`]^^=be'
(query); u|ia
} xlF$PpRNM
t_c;4iE
publicList find(finalString query, finalObject o~H4<ayy
8D[P*?O
parameter){ &;5QB
return getHibernateTemplate().find 6rMGlzuRo
D]v=/43
(query, parameter); =mYY8c Yl
} )s1W)J?8
|lAu6d
!
public PaginationSupport findPageByCriteria r>4.{\C
A 1x?_S"a
(final DetachedCriteria detachedCriteria){ <*0^X%Vf\
return findPageByCriteria ,tv
P"@d
O=8:K'
(detachedCriteria, PaginationSupport.PAGESIZE, 0);
.BJ;}
} m&jh7)V
Y~( #_K
public PaginationSupport findPageByCriteria a) GLz
*A.E?9pL\
(final DetachedCriteria detachedCriteria, finalint %CJgJ,pk>
TO.?h!
startIndex){ W4Nbl
return findPageByCriteria @ae;&
<SmXMruU
(detachedCriteria, PaginationSupport.PAGESIZE, mR:G,XytxM
ECqcK~h#E
startIndex); g76l@QYIU
} J2 {?P
cs
UN[rW0*
public PaginationSupport findPageByCriteria "jly[M}C
6j@3C`Yd
(final DetachedCriteria detachedCriteria, finalint "P`V|g
F)g.CDQ!c
pageSize, :Lqz`
finalint startIndex){ `|e?91@vEa
return(PaginationSupport) wMNtN3
i6M_Gk}
getHibernateTemplate().execute(new HibernateCallback(){ Au,xIe!t
publicObject doInHibernate +xMK.*H]W
74hGkf^S
(Session session)throws HibernateException { !mH2IjcL
Criteria criteria = CsG1HR@
/PF X1hSu
detachedCriteria.getExecutableCriteria(session); $EHAHNL?Lx
int totalCount = XNkw9*IT
W*iPseXq
((Integer) criteria.setProjection(Projections.rowCount x0B|CO
;o }pRC
()).uniqueResult()).intValue(); K4NB#
criteria.setProjection #FKo:id`K
o^%4w>|
(null); 6O8'T`F[
List items = y)o!F^
TcA+ov>TD
criteria.setFirstResult(startIndex).setMaxResults
Y,z15i3j?
pB;)Hii\
(pageSize).list(); ,\zp&P"p
PaginationSupport ps = +"rZ< i
LM}0QL
m?
new PaginationSupport(items, totalCount, pageSize, V~M>K-AL
{^ 1s
startIndex); #aUe7~
return ps; 6[>UF!.=
} H^sPC{6+pf
}, true); E8#RG-ci
} +[@Ug`5M
X'4e)E3*O
public List findAllByCriteria(final ,":_=Tf.
$ KQ7S>T
DetachedCriteria detachedCriteria){ ' p,QI>
return(List) getHibernateTemplate 'aMT^w4if)
7JNhCOBB
().execute(new HibernateCallback(){ W#!![JDc
publicObject doInHibernate -I4-K%%B`
'eg?W_zu
(Session session)throws HibernateException { &g;4;)p*8
Criteria criteria = 9^l_\:4
8&: *<
detachedCriteria.getExecutableCriteria(session); Yoi4R{9c
return criteria.list(); 6n37R#(
} ;Q>(%"z};
}, true); m:A7*r[
} !~PLW] Z4
1^rODfY 0
public int getCountByCriteria(final .PBma/w
W
?zp@HSa9
DetachedCriteria detachedCriteria){ xo/[,rR
Integer count = (Integer) qV0C2jZ2
//*>p
getHibernateTemplate().execute(new HibernateCallback(){ _D7MJT
publicObject doInHibernate ~jMdM~}
wZN<Og+;
(Session session)throws HibernateException { J'B6l#N
Criteria criteria = !/O c)Yk
'zV/4iE=
detachedCriteria.getExecutableCriteria(session); r168ft?c
return l<0BMw S8
LQ
pUyqR
criteria.setProjection(Projections.rowCount *+TIF"|1
TZL)jfhj
()).uniqueResult(); e!wBNcG2
} f.,ozL3*
}, true); 6?OH"!b2-}
return count.intValue(); H)aeSF5
} GPnd7}Tn
} HT7V} UiaO
C(7uvQ
(5Q,d [B
|mvy@hm
Q)x`'[3"7W
^pA|ubZ
用户在web层构造查询条件detachedCriteria,和可选的 ;(M`Wy]2
Z|+SC \Y
startIndex,调用业务bean的相应findByCriteria方法,返回一个 [P`t8
3l"7 $B
PaginationSupport的实例ps。 u1d{|fF
|Q2H^dU'rQ
ps.getItems()得到已分页好的结果集 &z;F'>"
ps.getIndexes()得到分页索引的数组 h7mJXS)t|
ps.getTotalCount()得到总结果数 bAv>?Xqa
ps.getStartIndex()当前分页索引 (@Q@B%!!K
ps.getNextIndex()下一页索引 3#vhQ*xU
ps.getPreviousIndex()上一页索引 E ?(+v
2)(P;[m^o
r
J'm>&Ps
vB(tpki|
H@%Y!z@\
* bx%hX
.lm^ +1}r
连续看了两篇robbin有关DetachedCriteria的介绍,感觉真的不错 D(6d#c
Xao
0cb.R
,尤其是上面的示例代码,让我着实觉得该对我原来的分页查询做 n)$T
zND
) 9h5a+Z
一下代码重构了。 ':6!f
KZ^W@*`D
我把原本我的做法也提供出来供大家讨论吧: HVG9 C$
2@WF]*Z
首先,为了实现分页查询,我封装了一个Page类: `h+ia/
java代码: f6n'g:&.W
IKSe X
e-vL!&;2
/*Created on 2005-4-14*/ H/m -$;cF3
package org.flyware.util.page; qD:3;85
bf]W_I]B
/** $r} )j~c
* @author Joa ;KqH]h)
* bm9@A]yP
*/ n`<YhV
publicclass Page { sE7!U|
L ;5uB2
/** imply if the page has previous page */ R /J@XP
privateboolean hasPrePage; F.ml]k&(m
n]G!@-z
/** imply if the page has next page */ =w='qjh
privateboolean hasNextPage; L/,#:J
bp Q/#\Z
/** the number of every page */ V~p/P
privateint everyPage; ZnDI
J&S
hhQLld4
/** the total page number */ Sgp$B:
privateint totalPage; lN"%~n?
)z#
/** the number of current page */ V"=(I'X
privateint currentPage; G/ToiUY
??Zh$^No:
/** the begin index of the records by the current Z>1\|j
f,{O%*PUA
query */ h ,;f6
privateint beginIndex; ?h)Z ;,}
v:0.
9C[i#+_3M
/** The default constructor */ B;.]<k'3
public Page(){ `0a=A#]1o
/Zs;dam
} ./nq*4=
QV/o;
/** construct the page by everyPage WO{V,<;
* @param everyPage hd*bPj;
* */ Kp[ F@A#
public Page(int everyPage){ Ul#||B .c{
this.everyPage = everyPage; 6}bUX_!&s
} ht _fbh(l
P)bS ;w\(Y
/** The whole constructor */ f4Aevh:
public Page(boolean hasPrePage, boolean hasNextPage, uN1(l}z$
1I< <`7'
3_k.`s_Z
int everyPage, int totalPage, 2L}F=$zz
int currentPage, int beginIndex){ kc#<Gr&Z&
this.hasPrePage = hasPrePage; }!{9tc$<b
this.hasNextPage = hasNextPage; B;f\H,/59
this.everyPage = everyPage; U_!Wg|
this.totalPage = totalPage; QRbiO
this.currentPage = currentPage; PYWp2V/
this.beginIndex = beginIndex; X1Vx6+[
} \%Wu`SlDp9
[_W#8{
/** p^1s9CM%
* @return /.!ytHw8
* Returns the beginIndex. o'nju.'
*/ 5P{PBd}glp
publicint getBeginIndex(){ owYf1=G
return beginIndex; +dd\_\
} {.=4;
2S'{$m)
/** m,UMb#7Y
* @param beginIndex .|=~x3mPw
* The beginIndex to set. ;{@ [ek6
*/ .ET@J`"M
publicvoid setBeginIndex(int beginIndex){ $kPC"!X\
this.beginIndex = beginIndex; >|h$d:~n
} 8BP.VxX
Ak(_![Q:q\
/** .{,PC
* @return yTj!(C
* Returns the currentPage. .Y!]{c
*/ p'PHBb8I
publicint getCurrentPage(){ w@ 1g_dy
return currentPage; C>\0
"}iD
} h>>KH*dQ
]:Y@pZ
/** 9X<o8^V
* @param currentPage Z!\xVCG"q
* The currentPage to set. 8}9B*m
*/ &fH;A X.
publicvoid setCurrentPage(int currentPage){ ;2lKo ="
this.currentPage = currentPage; 'F3cvpc`
} D
vG9(Eh
C:Tjue{G2
/** ]&l.-0jt
* @return J=QuZwt
* Returns the everyPage. 2M`]nAk2a
*/ ~zdHJ8tYp
publicint getEveryPage(){ $$my,:nH
return everyPage; <_X`D4g]XO
} !V|%n(O"
v X=zqV
/** 6:Eu[PE~w
* @param everyPage .9r+LA{
* The everyPage to set. Skm$:`u;
*/ VXr'Z
publicvoid setEveryPage(int everyPage){ WO=X*One
this.everyPage = everyPage; VKzY6
} z
D&5R/I
d1&RK2
/** <A% }
* @return (;1rM}B;1
* Returns the hasNextPage. Mlr]-Gu5Z
*/ >cVEr+r9t
publicboolean getHasNextPage(){ | g o jb
return hasNextPage; g.3 .
C?
} .m',*s<CMQ
qIm?F>>@
/** (?luV#{5
* @param hasNextPage vAeh#V~#
* The hasNextPage to set. wD(1Sr5n
*/ <Uz~V;
publicvoid setHasNextPage(boolean hasNextPage){ *Ru@F:
this.hasNextPage = hasNextPage; IP)?dnwG
} ^;on
rgth2y]
/** Iud]*5W
* @return )TYrb:M'm
* Returns the hasPrePage. E:EXp7
*/ "S#}iYp
publicboolean getHasPrePage(){ R~9\mi5^UH
return hasPrePage; iF.eBL%
} /]0-|Kg+R
)HLe8:PG~
/** ?`& l Y
* @param hasPrePage M]\p9p(_
* The hasPrePage to set. .uu[f2.N+
*/ P F#X8+&J
publicvoid setHasPrePage(boolean hasPrePage){ (``EBEn
this.hasPrePage = hasPrePage; -N'xQ(#n3q
} bf~gWzA
m(~5X0
/** \W"N{N
* @return Returns the totalPage. qs$%/
* < 0S+[7S"
*/ jt({@;sU[<
publicint getTotalPage(){ q(tdBd'o6
return totalPage; () l#}H`m
} \>8r)xC
.#py5&`%
/** MjGeH>c
* @param totalPage ["5Z=4
* The totalPage to set. k]J!E-yI8
*/ - v\n0Jt
publicvoid setTotalPage(int totalPage){ o6{[7jI
this.totalPage = totalPage; Mi|PhDXMh
} >]6inS9
;.%Ii
w&WG
} 1J(` kQ)c
MS`wd
#bFJ6;g=V
I/whpOg
yJ(BPSt
上面的这个Page类对象只是一个完整的Page描述,接下来我写了一 >U.)?>G/dt
E=Z;T
个PageUtil,负责对Page对象进行构造: P!;%DI!<b
java代码: SV-M8Im73z
+ -[M 7J
|
rY.IbL
/*Created on 2005-4-14*/ f:/[
package org.flyware.util.page; q7itznQSKc
sbWen?
import org.apache.commons.logging.Log; BvXA9YQ3
import org.apache.commons.logging.LogFactory; |AY`OVgcKD
C26vH#C
/** NGA8JV/U
* @author Joa O26'|w@$
* ]_8bX}_n
*/ mM6g-)cV
publicclass PageUtil { {*/&`$0lH|
g;N)K3\2
privatestaticfinal Log logger = LogFactory.getLog 80i-)a\n
7=$@bHEF#*
(PageUtil.class); *$
9qhX\, h
/** ^lF'KW$
* Use the origin page to create a new page s7x&x;-
* @param page 'X()|{
* @param totalRecords f-w-K)y$ht
* @return u@(z(P
*/ s-\.j-Sa
publicstatic Page createPage(Page page, int (MI8Kkb1d
3J^"$qfSn
totalRecords){ 'N-nFc^
return createPage(page.getEveryPage(), i)vbmV
rQ_!/J[9
page.getCurrentPage(), totalRecords); v[3QI7E3
} 1qEpQ.:](
MfX1&/Z+
/** {8'f>YP
* the basic page utils not including exception ; O6Ez-"
R)p+#F(s
handler pzkl ;"gK
* @param everyPage >";I3S-t
* @param currentPage o09)esy
* @param totalRecords \O*8%
* @return page XI4le=^EM
*/ *]L(,_:"
publicstatic Page createPage(int everyPage, int )#^5$5
-r.Qy(}p
currentPage, int totalRecords){ .7h:/d
Y:
everyPage = getEveryPage(everyPage); 7Ya4>*B
currentPage = getCurrentPage(currentPage); Ya%-/u
int beginIndex = getBeginIndex(everyPage, @X _<y
8uj;RG
currentPage);
j -H2h
int totalPage = getTotalPage(everyPage, a&'!g)d
q<5AB{Oj?
totalRecords); $#b@b[h<w
boolean hasNextPage = hasNextPage(currentPage, :\]TAQd-
T^"-;
totalPage); 6c[&[L%
boolean hasPrePage = hasPrePage(currentPage); ~,*=j~#h
{S+ $C
returnnew Page(hasPrePage, hasNextPage, hkifd4#
everyPage, totalPage, ,'7 X|z/_>
currentPage, -y@#
^SrJ
4pYscB
beginIndex); %K9 9_Cl3
} K2'Il[
1
P0)La#
privatestaticint getEveryPage(int everyPage){ ]J]~i[
return everyPage == 0 ? 10 : everyPage; 8p91ni'
} vXq2="+
Hzn6H4Rc
privatestaticint getCurrentPage(int currentPage){ R6xJw2;_
return currentPage == 0 ? 1 : currentPage; !4?QR
} h;+bHrKji
|qp^4vq.p
privatestaticint getBeginIndex(int everyPage, int v`G [6Z
ees^j4
currentPage){ w~}*MsB
return(currentPage - 1) * everyPage; 9fj8r3 F#
} eeOE\
0@BhRf5
privatestaticint getTotalPage(int everyPage, int ::&hfHR*P
lD K<gd
totalRecords){ t XbMP
int totalPage = 0; rQrh(~\:
@v:p)|Ne;
if(totalRecords % everyPage == 0) (E*pM$
totalPage = totalRecords / everyPage; ^U5g7Emf
else 8c1ma
totalPage = totalRecords / everyPage + 1 ; Ig.9:v`
o 9?#;B$
return totalPage; f@)GiLC'"
} 3|Vh[iAa\
GIs
*;ps7w
privatestaticboolean hasPrePage(int currentPage){ gO9\pI2
return currentPage == 1 ? false : true; K:<0!C!
} :m{;<LRV
Bh%Yu*.f
privatestaticboolean hasNextPage(int currentPage, ah8xiABa
d i;Fj
int totalPage){ HW"';M%
return currentPage == totalPage || totalPage == u3VSS4RG%
d[t+iBP;)
0 ? false : true; xGBp+j1H
} ;oT!\$Mu
+eIX{J\s
$Fr>'H+i
} f,s1k[w/;
}zE
Qrfl
S0zk<