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());