| | |
| | | import com.linghu.model.entity.Reference; |
| | | import com.linghu.model.excel.KeywordExcel; |
| | | import com.linghu.model.excel.QuestionExcel; |
| | | import com.linghu.model.validator.CreateGroup; |
| | | import com.linghu.model.validator.UpdateGroup; |
| | | import com.linghu.service.KeywordService; |
| | | import com.linghu.service.QuestionService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "添加提问词") |
| | | public ResponseResult<List<Question>> add(@Valid @RequestBody KeywordDto keywordDto) { |
| | | public ResponseResult<List<Question>> add(@Validated(CreateGroup.class) @RequestBody KeywordDto keywordDto) { |
| | | return questionService.addQuestion(keywordDto); |
| | | } |
| | | |
| | |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "修改提问词") |
| | | public ResponseResult<List<Question>> update(@RequestBody KeywordDto keywordDto) { |
| | | public ResponseResult<List<Question>> update(@Validated(UpdateGroup.class) @RequestBody KeywordDto keywordDto) { |
| | | return questionService.updateQuestion(keywordDto); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @ApiOperation(value = "修改单个提问词") |
| | | public ResponseResult<Void> update(@RequestBody Question questions) { |
| | | public ResponseResult<Void> update(@Validated(UpdateGroup.class) @RequestBody Question questions) { |
| | | return questionService.updateKeyWord(questions); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/batch") |
| | | @ApiOperation(value = "批量删除提问词") |
| | | public ResponseResult<Void> batchDelete(@RequestBody List<Integer> questionIds) { |
| | | public ResponseResult<Void> batchDelete( @RequestBody List<Integer> questionIds) { |
| | | return questionService.batchDeleteQuestion(questionIds); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation("根据关键词查询提问词列表") |
| | | public ResponseResult<List<Question>> list(Integer keyword_id) { |
| | | public ResponseResult<List<Question>> list(@RequestParam("keyword_id") Integer keyword_id) { |
| | | return questionService.getQuestionListByKeywordId(keyword_id); |
| | | |
| | | } |
| | |
| | | |
| | | @GetMapping("/notNullList") |
| | | @ApiOperation("根据关键词查询提问词列表") |
| | | public ResponseResult<List<Question>> notNullList(Integer keyword_id) { |
| | | public ResponseResult<List<Question>> notNullList(@RequestParam("keyword_id") Integer keyword_id) { |
| | | return questionService.notNullQuestionList(keyword_id); |
| | | |
| | | } |