From 0f28c392dc7acc3a1d102bf36365bece17cbc0db Mon Sep 17 00:00:00 2001 From: linfeng <2445465217@qq.com> Date: Wed, 15 Nov 2023 09:55:53 +0800 Subject: [PATCH] =?UTF-8?q?lambda=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/admin/service/impl/AppUserServiceImpl.java | 5 +++-- .../linfeng/modules/admin/service/impl/PostServiceImpl.java | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/linfeng/modules/admin/service/impl/AppUserServiceImpl.java b/src/main/java/io/linfeng/modules/admin/service/impl/AppUserServiceImpl.java index cc6a80a..997c8f5 100644 --- a/src/main/java/io/linfeng/modules/admin/service/impl/AppUserServiceImpl.java +++ b/src/main/java/io/linfeng/modules/admin/service/impl/AppUserServiceImpl.java @@ -83,9 +83,10 @@ public class AppUserServiceImpl extends ServiceImpl i //模糊查询 String key = (String) params.get("key"); if (!ObjectUtil.isEmpty(key)) { - queryWrapper.like("username", key) + queryWrapper.lambda() + .like(AppUserEntity::getUsername, key) .or() - .like("mobile", key); + .like(AppUserEntity::getMobile, key); } queryWrapper.lambda().orderByDesc(AppUserEntity::getUid); IPage page = this.page( diff --git a/src/main/java/io/linfeng/modules/admin/service/impl/PostServiceImpl.java b/src/main/java/io/linfeng/modules/admin/service/impl/PostServiceImpl.java index 8e849a8..2694691 100644 --- a/src/main/java/io/linfeng/modules/admin/service/impl/PostServiceImpl.java +++ b/src/main/java/io/linfeng/modules/admin/service/impl/PostServiceImpl.java @@ -62,10 +62,10 @@ public class PostServiceImpl extends ServiceImpl implements QueryWrapper queryWrapper=new QueryWrapper<>(); String key = (String)params.get("key"); String status = (String)params.get("status"); - queryWrapper - .like(!ObjectUtil.isEmpty(status),"content", key) + queryWrapper.lambda() + .like(!ObjectUtil.isEmpty(status),PostEntity::getContent, key) .or() - .like(!ObjectUtil.isEmpty(status),"title",key); + .like(!ObjectUtil.isEmpty(status),PostEntity::getTitle,key); queryWrapper.lambda().orderByDesc(PostEntity::getId); IPage page = this.page( new Query().getPage(params),