分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

图片上传后台

发布时间:2023-09-06 02:17责任编辑:苏小强关键词:暂无标签

import request from ‘@/utils/request‘

export function createExpert(data) {
?return request({
???url: ‘/expert‘,
???method: ‘post‘,
???data
?})
}

import java.io.IOException;

import javax.validation.Valid;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import mobi.peihu.domain.Expert;
import mobi.peihu.service.QiniuService;

@Api(value = "expert", description = "the expert API")
@RequestMapping(value = "/api/v1/expert")
public interface ExpertApi {

@ApiOperation(value = "Add a new expert", notes = "", response = Expert.class, tags = {})
@ApiResponses(value = { @ApiResponse(code = 200, message = "Expert created successful", response = Expert.class),
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) })

@RequestMapping(value = "", produces = { "application/json" }, consumes = { "application/json",
"application/x-www-form-urlencoded", "multipart/form-data" }, method = RequestMethod.POST)
Expert addExpert(
@ApiParam(value = "Expert object that needs to be added", required = true) @Valid @RequestBody Expert expert);

}


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpSession;

import java.io.*;
import java.util.UUID;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;

import io.swagger.annotations.ApiParam;
import mobi.peihu.domain.Expert;
import mobi.peihu.repository.ExpertRepository;
import mobi.peihu.service.ExpertService;
import mobi.peihu.service.QiniuService;

@CrossOrigin
@RestController
public class ExpertApiController implements ExpertApi {

@Override
public Expert addExpert(@RequestBody Expert expert) {
// TODO Auto-generated method stub
return expertRepository.save(expert);
}

}

图片上传后台

原文地址:https://www.cnblogs.com/reprint/p/9779354.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved