查询分页失败

来源:4-2 分页查询

weixin_慕沐0534232

2021-12-10 00:09

@Test
public void selectPage() {
    QueryWrapper<RtkHistory> queryWrapper = new QueryWrapper<RtkHistory>();
    queryWrapper.apply("date_format(create_time,'%Y-%m-%d')= {0}" ,"2021-12-09")
            .and(i ->i.eq("name","温湿度")).and(i ->i.eq("name2","temp ="));

    Page<RtkHistory> Page = new Page<RtkHistory>(1, 5);
    Page<RtkHistory> iPage = rtkHistoryMapper.selectPage(Page, queryWrapper);
    System.out.println("总页数:" +iPage.getPages());
    System.out.println("总记录数:" +iPage.getTotal());
    List<RtkHistory> historyList = iPage.getRecords();
    for (RtkHistory rtkHistory : historyList) {
        System.out.println(rtkHistory);
    }

''TRACE<==        Row: 4356, 117, 温湿度, 16.7, 2021-12-09 21:16:30

''TRACE<==        Row: 4367, 117, 温湿度, 16.7, 2021-12-09 21:17:10

''DEBUG<==      Total: 222

'总页数:0

总记录数:0

RtkHistory(id=1969, pid=117, name=温湿度, body=16.3, createTime=2021-12-09T14:35:01)

RtkHistory(id=1979, pid=117, name=温湿度, body=15.2, createTime=2021-12-09T14:35:41)

RtkHistory(id=1990, pid=117, name=温湿度, body=15.2, createTime=2021-12-09T14:36:21)

RtkHistory(id=2001, pid=117, name=温湿度, body=15.2, createTime=2021-12-09T14:37:01)

RtkHistory(id=2012, pid=117, name=温湿度, body=15.3, createTime=2021-12-09T14:37:41)

RtkHistory(id=2023, pid=117, name=温湿度, body=15.3, createTime=2021-12-09T14:38:21)

RtkHistory(id=2034, pid=117, name=温湿度, body=15.3, createTime=2021-12-09T14:39:01)


写回答 关注

1回答

MyBatis-Plus入门

MyBatis-Plus框架入门必学课程!

56140 学习 · 381 问题

查看课程

相似问题