public PageData<SysNotificationEntity> page(NotificationQuery query){ Page<SysNotificationEntity> page = Page.of(query.getPageNum(), query.getPageSize(), query.getCount()); LambdaQueryWrapper<SysNotificationEntity>queryWrapper = new LambdaQueryWrapper<>(); page=this.baseMapper.selectPage(page,queryWrapper); return PageData.of(page); }在原有的基础上按时间排倒序
时间: 2023-05-21 08:02:24 浏览: 107
微信小程序 详解Page中data数据操作和函数调用
5星 · 资源好评率100%
可以在LambdaQueryWrapper中添加orderByDesc方法,按照时间倒序排列,修改后的代码如下:
public PageData<SysNotificationEntity> page(NotificationQuery query){
Page<SysNotificationEntity> page = Page.of(query.getPageNum(), query.getPageSize(), query.getCount());
LambdaQueryWrapper<SysNotificationEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByDesc(SysNotificationEntity::getCreateTime);
page = this.baseMapper.selectPage(page, queryWrapper);
return PageData.of(page);
}
阅读全文