From 45a7b7dcd41119272c64276f9972d88b2da42402 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854> Date: Mon, 27 Nov 2023 18:03:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E5=BA=A6=E6=AF=94=E8=B5=9B=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96=2011.27?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AnnualCompController.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcomp/controller/AnnualCompController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcomp/controller/AnnualCompController.java index d25de14f..25e92d21 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcomp/controller/AnnualCompController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcomp/controller/AnnualCompController.java @@ -24,6 +24,7 @@ import org.jeecg.modules.demo.comp.service.ICompService; import org.jetbrains.annotations.NotNull; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -31,6 +32,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -71,7 +73,6 @@ public class AnnualCompController extends JeecgController page = new Page(pageNo, pageSize); // IPage pageList = annualCompService.page(page, queryWrapper); - Subject subject = SecurityUtils.getSubject(); // 获取当前登录用户 LoginUser loginUser = (LoginUser) subject.getPrincipal(); @@ -79,7 +80,7 @@ public class AnnualCompController extends JeecgController queryWrapper1 = new LambdaQueryWrapper<>(); if (StringUtils.isNotBlank(compname)) { queryWrapper1.eq(Comp::getCompName, compname); @@ -88,15 +89,18 @@ public class AnnualCompController extends JeecgController comps = compService.list(queryWrapper1); + Page page = new Page<>(pageNo, pageSize); Page pageInfo = new Page<>(); + if(ObjectUtils.isEmpty(comps)){ + return Result.OK(pageInfo); + } + + Set compIds = comps.stream().map(e -> e.getId()).collect(Collectors.toSet()); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); - if (compId != null) { - queryWrapper.eq(AnnualComp::getCompid, compId); + if (!ObjectUtils.isEmpty(compIds)) { + queryWrapper.in(AnnualComp::getCompid, compIds); } if (annualComp.getAnnualid() != null) { queryWrapper.eq(AnnualComp::getAnnualid, annualComp.getAnnualid());