From 97901204b7ca83ce3b90ab93c4a4a58399103b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B9=85=E5=93=A5?= <787952492@qq.com> Date: Thu, 16 Jun 2022 11:57:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BF=A1=E6=81=AF=E5=92=8C?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=20=E5=80=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/farm/service/logMsg/LogMsgServiceImpl.java | 6 ++++-- .../module/farm/service/project/ProjectServiceImpl.java | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/logMsg/LogMsgServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/logMsg/LogMsgServiceImpl.java index b6cbd637..3e156ed3 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/logMsg/LogMsgServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/logMsg/LogMsgServiceImpl.java @@ -7,6 +7,7 @@ import cn.hutool.system.oshi.CpuInfo; import cn.iocoder.yudao.framework.common.page.PageDTO; import cn.iocoder.yudao.framework.common.page.PageUtil; import cn.iocoder.yudao.framework.common.page.PageVO; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.farm.controller.admin.logMsg.dto.LogMsgDTO; import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; @@ -105,7 +106,9 @@ public class LogMsgServiceImpl implements LogMsgService { public R> logMsgList(PageDTO pageDTO){ PageUtil.startPage(pageDTO); - List list = logMsgMapper.selectList(); + LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX<>(); + queryWrapperX.orderByDesc(LogMsgDO::getId); + List list = logMsgMapper.selectList(queryWrapperX); List dtoList = BeanUtil.copyToList(list, LogMsgDTO.class); @@ -122,7 +125,6 @@ public class LogMsgServiceImpl implements LogMsgService { }); }); - dtoList.forEach(msg ->{ if (map.containsKey(msg.getUserId())){ CpUserDO user = map.get(msg.getUserId()); diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java index d16d8d77..743a5d48 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java @@ -155,7 +155,6 @@ public class ProjectServiceImpl implements ProjectService { } queryWrapperX.eqIfPresent(ProjectDO::getDraft, pageDTO.getDraft()); - if (pageDTO.getDraft()){ //查看自己的草稿 queryWrapperX.eqIfPresent(ProjectDO::getCreator, getLoginUserId()); @@ -166,9 +165,10 @@ public class ProjectServiceImpl implements ProjectService { CpUserDO user = cpUserMapper.selectOne(Wrappers.lambdaQuery().eq(CpUserDO::getUserId, adminUser.getUsername())); if (ObjectUtil.isNotEmpty(user)){ //查看我参与或创建的项目 - queryWrapperX.last(" and (JSON_CONTAINS(members, '"+ user.getId()+"') or creator = " + getLoginUserId() +")") ; + queryWrapperX.last(" and (JSON_CONTAINS(members, '"+ user.getId()+"') or creator = " + getLoginUserId() +") ORDER BY id") ; } - + }else{ + queryWrapperX.orderByDesc(ProjectDO::getId); } List list = projectMapper.selectList(queryWrapperX); @@ -220,7 +220,6 @@ public class ProjectServiceImpl implements ProjectService { } } } - PageVO returnList = PageUtil.convertPageInfo(projectListDTOList); return R.success(returnList); }