提交 475f27a2 编写于 作者: M megagao

添加了文件

上级 c09cf41a
package org.hqu.production_ms.controller;
import java.util.HashMap;
import java.util.Map;
import org.hqu.production_ms.service.PictureService;
import org.hqu.production_ms.util.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
/**
*
* created on 2016年9月27日
*
* 上传图片处理
*
* @author megagao
* @version 0.0.1
*/
@Controller
public class PictureController {
@Autowired
private PictureService pictureService;
@RequestMapping("/pic/upload")
@ResponseBody
public String pictureUpload(MultipartFile uploadFile) {
@SuppressWarnings("unchecked")
Map<String,Object> result = pictureService.uploadPicture(uploadFile);
//为了保证功能的兼容性,需要把Result转换成json格式的字符串。
String json = JsonUtils.objectToJson(result);
return json;
}
@RequestMapping("/pic/delete")
@ResponseBody
public String pictureDelete(@RequestParam String picName) {
pictureService.deleteFile(picName);
Map<String,Object> result = new HashMap<String,Object>();
result.put("data", "success");
String json = JsonUtils.objectToJson(result);
return json;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册