oracle数据库 分页问题
老师你好 传入分页条件的时候会出现问题
public DataGrid getMailInfoById(MailAddressee addressee, PageBean pageBean) { pageBean = ComUtils.getPage(pageBean); Page<MailAddressee> page = new Page<>(pageBean.getOffset(), pageBean.getLimit()); QueryWrapper<MailAddressee> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("MAIL_ID", addressee.getMailId()).eq("SEND_MAN", addressee.getSendMan()); IPage<MailAddressee> emailPage = mailAddresseeDao.selectPage(page, queryWrapper); List<MailAddressee> records = emailPage.getRecords(); return ComUtils.getDg(records, emailPage.getTotal()); }
上边的代码执行时 sql 语句中分页的条件为 0 和 10 但是实际上我传入的是 offset = 1 和 limit = 10
==> Preparing: SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( SELECT addrid,send_man,addressee,mail_id,sden_status FROM mail_addressee WHERE (MAIL_ID = ? AND SEND_MAN = ?) ) TMP WHERE ROWNUM <=?) WHERE ROW_ID > ?
==> Parameters: D89E07FC516045A7A7A3DDDD9086FE14(String), test(String), 10(Long), 0(Long)
第一页可以获取10条 这个没问题 但是一旦翻到第2页sql语句会变成 传入的分页参数为 offset = 11 和 limit = 20
==> Preparing: SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( SELECT addrid,send_man,addressee,mail_id,sden_status FROM mail_addressee WHERE (MAIL_ID = ? AND SEND_MAN = ?) ) TMP WHERE ROWNUM <=?) WHERE ROW_ID > ?
==> Parameters: D89E07FC516045A7A7A3DDDD9086FE14(String), test(String), 220(Long), 200(Long)
DEBUG跟随查看在queryWrapper创建之后就会改变分页插件的值 请问老师这个怎么解决呢