| | |
| | | @ApiOperation(value = "删除平台") |
| | | public ResponseResult<Void> delete(@PathVariable Integer platformId) { |
| | | //平台被引用了没 |
| | | Integer count = referenceMapper.selectCount(new LambdaQueryWrapper<Reference>().eq(Reference::getPlatform_id, platformId)); |
| | | Integer count = Math.toIntExact(referenceMapper.selectCount(new LambdaQueryWrapper<Reference>().eq(Reference::getPlatform_id, platformId))); |
| | | if (count > 0) { |
| | | return ResponseResult.error("该平台被引用中,不能删除"); |
| | | } |
| | |
| | | @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>() |
| | |
| | | ); |
| | | 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()) |
| | |
| | | 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) { |