Hibernate3 提供了DetachedCriteria,使得我们可以在Web层构造 (S#nA:E
hNGD`"U
detachedCriteria,然后调用业务层Bean,进行动态条件查询,根 d@,3P)?
`]\:%+-
据这一功能,我设计了通用的抽象Bean基类和分页类支持,代码来 I85bzzZB
R.B3
自于Quake Wang的javaeye-core包的相应类,然后又做了很多修改 |_`wC
_^cFdP)8|
。 aO>Nev
>KMTxHE`+
分页支持类: 0I
\l_St@
S#l6=zI7^R
java代码: }wR&0<HA
kmfxk/F}
n8vteGQ
package com.javaeye.common.util; p:q?8+W-r
3tIno!|
import java.util.List; VA0p1AD
[^GXHE=
publicclass PaginationSupport { TBp$S=_**
,zU7U L^I
publicfinalstaticint PAGESIZE = 30; WnZn$N.
sFWH*kdP?
privateint pageSize = PAGESIZE; CPS1b
/QK H30E
privateList items; <764|q
yM-3nwk
privateint totalCount; Oe:_B/l
f))'8
privateint[] indexes = newint[0]; C.}Vm};M
}|!9aojr
privateint startIndex = 0; /~B\1
=
7TK&
public PaginationSupport(List items, int Fi!XaO
ss>p
totalCount){ |g}~7*+i
setPageSize(PAGESIZE); I3$/#
setTotalCount(totalCount); C~#ndl
Ij
setItems(items); :ncR7:Z
setStartIndex(0); y+.E}
} Ko|p&-Z;
{s/u[T_D2
public PaginationSupport(List items, int Gv uX"J
w~I;4p~(N
totalCount, int startIndex){ 3om4q2R
setPageSize(PAGESIZE); w`;>+_ E7
setTotalCount(totalCount); Jg\1(ix
setItems(items);
c!})%{U
setStartIndex(startIndex); (fJ.o-LQ
} rxVJB3P9
W
n43TSs-
public PaginationSupport(List items, int a="\?L5
q
VcZF7
totalCount, int pageSize, int startIndex){ L=9w
3VXS
setPageSize(pageSize); Ivue"_i;!
setTotalCount(totalCount); 'HdOW[3o
setItems(items); _YM]U`*
setStartIndex(startIndex); o}4J|@Hi|4
} 6*92I
:n t\uwh
publicList getItems(){ A>dA&'~R
return items; iig ({b
} 0 `L>t
XdR^,;pWE
publicvoid setItems(List items){
[C TR8
this.items = items; OG&X7>'3I{
} .oR_r1\y
`LID*uD;_
publicint getPageSize(){ yA#-}Y|]b
return pageSize; >
l@o\
} wK[Xm'QTPJ
U;Ne"Jh
publicvoid setPageSize(int pageSize){ Q:4euhz*
this.pageSize = pageSize; ;0!rq^JG
} 82bOiN15
k}o*=s>M
publicint getTotalCount(){ IT~pp_6g
return totalCount; NgXV|) L
} b jq1",
T)QT_ST.9
publicvoid setTotalCount(int totalCount){ EhBYmc"&
if(totalCount > 0){ %wD<\ XRM
this.totalCount = totalCount; M9aVE)*!I
int count = totalCount / F;&a=R!.
DY~zi
pageSize; ~Uet)y<
if(totalCount % pageSize > 0) oy)'wb~
count++; Pd[&&!+gV
indexes = newint[count]; h5.>};"@'
for(int i = 0; i < count; i++){ %+y92'GqG/
indexes = pageSize * N))G/m3
X+*"FKm S.
i; z&@Vg`w"
} uWSfr(loX
}else{ /` j~r;S
this.totalCount = 0; Qs^RhF\d
} I>jDM
} ?\l@k(w4[x
]5=C3Y
publicint[] getIndexes(){ #el i_Cxe
return indexes; -brn&1oJ
} Rf~? u)h1
oq>8
publicvoid setIndexes(int[] indexes){ X~Yj#@
this.indexes = indexes; 'Wn2+pd
} @]EJbiGv
3]iBX`Ni
publicint getStartIndex(){ !PFc)J
return startIndex; }8W5m(Zq9n
} S1R:/9
z
nDhD"rc
publicvoid setStartIndex(int startIndex){ y^SDt3Am
if(totalCount <= 0) V+M=@Pvp9
this.startIndex = 0; 'z=QV {ni
elseif(startIndex >= totalCount) Y_}DF.>I P
this.startIndex = indexes 9Xu
O\+z
QE.a2
}
[indexes.length - 1]; e uF@SS
elseif(startIndex < 0) }4; \sY
this.startIndex = 0; ft"B,
else{ KH<f=?b
this.startIndex = indexes )$Erfu
tw`{\kWG
[startIndex / pageSize]; lAM"l)Ij
} Of*z9YI
} 3r)<:4a
u&
pErre2fS
publicint getNextIndex(){ c%|18dV
int nextIndex = getStartIndex() + ;LBq!
tyH*epanw
pageSize; {=Y.Z1E:
if(nextIndex >= totalCount) Ny.s
u?E
return getStartIndex(); ^E5[~C*o3
else dh~+0FZ{A
return nextIndex; tWNz:V
} !]W}I
Rr#vv
publicint getPreviousIndex(){ !i|]OnJY
int previousIndex = getStartIndex() - ZS-O,[
5F8sigr/h
pageSize; qx1}e
if(previousIndex < 0) ~t $zypw
return0; 8?L7h\)-
else 1w)#BYc=L
return previousIndex; N*C"+2
} \s.c.c*eh;
u_C/Y[ik
} /uc*V6Xd
(
?E@9Nvr
)_bR"!Z
bUW`MH7yJ
抽象业务类 `[.':"~2N
java代码: 6%K,3R-d
!;YmLJk;hN
PLi [T4u
/** ]#C;)Vy
* Created on 2005-7-12 D3^Yc:[_@
*/ *g}(qjl<
package com.javaeye.common.business; X0=#e54
;OlC^\e
import java.io.Serializable; 2Mc}>UI?eO
import java.util.List; ::\7s
m17H#!`
import org.hibernate.Criteria; {%S>!RA
import org.hibernate.HibernateException; "g)@jqq:>
import org.hibernate.Session; p&nIUx"
import org.hibernate.criterion.DetachedCriteria; g,5r)FU`
import org.hibernate.criterion.Projections; qL6Rs
import yW&|ZJF?
A;t6duBDf/
org.springframework.orm.hibernate3.HibernateCallback; Y5}<7s\UDO
import A=7
[^I2
%|l^oC+E
org.springframework.orm.hibernate3.support.HibernateDaoS S$!)Uc\)A
*}Al0\q0M
upport; g4 BEo'
7/"g}
F}Q
import com.javaeye.common.util.PaginationSupport; !N4?>[E
D&0@k'
public abstract class AbstractManager extends Y7{9C*>
I/ pv0
HibernateDaoSupport { QMGMXa
S
C8r.
privateboolean cacheQueries = false; Z7<N<
;:nO5VFOg
privateString queryCacheRegion; t7rz]EN
}c>[m,lz
publicvoid setCacheQueries(boolean $Ik\^:-
/( /)nYAjk
cacheQueries){ By| y:
this.cacheQueries = cacheQueries; c=U1/=R5
} C F2*W).+
4s?x 8oAy
publicvoid setQueryCacheRegion(String -r9G5Z!|n
yq{k:)
queryCacheRegion){ QGtKu:c.81
this.queryCacheRegion = \:cr2 w'c
#>m#i1Nu
queryCacheRegion; Hq.ys> _
} 26fbBt8nP
r Bv
publicvoid save(finalObject entity){ S!0ocS!t
getHibernateTemplate().save(entity); >&K1+FSmyJ
} x)M=_u2 _
T{1Z(M+
publicvoid persist(finalObject entity){ Mf0XQ3n`H
getHibernateTemplate().save(entity); y{~l&zrl
} ~/hyf] *j
:NL.#!>/
publicvoid update(finalObject entity){ V+/Vk1
getHibernateTemplate().update(entity); T&_!AjH
} CwKo'PAJ
zG_e=
publicvoid delete(finalObject entity){ fL9R{=I%
getHibernateTemplate().delete(entity); '&/"_
} (>THN*i
Sb=cWn P
publicObject load(finalClass entity, Fg8i}
>w
Jsee8^_~
finalSerializable id){ |Uz?i7z
return getHibernateTemplate().load \Uun2.K
\`N%77A
(entity, id); Gld|w=qr
} 7xAzd#
c?=
zi~_[l-
publicObject get(finalClass entity, )NeI]p
VmLV:"P}^
finalSerializable id){ Hcw@24ic
return getHibernateTemplate().get |A_yr/f
Xp<RGp7E
(entity, id); wv>uT{g#
} Z~}=q
=4z:Df
publicList findAll(finalClass entity){ _ukKzY
return getHibernateTemplate().find("from D*d@<&Bl4<
}-H<wQ&x
" + entity.getName()); $QQv$
} `A5^D
V\8vJ3.YV
publicList findByNamedQuery(finalString k>
I;mEV
' bio:1
namedQuery){ HH[b1z2D
return getHibernateTemplate (`}O!;/E}
B mq7w,L.
().findByNamedQuery(namedQuery); " &B/v"nj
} RsJj*REO
y0vo-)E]-]
publicList findByNamedQuery(finalString query, 8UArl3
,5" vzGLJ
finalObject parameter){ *bu/Ko]
return getHibernateTemplate 0Zkb}F2-
CybHr#LBc
().findByNamedQuery(query, parameter); K9co_n_L
} K29]B~0%E
B JDe1W3;'
publicList findByNamedQuery(finalString query,
^|DI9G(Bs
($^XF: #5
finalObject[] parameters){ RG=!,#X
return getHibernateTemplate g+gHIb7{
(q+U5Ls6
().findByNamedQuery(query, parameters); 0eY$K7
U
} LGq}wxq
EJ P##eGx
publicList find(finalString query){ J2_D P
return getHibernateTemplate().find T_CYSS|fX
s$e0;C!D
(query); L 0kK' n?
} !n4p*<Y6
kQXtO)
publicList find(finalString query, finalObject 1P&XG@
3IHya=qN
parameter){ aF4vNUeG
return getHibernateTemplate().find hA)tad]
}YHoWYR
(query, parameter); z5Hz-.
} >IO}}USm
g:MpN^l
public PaginationSupport findPageByCriteria q:.URl
E!J;bX5
(final DetachedCriteria detachedCriteria){ HXF5fs
return findPageByCriteria " FI]l<G&
GkjTE2I3
(detachedCriteria, PaginationSupport.PAGESIZE, 0); v|~ yIywf
} SEQ
bw](ss
8Z%C7
"4O
public PaginationSupport findPageByCriteria v/6QE;BY&Q
S2/c2
(final DetachedCriteria detachedCriteria, finalint +^hFs7je)
| Euf:yWY
startIndex){ M
H }4F
return findPageByCriteria GbG!vo
O`-JKZc
(detachedCriteria, PaginationSupport.PAGESIZE, }~$zdgMT
l= % v
startIndex); E7^r3#s
} lTsl=
S!o!NSn@1
public PaginationSupport findPageByCriteria jE_a++
O$+J{@
(final DetachedCriteria detachedCriteria, finalint ;cIs$
;Ad$Q9)EE
pageSize, hp6S *d
finalint startIndex){ /m%Y.:g
return(PaginationSupport) 1cWUPVQ
D 4^2F(YRX
getHibernateTemplate().execute(new HibernateCallback(){ hh`7b ,+ 4
publicObject doInHibernate W@jBX{k
zZDa71>
(Session session)throws HibernateException { x]6OE]]8L
Criteria criteria = Zuod1;qIh
t>><|~wp
detachedCriteria.getExecutableCriteria(session); tn201TDZ]=
int totalCount = j.X3SQb4G
YuXq
((Integer) criteria.setProjection(Projections.rowCount 'cJHOd
[9NzvC 9I
()).uniqueResult()).intValue(); C0;c'4(
criteria.setProjection zuR!,-W
*KSQ^.sYh
(null); ^'r/;(ZF*/
List items = n\&[^Q#b|
dN
J2pfvv
criteria.setFirstResult(startIndex).setMaxResults h{I)^8,M
BKe~y
(pageSize).list(); &^^zm9{
PaginationSupport ps = *?%DdVrO@
0m_c43+^
new PaginationSupport(items, totalCount, pageSize, I:[^><?E
)xIk#>)
startIndex); 2ku\R7
return ps; + |MHi C
} o7E?A
}, true); 6}A1^RB+w
} 0 3kzS ]g
a=\r~Z7E
public List findAllByCriteria(final OF*m9
GL'zs8AKf
DetachedCriteria detachedCriteria){ yhg^1l|t,
return(List) getHibernateTemplate =dz
iR_
0dA'f0Uy\X
().execute(new HibernateCallback(){ 77"'?
publicObject doInHibernate 5O<7<OB
(gZKR2hO
(Session session)throws HibernateException { }6MHIr=o
Criteria criteria = }$r/#F/Fn
}2;~':Mklz
detachedCriteria.getExecutableCriteria(session); J@w Q3#5a
return criteria.list(); B uV@w-|
} ntE;*FyH
}, true); Zoh[tO
} IGEs1
U~ QIO O
public int getCountByCriteria(final 8R}CvzI
XqMJe'%r
DetachedCriteria detachedCriteria){ &=y)C/u
Integer count = (Integer) deO/`
l -us j%\
getHibernateTemplate().execute(new HibernateCallback(){ -bT1Qh
X
publicObject doInHibernate 7<DlA>(oUX
#-kG\}
(Session session)throws HibernateException { >AI65g
Criteria criteria = 8?AFvua}r
`8xt!8Z$
detachedCriteria.getExecutableCriteria(session); :it52*3=
return ]P;Ng=a
1*<m,.$
criteria.setProjection(Projections.rowCount jh\L)a*
W3K?K-
()).uniqueResult(); Q[J%
} F[mL_JU
}, true); S,,,D+4
return count.intValue(); [=imF^=3Vb
} c.y8 x
} v:kTZB
"b5:6\
A46z2
8%v1[Wi
9`eu&n@Z
F@
lJk|*_
用户在web层构造查询条件detachedCriteria,和可选的
Kk|uN#m
5> M6lwS
startIndex,调用业务bean的相应findByCriteria方法,返回一个 %7WGodlXW
^\:"o
PaginationSupport的实例ps。 BMMWP
}_m/3*x_
ps.getItems()得到已分页好的结果集 0w[#`
ps.getIndexes()得到分页索引的数组 @%mJw
u
ps.getTotalCount()得到总结果数 k!-(Qfz
ps.getStartIndex()当前分页索引 H|&[,&M>
ps.getNextIndex()下一页索引 w4w[qxV>
ps.getPreviousIndex()上一页索引 MBZ/Pzl~
<RQ\nU
#5*|/LD
e7rD,`NiV
jinDKJ,n;
C{7
j<O
<pzCpF<
连续看了两篇robbin有关DetachedCriteria的介绍,感觉真的不错 'o41)p
;#a^M*e
,尤其是上面的示例代码,让我着实觉得该对我原来的分页查询做 8bT]Nv CA
p2Yc:9r9+A
一下代码重构了。 kOi@QLdN
.URCuB\{
我把原本我的做法也提供出来供大家讨论吧: l!z)gto
K]5@bm
首先,为了实现分页查询,我封装了一个Page类: 701ei;
java代码: vhe[:`=a
j?a^fcXB
Q7uhz5oZ
/*Created on 2005-4-14*/ 53>y<
package org.flyware.util.page; x93t.5E6
6@ B_3y
/** 7{0;<@
* @author Joa ?4 p\ujc
* X6hm,0[
*/ ;Ih:$"$!
publicclass Page { PtP{_9%Dz
2Fwp\I;
/** imply if the page has previous page */ NF9fPAF%;
privateboolean hasPrePage; [=f(u
wY>g
O"%b@$p\L
/** imply if the page has next page */ 3QNu7oo
privateboolean hasNextPage; |"t)#BUtL
1>5l(zK!9
/** the number of every page */ 1<
22,
privateint everyPage; IY$v%%2WZ
!h\>[ O
/** the total page number */ ddR*&.Y!a
privateint totalPage; b8Bf,&:ys
=v-qao7xCV
/** the number of current page */ +hoZW R
privateint currentPage; =~qQ?;on
j6Msbq[
/** the begin index of the records by the current e+'PRVc
Xaz`L
query */ v@_^h}h/,=
privateint beginIndex; TU-aL
{0~ Sj%Ze
-L zx3"
/** The default constructor */ V?_:-!NJ(
public Page(){ "e)C.#3
0j@nOj(3
} nw.,`M,N
JI"&3H")g%
/** construct the page by everyPage B4uJT~,7>
* @param everyPage WR5@S&fU`
* */ i\h"N K
public Page(int everyPage){ U;PGBoe
this.everyPage = everyPage; ]x;*Z&
} gfr
y5e
rzl0*CR
/** The whole constructor */ QYS 1.k
public Page(boolean hasPrePage, boolean hasNextPage, NA=I7I@
d3,%Z &
dq6|m
}g{
int everyPage, int totalPage, pUp&eH
int currentPage, int beginIndex){ te<lCD6
this.hasPrePage = hasPrePage; \ytF@"7
this.hasNextPage = hasNextPage; F\K&$5J{p
this.everyPage = everyPage; !@.9>"FU
this.totalPage = totalPage; 5*~]=(BE
this.currentPage = currentPage; cN{(XmX5n
this.beginIndex = beginIndex; ) (4.7>
} E((U=P}+g
goJK~d8M*
/** Xc>M_%+R
* @return VuU{7:
* Returns the beginIndex. %I`%N2ss
*/ ?QbxC,& i
publicint getBeginIndex(){ AlVBhR`
return beginIndex; @N(*1,s2
} NQ9/,M
cN?}s0
/** M15jwR!:M
* @param beginIndex ^9jrI
* The beginIndex to set. <SPT2NyX
*/ b23 5Zm
publicvoid setBeginIndex(int beginIndex){ REK(^1
h
this.beginIndex = beginIndex; 5LYzX+a)
} OV.f+_LS
WP}NHz4H
/** $2><4~T;|A
* @return j0X Jf<
* Returns the currentPage. >>>&{>}!
*/ bF"1M#u:
publicint getCurrentPage(){ &"R`:`XF
return currentPage; N4L#$\M
} UN8]>#\"`
-jPrf:3)
/** $XZC8L#
* @param currentPage NUQ?QQ
* The currentPage to set. 79yF {
*/ '0jjoZ:
publicvoid setCurrentPage(int currentPage){ Cih~cwE
this.currentPage = currentPage; P
{0iEA|k
} wf,B/[,d
TF[8r[93
/** A0A]#=S
* @return LBw$K0
* Returns the everyPage. }w|a^=HAp
*/ -Uj3?W
publicint getEveryPage(){ S^zt>
return everyPage; JNx;/6'd,
} ?c6`p3p3L
zHg1K,t:
/** R2Y.s^
* @param everyPage DKG99biJN
* The everyPage to set. "3Lq/mJYnZ
*/ #Aver]eK
publicvoid setEveryPage(int everyPage){ a0/[L
this.everyPage = everyPage; _@/nc:)H
} aS3Fvk0R{h
"0sk(kT
/** j96\({;k
* @return <fm<UO,%
* Returns the hasNextPage. 5<RZht$i
*/ Er !s\(h
publicboolean getHasNextPage(){ )1ct%rue
return hasNextPage; qi]"`\
} d#>iFD+
|qq7vx
/** 1R"?X'w
* @param hasNextPage D"vl$BX
* The hasNextPage to set. 3qVDHDQ?ZV
*/ _!:*&{
publicvoid setHasNextPage(boolean hasNextPage){ Pq<]`9/w^w
this.hasNextPage = hasNextPage; Wu|ANc
} abw7{%2
ZmKxs^5S
/** '.5_L8
* @return '(-SuaH49
* Returns the hasPrePage. )W0z
*/ w\{oOlE
publicboolean getHasPrePage(){ 56l1&hp8In
return hasPrePage; NzAMX+L
} VPI;{0kh
^E}};CsT
/**
LmjzH@3
* @param hasPrePage rzO5 3\
* The hasPrePage to set. 6JUjT]S%
*/ W*jwf@
0
publicvoid setHasPrePage(boolean hasPrePage){ 4lsg%b6_%,
this.hasPrePage = hasPrePage; UR'P,
} rL3 f%L
M
#)@!
/** .j l|?o
* @return Returns the totalPage. tMOhH
#
* D%,AdR"m
*/ fKQq]&~
H
publicint getTotalPage(){ Q3P*&6wA
return totalPage; >u/ T`$
} ;RW024
N~0~1
WQn
/** N[j*Q 8X_
* @param totalPage '\4 @
* The totalPage to set. 0sGAC
*/ G Z~W#*|V
publicvoid setTotalPage(int totalPage){ {OGv1\ol&
this.totalPage = totalPage; [W,} &
} pdEUDuX
"+k^8ki
} wzNGL{3
SXF~>|h5<
Puodsd
v#`7,::
nAY'1!O i
上面的这个Page类对象只是一个完整的Page描述,接下来我写了一 l
4e`-7
M~"93 Q`f^
个PageUtil,负责对Page对象进行构造: ? ht;ZP
java代码: P(Wr[lH\y
x2@W,?oPm
U%T{~f
/*Created on 2005-4-14*/ bS"zp6Di
package org.flyware.util.page; r?:xD(}Q
PZE{-TM?W
import org.apache.commons.logging.Log; ZT1IN6;8W
import org.apache.commons.logging.LogFactory; 5FQtlB9F
DB>.Uf"
/** alz2F.%Y
* @author Joa e%K
oecq
* n"dYN3dE
*/ H=1Jq
publicclass PageUtil { 5A`T}~"X
V^/]h
u
privatestaticfinal Log logger = LogFactory.getLog h&O8e;S#
2/4,iu(T`c
(PageUtil.class); { 2\.
`;BpdG(m
/** MQ7Hn;`B
* Use the origin page to create a new page lN,)T%[0-
* @param page MB:*WA&
* @param totalRecords *@SZ0
* @return Im<(
*/ d^W1;0
publicstatic Page createPage(Page page, int ,'z=cB`+o
eR*y<K(d
totalRecords){ Aat-938FP6
return createPage(page.getEveryPage(), b@
S.
Z`{ZV5
page.getCurrentPage(), totalRecords); %K7wScz7
} X$(Dem
+#=l{_Z,ZJ
/** $Q'S8TU
* the basic page utils not including exception p|,3X*-ynx
N&K`bmtD
handler w$%1j+%&
* @param everyPage Ks_B%d
* @param currentPage Y}UVC|Ef
* @param totalRecords M,(UCyT
* @return page V<W$h`
*/ nr>Os@\BU
publicstatic Page createPage(int everyPage, int -FrNk>
3,[#%}1(S
currentPage, int totalRecords){ 2B`#c}PP
everyPage = getEveryPage(everyPage); 6&KvT2?tA`
currentPage = getCurrentPage(currentPage); j]5mzz~
int beginIndex = getBeginIndex(everyPage, 1$1[6
\3v
22_%u=p-|
currentPage); hUO&rov3@
int totalPage = getTotalPage(everyPage, +:jx{*}jo
3Lw&HtH
totalRecords); ro`2IE>
boolean hasNextPage = hasNextPage(currentPage, -lDAxp6p
uqFYa bU
totalPage); bz4TbGg]
boolean hasPrePage = hasPrePage(currentPage); {j!+\neL
TeXt'G=M
returnnew Page(hasPrePage, hasNextPage, /lqVMlz\77
everyPage, totalPage, n,vs(ZL:
currentPage, 3rh@|fg)E
6<>T{2b:(p
beginIndex); IwJ4K+
} y3{F\K
##_Jz 5P
privatestaticint getEveryPage(int everyPage){ 6L4<c+v_
return everyPage == 0 ? 10 : everyPage; B?pNF+?'z
} T**v!Ls
<yw(7
privatestaticint getCurrentPage(int currentPage){ K|^'`FpPO
return currentPage == 0 ? 1 : currentPage; /@qnEP%
} 5kbbeO|0G
W<sa6,$
privatestaticint getBeginIndex(int everyPage, int (W'.vEl
iB0#Z_
currentPage){ M*n@djL$\~
return(currentPage - 1) * everyPage; _&xi})E^O]
} lU&[){
KYN{Dh]-}
privatestaticint getTotalPage(int everyPage, int I`-N]sf^
@&fAR2
totalRecords){ ?Q#yf8
int totalPage = 0; (#?k|e"Y"`
%S9YjMR@
if(totalRecords % everyPage == 0) &U7INUL
totalPage = totalRecords / everyPage; PbpnjvVrM
else ^P p2T
totalPage = totalRecords / everyPage + 1 ; S%{^@L+V
|ryV7VJ8
return totalPage; <A+n[h
} W3aFao>!OZ
jS<(Oo
privatestaticboolean hasPrePage(int currentPage){
_ 0g\g~[
return currentPage == 1 ? false : true; q47:kB{d
} .XTR
HL*:
]~!?(d!J/
privatestaticboolean hasNextPage(int currentPage, ).l`N&_peM
PT/TQW
int totalPage){ '2X6>6`w
return currentPage == totalPage || totalPage == :Y)jf
%3;vDB*L$
0 ? false : true; $vjl-1x&
} MIF`|3$,
vA"MTncv
D6L5X/#
} .0]\a~x
6zR9(c:a~
*}<