springboot上传多个文件,以对象接收

springboot上传多个文件,以对象接收,第1张

springboot上传多个文件,以对象接收
package com.test.model.request;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class QuestionRequest {
    private MultipartFile[] files;
    private MultipartFile[] answerFiles;
}
package com.test.controller;

import com.yishu.contest.model.data.Question;
import com.yishu.contest.model.request.QuestionRequest;
import com.yishu.contest.service.QuestionService;

@RestController
@RequestMapping("/question")
public class QuestionController {
    private final QuestionService service;

    public QuestionController(QuestionService service) {
        this.service = service;
    }

    @PostMapping("/save")
    public void save(QuestionRequest questionRequest) {
        service.save(questionRequest);
    }
}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5678402.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存