我指的是设置网格的Instant jqGrid书。 noOfPages属性计算如下。
System.out.println((int)Math.ceil(581/25));//23
我可以看到,对于rowPerPage = 25的581条记录,noOfPages显示为23条。
public class OrderEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="order_id")
private int orderid;
@ManyToOne
@JoinColumn(name="user_id", nullable=false)
private UserEntity user;
@OneToMany(mappedBy="ordersBid",fetch=FetchType.EAGER)
private Set<BidPriceEntity> bidOrders;
}
public class BidPriceEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@ManyToOne
@JoinColumn(name="order_Id",nullable=false)
private OrderEntity ordersBid;
@ManyToOne
@JoinColumn(name="driver_Id",nullable=false)
private UserEntity driver;
@Column(name="bid_price")
private double bidPrice;
}
public class OrderEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="order_id")
private int orderid;
@ManyToOne
@JoinColumn(name="user_id", nullable=false)
private UserEntity user;
@OneToMany(mappedBy="ordersBid",fetch=FetchType.EAGER)
private Set<BidPriceEntity> bidOrders;
}
我期待一个值为24,最后一页包含记录[576-581]。所以在这里,我们缺少这6条记录。
答案 0 :(得分:0)
似乎你使用Java,其中两个整数的ceil给出整数。我建议你看一下this theard
恢复可能的解决方案是:
int n =(int)Math.ceil((double)a / b));
int n = a / b +(a%b == 0)? 0:1;
int n =(a + b - 1)/ b;
选择最符合您需求的