T-baby / MongoDB-Plugin

MongoDB Plugin for Java
Apache License 2.0
239 stars 102 forks source link

MongoPaginate 中的判断条件是不是冲突 #25

Closed LuckyWind2157 closed 8 years ago

LuckyWind2157 commented 8 years ago

count 要是每页的行数的话怎么能大于总数呢,要是结束的行数的话(long) this.page * (long) this.count>totalRow不是一定会为true吗?

if (count > totalRow) {
this.count = (int) totalRow; }

    if (this.count <= 0 || this.page <= 0 || this.page > totalPage || (long) this.page * (long) this.count > totalRow) {
        throw new RuntimeException("MongPage tips: (づ ̄ 3 ̄)づ count or page is error !");
    }