前後端JSON傳值

後端接口實現

@RequestBody

    @PostMapping({"/question/choice/md5"})
    public ResponseEntity findExercises(@RequestBody @NotEmpty(message = "{exercises.id.NotEmpty.message}") List<String> cmd5s) {
        List<ChoiceQuestion> contentMd5s = service.findAllByContentMd5In(cmd5s);
        List<ChoiceRtnDto> repetitions = contentMd5s
                .stream()
                .map(e -> new ChoiceRtnDto(e.getContentMd5(), e.getTitle(), e.getPid()))
                .collect(Collectors.toList());
        return ResponseEntity.status(HttpStatus.ALREADY_REPORTED).body(repetitions);
    }

POSTMAN測試
操作

操作

發佈了62 篇原創文章 · 獲贊 28 · 訪問量 2117
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章