guyue
2025-09-05 e4451cbe7eea81c397353e8d5649e52dcbd3b7d1
平台筛选
2个文件已修改
31 ■■■■■ 已修改文件
src/main/java/com/linghu/controller/PlatformController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/linghu/service/impl/PlatformServiceImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/linghu/controller/PlatformController.java
@@ -94,7 +94,7 @@
    }
    @GetMapping("/list")
    @ApiOperation("查询平台列表,不传页数和大小就查全部")
    @ApiOperation("查询平台列表")
    public ResponseResult<CustomPage<Platform>> list(
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "pageSize",required = false) Integer pageSize,
src/main/java/com/linghu/service/impl/PlatformServiceImpl.java
@@ -124,13 +124,20 @@
        // 构建查询条件并添加排序(按创建时间倒序)
        LambdaQueryWrapper<Platform> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(Platform::getCreate_time); // 新增的排序条件
        if (!platForm.isEmpty()){
            queryWrapper.in(Platform::getPlatform_id, platForm);
        }else {
            if (page != null && pageSize != null){
        }
        if (page != null && pageSize != null && type_id == null){
                Page<Platform> pageInfo = new Page<>(page, pageSize);
                Page<Platform> result = this.page(pageInfo, queryWrapper);
                return ResponseResult.success(new CustomPage<>(result));
        } else if (page != null && pageSize != null && type_id != null) {
            Page<Platform> pageInfo = new Page<>(page, pageSize);
            queryWrapper.eq(Platform::getType_id, type_id);
            Page<Platform> result = this.page(pageInfo, queryWrapper);
            return ResponseResult.success(new CustomPage<>(result));
            }else {
                CustomPage<Platform> customPage = new CustomPage<>(new Page<>());
                customPage.setRecords(new ArrayList<>());
@@ -138,23 +145,9 @@
                return ResponseResult.success(customPage);
            }
        }
        if (type_id != null) {
            queryWrapper.eq(Platform::getType_id, type_id);
        }
        queryWrapper.orderByDesc(Platform::getCreate_time); // 新增的排序条件
        if (page != null && pageSize != null) {
            Page<Platform> pageInfo = new Page<>(page, pageSize);
            Page<Platform> result = this.page(pageInfo, queryWrapper);
            return ResponseResult.success(new CustomPage<>(result));
        } else {
            List<Platform> list = this.list(queryWrapper);
            CustomPage<Platform> customPage = new CustomPage<>(new Page<>());
            customPage.setRecords(list);
            customPage.setTotal(list.size());
            return ResponseResult.success(customPage);
        }
    }
    @Override