| | |
| | | //查询question的状态 |
| | | //遍历 |
| | | for (Question q : keywordDto.getQuestionList()) { |
| | | if ("success".equals(q.getStatus())) { |
| | | return ResponseResult.error("该提问词已采集"); |
| | | if ("pending".equals(q.getStatus()) || "processing".equals(q.getStatus())) { |
| | | return ResponseResult.error("有提问词在采集中"); |
| | | } |
| | | } |
| | | questionService.updateBatchById(keywordDto.getQuestionList()); |
| | |
| | | @PutMapping("/update") |
| | | @ApiOperation(value = "修改单个提问词") |
| | | public ResponseResult<Void> update(@RequestBody Question questions) { |
| | | |
| | | if ("pending".equals(questions.getStatus()) || "processing".equals(questions.getStatus())) { |
| | | return ResponseResult.error("该提问词在采集中"); |
| | | } |
| | | |
| | | boolean success = questionService.updateById(questions); |
| | | if (success) { |
| | | return ResponseResult.success(); |
| | |
| | | @Transactional |
| | | @ApiOperation(value = "批量删除提问词") |
| | | public ResponseResult<Void> batchDelete(@RequestBody List<Integer> questionIds) { |
| | | List<Question> questions = questionService.listByIds(questionIds); |
| | | for (Question q : questions) { |
| | | if ("pending".equals(q.getStatus()) || "processing".equals(q.getStatus())) { |
| | | return ResponseResult.error("有提问词在采集中"); |
| | | } |
| | | } |
| | | System.out.println(questionIds.toString()); |
| | | questionService.removeByIds(questionIds); |
| | | return ResponseResult.success(); |