修改新闻页置顶

This commit is contained in:
liuxiao 2024-07-15 16:31:33 +08:00
parent 56b2a3a889
commit c15d6c4468

View File

@ -70,6 +70,13 @@ public class GwSlideshowServiceImpl implements IGwSlideshowService {
public TableDataInfo<GwSlideshowVo> queryPageList(GwSlideshowBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<GwSlideshow> lqw = buildQueryWrapper(bo);
Page<GwSlideshowVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
if (CollUtil.isNotEmpty(result.getRecords())){
List<GwSlideshowVo> records = result.getRecords();
List<GwSlideshowVo> collect = records.stream().filter(ObjectUtil::isNotEmpty).sorted(Comparator.comparing(GwSlideshowVo::getReleaseTime).reversed()).collect(Collectors.toList());
List<GwSlideshowVo> fist = collect.stream().filter(itx -> itx.getIsTop().equals("1")).collect(Collectors.toList());
fist.addAll(collect.stream().filter(itx->!itx.getIsTop().equals("1")).collect(Collectors.toList()));
result.setRecords(fist);
}
return TableDataInfo.build(result);
}