Hibernate3 提供了DetachedCriteria,使得我们可以在Web层构造 qZ[HILh!
?'f
detachedCriteria,然后调用业务层Bean,进行动态条件查询,根 2C:u)}R7D
qVfn(rZ
据这一功能,我设计了通用的抽象Bean基类和分页类支持,代码来 )N- '~<N
.>TG{>sH
自于Quake Wang的javaeye-core包的相应类,然后又做了很多修改 T\p>wiY2|F
r@r*|50
。 '/UT0{2;rS
uZL,%pF3A
分页支持类: +j F|8
1QA/ !2E
java代码: WynTU?
lbt8S.fx
Jy}~ZY
package com.javaeye.common.util; @a]cI
iP9]b&
import java.util.List; tik*[1it
N{g7
publicclass PaginationSupport { &uE )Vr4 R
)! rD&l$tE
publicfinalstaticint PAGESIZE = 30; 46)[F0,$r
Eu&$Rq}
privateint pageSize = PAGESIZE; T'7>4MT(
6P>Y2xV:
privateList items; p<dw C"z
X1P1
$RdkR
privateint totalCount; 5|eX@?QF58
eSObOG/
privateint[] indexes = newint[0]; ZGH
7_K
->51t
privateint startIndex = 0; 3O*iv{-&
vgtAJp+p*
public PaginationSupport(List items, int mIG>`7`7N
lGp:rw`
totalCount){ r0k:RJP
setPageSize(PAGESIZE); ;8vB7|54.
setTotalCount(totalCount); rN#9p+t$
setItems(items); 7^rT-f07
setStartIndex(0); @6DKw;Q
} Y'P^]Q=}_#
UK^w;w2F
public PaginationSupport(List items, int AX{<d@z`j
H&*&n}vh5y
totalCount, int startIndex){ %jj-\Gz!
setPageSize(PAGESIZE); VWdTnu
setTotalCount(totalCount); #+6j-^<_6
setItems(items); 6w3[PNd
setStartIndex(startIndex); x%$6l
} n@kJ1ee'
W=S^t_F
public PaginationSupport(List items, int *j,noHUT~>
@fo(#i&
totalCount, int pageSize, int startIndex){ q2B'R
setPageSize(pageSize); Q rSO%Rm1*
setTotalCount(totalCount); K\ pZ
setItems(items); 2|exY>`w
setStartIndex(startIndex); .u7grC C
} 2HE<WI^#h
m>[G-~0?kI
publicList getItems(){ j1Sjw6}GCH
return items; 9P
<1/W!
} <uoVGV5N
qS}{O0
publicvoid setItems(List items){ 8EiS\$O-
this.items = items; (Y&gse1}!
} j}@LiH'Q
Qd3ppJn
publicint getPageSize(){ OHngpe4
return pageSize; [UdJ(cGf
} o4rf[.z
0lqh;/
publicvoid setPageSize(int pageSize){ %ID48_>*
this.pageSize = pageSize;
S[8nGH#m
} ij?]fXf:)y
?gK|R
publicint getTotalCount(){ |l|$Q;
return totalCount; 7we='L&R
} n*AN/LBp
[8DPZU@
publicvoid setTotalCount(int totalCount){ LsMq&a-j2
if(totalCount > 0){ b83m'`vRM
this.totalCount = totalCount; aJs! bx>K
int count = totalCount / r5lPO*?Df
$G/p[JG6-
pageSize; dt=M#+g
if(totalCount % pageSize > 0) K[V#Pj9
count++; loyhNT=
indexes = newint[count]; ncR]@8
for(int i = 0; i < count; i++){ {*F8'6YQ$
indexes = pageSize * VB+_ kR6Zv
8X\":l:
i;
y?*Y=,"
} d(D|rf,av
}else{ /dR:\ffz2
this.totalCount = 0; )h%tEY$AJ
} ?O#"x{Pk
} @zsqjm
@# p{,L
publicint[] getIndexes(){ [GW;RjPE
return indexes; \VAS<?3
} k#5Qwxu`
z_$F)*PL
publicvoid setIndexes(int[] indexes){ 3qp\jh=FE
this.indexes = indexes; jpiBHi]5+
} ir;az{T#U
phcYQqR
publicint getStartIndex(){ ML1/1GK*i+
return startIndex;
}K 2fwE
} ^K'XlM`a
[:{HX U7y
publicvoid setStartIndex(int startIndex){ /yO0Z1G
if(totalCount <= 0) q+9c81b
this.startIndex = 0; a7fn{VU8
elseif(startIndex >= totalCount) K3J,f2Cn$
this.startIndex = indexes 5mI}IS|@
t "[2^2G
[indexes.length - 1]; cs Gd}2VE
elseif(startIndex < 0) 8SO(pw9
this.startIndex = 0; /Nd`eUn
else{ ^#z*
this.startIndex = indexes wvEdZGO8!
&>Nw>V
[startIndex / pageSize]; p,S/-ph
} SOJkeN
} {60U6n
B d?{ldg
publicint getNextIndex(){ 5}'W8gV?
int nextIndex = getStartIndex() + z7]GZF
Jw
-3G3h
pageSize; sK|+&BC
if(nextIndex >= totalCount) Uizg.<.
return getStartIndex(); qbD[<T
else +(8Z8]Jf
return nextIndex;
o+FDkqEN
} !s[[X5
o#=O5@>ai
publicint getPreviousIndex(){
N|
int previousIndex = getStartIndex() - 1C<@QrT
Kr@6m80E5
pageSize; 3V0^v
if(previousIndex < 0) ;a~
e
return0; Na$[nv8qh
else Z3z"c
B
return previousIndex; 6[&x7"
} cPPTGpqw
+Z=DvKsTJ
} D Ax1
Q-y`IPtA<
]YKxJ''u
. MH;u3U
抽象业务类 e#z#bz2<
java代码: r5'bt"K\>
(A\\s$fE/1
z--Y
/** 0K^?QM|S
* Created on 2005-7-12 V&J'2Lq
*/
Jju^4
package com.javaeye.common.business; *apkw5B}C
C,VvbB
import java.io.Serializable; ibh,d.*~g
import java.util.List; M^ jEp
Y@2yV(m)o
import org.hibernate.Criteria; *b\&R%6dR
import org.hibernate.HibernateException; 0@kL<\u
import org.hibernate.Session; 8Cw3b\ne
import org.hibernate.criterion.DetachedCriteria; "43F.!P
import org.hibernate.criterion.Projections; my%MXTm2
import 40HhMTZ0-
EjP9/VG@=
org.springframework.orm.hibernate3.HibernateCallback; p;.M.
import Nf)$K'/
y'm5Z-@o6
org.springframework.orm.hibernate3.support.HibernateDaoS V{n7KhN~Y!
zQaD&2 q
upport; Q+ZZwqyxD
#O^%u,mJj
import com.javaeye.common.util.PaginationSupport; eD!mR3Ai@D
>Ft)v
public abstract class AbstractManager extends 40} 7O<9*
2ae"Sd!-2
HibernateDaoSupport { ]D[\l$(
I %|;M%B
privateboolean cacheQueries = false; moL3GV%]Gq
iAZbh"I
privateString queryCacheRegion; @S1Z"%S
~]SCf@pRk
publicvoid setCacheQueries(boolean _RE;}1rb,
G%viWWTY
cacheQueries){ zZ;V9KM>v
this.cacheQueries = cacheQueries; "v/Yw'!
)
} lcK4 Uq\q
ehTv@2b
publicvoid setQueryCacheRegion(String "EwzuM8f
U7HfDDh
queryCacheRegion){ Vllxv6/_
this.queryCacheRegion = /QT>"
ik1asj1
queryCacheRegion; /}9)ZYMx
} D>0(*O
2S-f5&o
publicvoid save(finalObject entity){ Q" r y@
(I
getHibernateTemplate().save(entity); }46Zfg\T6n
} 5=
T$h;O
w |abaMam
publicvoid persist(finalObject entity){ g'cVsO)S
getHibernateTemplate().save(entity); KW$.Yy
} 0#4A0[vV
*Qyu
QF
publicvoid update(finalObject entity){ LXaq
getHibernateTemplate().update(entity); A]ZQ?-L/
} L7R!,
GL~
Wnt
publicvoid delete(finalObject entity){ =J|jCK[r
getHibernateTemplate().delete(entity); }B_?7+
} ~'F.tB
e ?FQ6?
publicObject load(finalClass entity, ?d+ri
+s^nT{B@\
finalSerializable id){ MJkusR/
return getHibernateTemplate().load U({N'y=
Kp^"<%RT
(entity, id); Uz~B`
} #+i:s92],
@ qi|}($
publicObject get(finalClass entity, "U+c`V=w
eK5~YM:o
finalSerializable id){ :,fT^izew
return getHibernateTemplate().get }Xfg~%6
mG$N%`aG
(entity, id); 9yaTDxB>
} p3Ozfk
H4sW%nZ0
publicList findAll(finalClass entity){ D+BiclJ
return getHibernateTemplate().find("from OQ4Pk/-'
$-u c#57
" + entity.getName()); yYSmmgrX0
} 7r^Cs#b+I
bRrSd:e
publicList findByNamedQuery(finalString RyU8{-q
/KNR;n'
namedQuery){ $gN\%X/n"1
return getHibernateTemplate d3
i(UN]
-#mN/
().findByNamedQuery(namedQuery); 4f~sRubK
} a6cU<(WDeh
S=lCzL;j"
publicList findByNamedQuery(finalString query, `"PHhCG+z
MgJ5FRQ
finalObject parameter){ ](v,2(}=
return getHibernateTemplate rk4KAX_[
w\0vP
().findByNamedQuery(query, parameter); UJQTArf
} ^*4#ZvpG2
-G@uB_C s
publicList findByNamedQuery(finalString query, bcjh3WP
%rJDpB{
finalObject[] parameters){ Fx}v.A5
return getHibernateTemplate 4M> pHz4
)/JVp>
().findByNamedQuery(query, parameters); Er|&4-9
} DTuco9yr[
}yn%_KQ0
publicList find(finalString query){ g!'
x5#]n
return getHibernateTemplate().find JP0aNu
.a :7|L#a
(query); a%BC{XX
} \m}a%/
5%(whSKZF
publicList find(finalString query, finalObject DJ7ak>"R
qdwo 2u
parameter){ _Dqi#0#40p
return getHibernateTemplate().find {fDRVnI?
j^8HTa0Cy|
(query, parameter); BTj1C
} 88X]Uw(+
1 oKY7i$
public PaginationSupport findPageByCriteria Oi& 9FS
,1B4FAR&
(final DetachedCriteria detachedCriteria){ xi.?@Lff
return findPageByCriteria 9<y{:{i
Qj1%'wWG
(detachedCriteria, PaginationSupport.PAGESIZE, 0); ROfV Y:,M
} ewN|">WXQ
qGR1$\]
public PaginationSupport findPageByCriteria L\"wz scn
^`dMjeF
(final DetachedCriteria detachedCriteria, finalint z1,#ma}.
*y|w9rp
startIndex){ Ksh[I,+N\
return findPageByCriteria RrrlfF ms
(zy|>u
(detachedCriteria, PaginationSupport.PAGESIZE, 'Kkp!eZQ~
~H?v L c;>
startIndex); s/~pr.>-l
} muF&t'k
jqj}j2
9
public PaginationSupport findPageByCriteria K%BFR,)g
)v+&l9D
(final DetachedCriteria detachedCriteria, finalint rfQs
7S;G
RT'5i$q[
pageSize, g(s}R ?
finalint startIndex){ "30=!k
return(PaginationSupport) $^ir3f+
ak3WER|f#
getHibernateTemplate().execute(new HibernateCallback(){ ^iWGGnGS
publicObject doInHibernate j!Ys/D
Sjwwc6_c
(Session session)throws HibernateException { Gv 8Z
Criteria criteria = j+/EG^*/
gGA5xkA
detachedCriteria.getExecutableCriteria(session); h<?I?ZR0$
int totalCount = L:lnm9<
e*(
_Cvxp
((Integer) criteria.setProjection(Projections.rowCount _3f/lG?&-
em^2\*sxpA
()).uniqueResult()).intValue(); ?H!&4o
criteria.setProjection 5qqU8I
+U<Ae^V
(null); Of-gG~
List items = \B/( H)Cd*
>/@Q7V99{
criteria.setFirstResult(startIndex).setMaxResults >2mY%
*x2u
(pageSize).list(); X88I|Z'HIh
PaginationSupport ps = FEa%wS{
Pff-eT+~m
new PaginationSupport(items, totalCount, pageSize, hiR+cPSF
b_~KtMO
startIndex); &|zV Wl
return ps; J(XK%e[8
} )In;nc
}, true); RhjU^,%
} =`gFwH<
4=* ml}RP
public List findAllByCriteria(final 2@ZuH^qhk
"bO]AG
DetachedCriteria detachedCriteria){ ZhoB/TgdL
return(List) getHibernateTemplate XT==N-5,
!:g\Fe]
().execute(new HibernateCallback(){ Gh'{O/F4*
publicObject doInHibernate FEA/}*2F
,?GAFgK:
(Session session)throws HibernateException { }T=\hM
Criteria criteria = #M[Cq= 2
sD<8-n
detachedCriteria.getExecutableCriteria(session); kRz qgVr%
return criteria.list(); % o0.8qVJi
} ,76nDXy`
}, true); 90$`AMR
} Rmh,P >
{y:+rh&
public int getCountByCriteria(final NsSl|m
R&}{_1dj8
DetachedCriteria detachedCriteria){ N%?8Bm~dP
Integer count = (Integer) gJZ9XLPC
RAEiIf!3
getHibernateTemplate().execute(new HibernateCallback(){ jZ69sDhE
publicObject doInHibernate *_yp]z"
SRk-3 :
(Session session)throws HibernateException { W&a<Q)o*I
Criteria criteria = LZ~$=<
&nF7CCF
detachedCriteria.getExecutableCriteria(session); 3^AS8%qG
return ~E7=c3:"
DfP
vi1
criteria.setProjection(Projections.rowCount u:4?$%rB
8c'E
()).uniqueResult(); /F @a@m|
} 5 %aT
}, true); 5fa_L'L#
return count.intValue(); ?x
&"EhA>
} C0Ti9
} %"RgW\s[R
0bk094
.:s**UiDR
w-MnJ(r
rru `%~'O
.W%{j()op
用户在web层构造查询条件detachedCriteria,和可选的 ^k?Ig.m
Ow]c,F}^
startIndex,调用业务bean的相应findByCriteria方法,返回一个 TXQY&7
"%Eyb\V!
PaginationSupport的实例ps。 3AD^B\<gB
P/FO, S-V
ps.getItems()得到已分页好的结果集 6*2z^P9FRj
ps.getIndexes()得到分页索引的数组 . RNQlh3
ps.getTotalCount()得到总结果数 O-vvFl#4
ps.getStartIndex()当前分页索引 l2!4}zI2
ps.getNextIndex()下一页索引 8V3SZ17
ps.getPreviousIndex()上一页索引 5ff66CRw
b9([)8
n2H2G_-L[
`W[oLQ
UvOB`Vj
pOip$Z
%-:6#bz
连续看了两篇robbin有关DetachedCriteria的介绍,感觉真的不错 NLC}XL
^@`dsll
,尤其是上面的示例代码,让我着实觉得该对我原来的分页查询做 LE!3'^Zq
7@Qz
一下代码重构了。 9oY%v7
4jrY3gyBX
我把原本我的做法也提供出来供大家讨论吧: kf$0}T`
hC8'6h
首先,为了实现分页查询,我封装了一个Page类: P{)eZINlE
java代码: *Oo2rk nQ
7{XI^I:n
qgU$0enSs
/*Created on 2005-4-14*/ / '}O-h
package org.flyware.util.page; #2&_WM!
:\48=>
/** (_E<?
* @author Joa Ssr
P
* dGcG7*EX
*/ B}YB%P_CWs
publicclass Page { )}7rM6hv
$q{-)=-BXQ
/** imply if the page has previous page */ QE$sXP7&u
privateboolean hasPrePage; pVPCxP
<`a!%_LC
[
/** imply if the page has next page */ Rg,pC.7;
privateboolean hasNextPage; 2|Hq[c=~
*^Wx=#w$V
/** the number of every page */ ~(%nnG6x
privateint everyPage; BD9W-mF
Ylll4w62N
/** the total page number */ O[;>Y'zqC%
privateint totalPage; a}+|2k_
O!kBp(?]
/** the number of current page */ *)ZDN~z7o
privateint currentPage; HkD6aJ:kA!
|28z4 .
/** the begin index of the records by the current Q\Fgc ;.U
Pp6(7j
query */ JVFn=Mw
privateint beginIndex; Uoh!1_oV
dmW0SK
lh&Q{t(+8
/** The default constructor */ hdp;/Qz&
public Page(){ #)2'I`_E
lphQZ{8
} J84Q|E
?k]^?7GN
/** construct the page by everyPage )Y+n4UL3NK
* @param everyPage R~iJ5@[
* */ "m.j cKt
public Page(int everyPage){ +ZEj(fd9
this.everyPage = everyPage; UYn5Pix
} >uN{co hs
;tP-#Xf
/** The whole constructor */ a_P8!pk+5
public Page(boolean hasPrePage, boolean hasNextPage, LWuciHfd+
W~z
2Q
so
Cb5;l~}L
int everyPage, int totalPage, fwK5p?Xhm
int currentPage, int beginIndex){ Eq=~S O%
this.hasPrePage = hasPrePage; /-)\$T1d
this.hasNextPage = hasNextPage; \C $LjSS-
this.everyPage = everyPage; L\)ssOuh
this.totalPage = totalPage; $8vZiB!"
this.currentPage = currentPage; sygxV
this.beginIndex = beginIndex; 4t]ccqX*{
} @&p:J0hbp
@k['c
/** e`9d&"
* @return 4u- mE
* Returns the beginIndex. 82l$]W 4
*/ Y S/x;
publicint getBeginIndex(){
A[:0?Ez=
return beginIndex; /j46`F
} U{/d dCf7
vqO d`_)
/** LH/lnrN
* @param beginIndex Cw6\'p%l-\
* The beginIndex to set. 4eH:eCZze
*/ .8Eh[yiln
publicvoid setBeginIndex(int beginIndex){ {\zTE1X9
this.beginIndex = beginIndex; c\A
4-08
} )E9[=4+*C$
\#Md3!MG
/** >NLG"[\
* @return x*>@knP<-
* Returns the currentPage. ?='2@@8;
*/ (D2G.R\pr
publicint getCurrentPage(){ uCkXzb9_z
return currentPage; [$\KS_,Mn
} \LuaI
jW]Q-
/** >b\{y}[
* @param currentPage [B~*88T
* The currentPage to set. /bdL.Y# V
*/ 6%yt"XmT
publicvoid setCurrentPage(int currentPage){ Me;XG?`
this.currentPage = currentPage; Q1kZ+b&
} 9w3KAca
|D*a"*1+A
/** ^^
>j2=
* @return UHyGW$B
* Returns the everyPage. K
HyVI6N[
*/ ,~Y[XazT
publicint getEveryPage(){ g'X{
return everyPage; Ml,~@}
p
} !NqLBrcv 0
pyUzHF0
/** %-?k [DL6
* @param everyPage SfSWjq
* The everyPage to set. ,#Pp_f<
*/ +MR]h
[
publicvoid setEveryPage(int everyPage){ B,V:Qs6"
this.everyPage = everyPage; z`H|]${X
} !LR9}Xon
|@W|nbAfX
/** E]w2
{%
* @return = }ELu@\V[
* Returns the hasNextPage. /np05XhEa
*/ P(oGNKAS
publicboolean getHasNextPage(){ n +v(t
return hasNextPage; x)R1aq
} ?`=
<*{_o
$b U.6
/** y_``-F&Z
* @param hasNextPage V=gu'~
* The hasNextPage to set. G#L6;
*/ &( ZEs c
publicvoid setHasNextPage(boolean hasNextPage){ '7<^x>D|
this.hasNextPage = hasNextPage; \zh`z/=92
} r}:Dg
fn
A(9$!%#+L
/** EG8%X "p
* @return FwE<_hq//
* Returns the hasPrePage. !eHQe7_
*/ ug_c}Nv=Y
publicboolean getHasPrePage(){ e/uLBZ
return hasPrePage; ?7#{#sj
} w7E#mdW
1! j^
/** 2Akh/pb
* @param hasPrePage _Tf
%<E
* The hasPrePage to set. ki'<qa
*/ >]HvXEdNZ|
publicvoid setHasPrePage(boolean hasPrePage){ x*!*2{
this.hasPrePage = hasPrePage; EK Ac>g
} #nQboTB@
CHi
t{
@9
/** G%junS'zt
* @return Returns the totalPage. "yK)9F[9Mo
* _}gfec4o
*/ r]'[qaP
publicint getTotalPage(){ E9 w"?_A)
return totalPage; )8taMC:H^
} [s+FX5' K
hh$i1n
/** qYPgn_
* @param totalPage P_P~c~o
* The totalPage to set. sC ?e%B
*/ 4QE")Ge
publicvoid setTotalPage(int totalPage){ cpPS8V
this.totalPage = totalPage; /eBcPu"[Vb
} QO>)ug+
"^ aSONz
} E*yot[kj
Pz|}[Cx-
l$!Z};mw0E
Odm1;\=Eg+
K#N5S]2yb
上面的这个Page类对象只是一个完整的Page描述,接下来我写了一 s]HJcgI
DB'3h7T
个PageUtil,负责对Page对象进行构造: *CV I@:Q9
java代码: <J]N E|:
iA4VT,
'N&s$XB,
/*Created on 2005-4-14*/ /GA-1cS_(
package org.flyware.util.page; ()fYhk|W
>`n)-8
import org.apache.commons.logging.Log; Va/}|&9
import org.apache.commons.logging.LogFactory; q#0yu"<
tbB.n
/** m;<5QK8f
* @author Joa r3YfY\
* 0
d2to5 (
*/ S+pm@~xe
publicclass PageUtil { O_D;_v6Ii+
3ZAzv en
privatestaticfinal Log logger = LogFactory.getLog =I$:-[(
oTeQY[%$
(PageUtil.class); ?osYs<k \
5?TjuGc
/** E;r~8^9)
* Use the origin page to create a new page 2!a~YT
* @param page 1k)`C<l
* @param totalRecords }
ejc
* @return Ucj>gc=
*/ A:?w1"7gT
publicstatic Page createPage(Page page, int z\<gm$1CB
.a|ROjd!
totalRecords){ d`KW]HJw
return createPage(page.getEveryPage(), s`L>mRw`
+B
OuU#
page.getCurrentPage(), totalRecords); lW@i,1
} \'x?VVw
i^/D_L.
/** %[m%QP1;p
* the basic page utils not including exception t2z@"e
j"<F?k@`Q
handler LYS[qLpf
* @param everyPage I=V]_Ik4N
* @param currentPage wk6tdY{&s
* @param totalRecords J]Qbg7|
* @return page btB> -pT
*/ +|Qe/8Q
publicstatic Page createPage(int everyPage, int >c@1UEwkm
b.v^:M
currentPage, int totalRecords){ s KOy6v
everyPage = getEveryPage(everyPage); 86f/R
c
currentPage = getCurrentPage(currentPage); +tFl
int beginIndex = getBeginIndex(everyPage, >l!DWi6
4 Yl:1rz
currentPage); CFx$r_!~
int totalPage = getTotalPage(everyPage, n5 jzVv
Y&`nB,'
totalRecords); s&WHKCb
boolean hasNextPage = hasNextPage(currentPage, o*|j}hnbv
?1MaA
totalPage); <o\I C?A
boolean hasPrePage = hasPrePage(currentPage); u:&Lf
(cqVCys
returnnew Page(hasPrePage, hasNextPage, fwi(qx1=}
everyPage, totalPage, !`#xFRHe
currentPage, q/yL={H?
[P746b_\e
beginIndex); @I|gA
} =`6_{<&
y2,M9
privatestaticint getEveryPage(int everyPage){ Ta3qEV s
return everyPage == 0 ? 10 : everyPage; Q{+&3KXH
} IXef}%1N?
JA~v:ec
privatestaticint getCurrentPage(int currentPage){ m`Ver:{
return currentPage == 0 ? 1 : currentPage; =%V(n{7=
} vmZyvJSE
?ydqmj2[F
privatestaticint getBeginIndex(int everyPage, int [<M~6]
^5sO;vf
currentPage){ ("B[P/
return(currentPage - 1) * everyPage; 7U\GX
} ?
@Y'_f
Q-}yZ
privatestaticint getTotalPage(int everyPage, int '{?7\+o.x
^xwnX=Np
totalRecords){ G&HCOR!h
int totalPage = 0; zg2}R4h
3,<$z1Jm
if(totalRecords % everyPage == 0) TxD,A0
totalPage = totalRecords / everyPage; 2\p8U#""
else ;L458fYs
totalPage = totalRecords / everyPage + 1 ; `i,l)X]
~S, R`wo
return totalPage; M_wj>NXZ
} LzW8)<N
V6C*d:
privatestaticboolean hasPrePage(int currentPage){ :mwJJIjUW
return currentPage == 1 ? false : true; 5QR=$?K
} ?B"k9+%5ej
0Y81B;/F
privatestaticboolean hasNextPage(int currentPage, ju-tx
:
? %9-5"U[
int totalPage){ J7`fve
return currentPage == totalPage || totalPage == mu[:b
<