From d7b8723479fb54629d5ffb4cede86e0e303cf539 Mon Sep 17 00:00:00 2001 From: linfeng <2445465217@qq.com> Date: Thu, 10 Nov 2022 13:58:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=9F=A5=E8=AF=A2bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/impl/AppUserServiceImpl.java | 5 +++-- .../admin/service/impl/PostServiceImpl.java | 15 +++++++-------- 2 files changed, 10 insertions(+), 10 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 3ab80d0..83cd0c9 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 @@ -80,8 +80,9 @@ public class AppUserServiceImpl extends ServiceImpl i //模糊查询 String key = (String) params.get("key"); if (!ObjectUtil.isEmpty(key)) { - params.put("page", "1");//如果是查询分页重置为第一页 - queryWrapper.like("username", key).or().like("mobile", key); + queryWrapper.like("username", key) + .or() + .like("mobile", 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 663c7f6..d845167 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 @@ -63,14 +63,13 @@ public class PostServiceImpl extends ServiceImpl implements //条件查询 String key = (String)params.get("key"); String status = (String)params.get("status"); - if(!ObjectUtil.isEmpty(key)){ - params.put("page","1");//如果是查询分页重置为第一页 - queryWrapper.like("content", key).or().like("title",key); - } - if(!ObjectUtil.isEmpty(status)){ - params.put("page","1");//如果是查询分页重置为第一页 - queryWrapper.eq("status", Integer.parseInt(status)); - } +// if(!ObjectUtil.isEmpty(key)){ +// queryWrapper.like("content", key).or().like("title",key); +// } + queryWrapper + .like(!ObjectUtil.isEmpty(status),"content", key) + .or() + .like(!ObjectUtil.isEmpty(status),"title",key); queryWrapper.lambda().orderByDesc(PostEntity::getId); IPage page = this.page( new Query().getPage(params),