From d95fe2f1ffa6b6bd07410abd2108bd2ed8f141c3 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期三, 16 七月 2025 19:56:31 +0800 Subject: [PATCH] bug修改 --- src/main/java/com/linghu/controller/PlatformController.java | 25 ++++++++++++++++++------- 1 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/linghu/controller/PlatformController.java b/src/main/java/com/linghu/controller/PlatformController.java index 2e79fb6..6667430 100644 --- a/src/main/java/com/linghu/controller/PlatformController.java +++ b/src/main/java/com/linghu/controller/PlatformController.java @@ -130,11 +130,15 @@ @RequestParam(value = "type_id",required = false) Integer type_id, @RequestParam(value = "keywordId", required = false) Integer keywordId, @RequestParam(value = "questionId",required = false) Integer questionId, - @RequestParam(value = "isNow") Integer isNow + @RequestParam(value = "isNow",required = false) Integer isNow ) { List<Integer> platForm=new ArrayList<>(); //先查找当前关键词下,所有的回答 的 所有的平台名称 - Keyword keyword = keywordMapper.selectById(keywordId); + Keyword keyword=new Keyword(); + if (keywordId!=null){ + keyword = keywordMapper.selectById(keywordId); + } + if (keywordId != null && questionId == null) { List<Reference> references = referenceMapper.selectList(new LambdaQueryWrapper<Reference>() @@ -143,7 +147,7 @@ ); platForm = references.stream().map(Reference::getPlatform_id).filter(Objects::nonNull).distinct().collect(Collectors.toList()); } - if (questionId != null) { + if (keywordId != null && questionId != null) { List<Reference> references = referenceMapper.selectList(new LambdaQueryWrapper<Reference>() .eq(Reference::getKeyword_id, keywordId) .eq(Reference::getNum, isNow== 0 ? 1 : keyword.getNum()) @@ -157,10 +161,17 @@ if (!platForm.isEmpty()){ queryWrapper.in(Platform::getPlatform_id, platForm); }else { - CustomPage<Platform> customPage = new CustomPage<>(new Page<>()); - customPage.setRecords(new ArrayList<>()); - customPage.setTotal(0); - return ResponseResult.success(customPage); + if (page != null && pageSize != null){ + Page<Platform> pageInfo = new Page<>(page, pageSize); + Page<Platform> result = platformService.page(pageInfo, queryWrapper); + return ResponseResult.success(new CustomPage<>(result)); + }else { + CustomPage<Platform> customPage = new CustomPage<>(new Page<>()); + customPage.setRecords(new ArrayList<>()); + customPage.setTotal(0); + return ResponseResult.success(customPage); + } + } if (type_id != null) { -- Gitblit v1.7.1