|
@@ -18,6 +18,8 @@ import com.ruoyi.common.utils.file.FileUtils;
|
|
|
import com.ruoyi.framework.config.ServerConfig;
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+
|
|
|
/**
|
|
|
* 通用请求处理
|
|
|
*
|
|
@@ -68,11 +70,15 @@ public class CommonController {
|
|
|
* 通用上传请求
|
|
|
*/
|
|
|
@PostMapping("/common/upload")
|
|
|
- public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
|
|
+ public AjaxResult uploadFile(MultipartFile file,String modName) throws Exception {
|
|
|
try
|
|
|
{
|
|
|
// 上传文件路径
|
|
|
String filePath = RuoYiConfig.getUploadPath();
|
|
|
+ //@TODO 上传添加模块名称 luobo
|
|
|
+ if (StringUtils.isNotEmpty(modName) && !modName.equalsIgnoreCase("null") && !modName.equalsIgnoreCase("undefined")){
|
|
|
+ filePath += "/"+modName;
|
|
|
+ }
|
|
|
// 上传并返回新文件名称
|
|
|
String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
String url = serverConfig.getUrl() + fileName;
|
|
@@ -88,10 +94,14 @@ public class CommonController {
|
|
|
* 图片上传请求
|
|
|
*/
|
|
|
@PostMapping("/common/uploadImg")
|
|
|
- public AjaxResult uploadFile(MultipartHttpServletRequest multiReq) throws Exception {
|
|
|
+ public AjaxResult uploadFile(MultipartHttpServletRequest multiReq,String modName) throws Exception {
|
|
|
try {
|
|
|
// 上传文件路径
|
|
|
String filePath = RuoYiConfig.getUploadPath();
|
|
|
+ //@TODO 上传添加模块名称 luobo
|
|
|
+ if (StringUtils.isNotEmpty(modName) && !modName.equalsIgnoreCase("null") && !modName.equalsIgnoreCase("undefined")){
|
|
|
+ filePath += "/"+modName;
|
|
|
+ }
|
|
|
// 上传并返回新文件名称
|
|
|
String fileName = FileUploadUtils.upload(filePath, multiReq.getFile("img"));
|
|
|
String url = serverConfig.getUrl() + fileName;
|