当前位置:   article > 正文

java-lambda-批量模糊查询_java的ladamda按照模糊搜索

java的ladamda按照模糊搜索
  1. PageHelper.startPage(meetingRoomQuery.getPageNum(), meetingRoomQuery.getPageSize());
  2. LambdaQueryWrapper<MeetingRoomDO> wrapper = new QueryWrapper<MeetingRoomDO>().lambda();
  3. wrapper.like(ObjectUtil.isNotEmpty(meetingRoomQuery.getName()),MeetingRoomDO::getName,meetingRoomQuery.getName());
  4. wrapper.eq(ObjectUtil.isNotEmpty(meetingRoomQuery.getStatus()),MeetingRoomDO::getStatus,meetingRoomQuery.getStatus());
  5. wrapper.eq(ObjectUtil.isNotEmpty(meetingRoomQuery.getIsDeleted()),MeetingRoomDO::getIsDeleted,DeletedFlagEnum.UNDELETE_0.getIsDeleted());
  6. wrapper.orderByDesc(MeetingRoomDO::getCreatedAt);
  7. if(ObjectUtil.isNotEmpty(meetingRoomQuery.getFloorIds())){
  8. List<String> floorId=Arrays.asList(meetingRoomQuery.getFloorIds().split(","));
  9. wrapper.and(obj->{
  10. floorId.stream().filter(v->ObjectUtil.isNotEmpty(v)).collect(Collectors.toList()).forEach(s->{
  11. obj.or(s1->{
  12. s1.like(MeetingRoomDO::getAddress,s);
  13. });
  14. });
  15. });
  16. }
  17. List<MeetingRoomDO> list=this.list(wrapper);
  18. PageUtils page = PageTransformUtil.transform(list);
  19. //if(ObjectUtil.isEmpty(list)) return null;
  20. List<MeetingRoom> meetingRoomList=meetingRoomCover.toDTO(page.getList());
  21. page.setList(meetingRoomList);

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/891831
推荐阅读
相关标签
  

闽ICP备14008679号