From 9f4918cc14064ea625f75dc616c7a1dc07815b42 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期六, 16 五月 2020 18:39:30 +0800
Subject: [PATCH] 修改上级部门(选择项排除本身和下级)
---
ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java b/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java
index 3bb81d0..b59fb29 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java
@@ -9,6 +9,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
+import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
@@ -86,4 +87,23 @@
return AjaxResult.error(e.getMessage());
}
}
+
+ /**
+ * 本地资源通用下载
+ */
+ @GetMapping("/common/download/resource")
+ public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception
+ {
+ // 本地资源路径
+ String localPath = RuoYiConfig.getProfile();
+ // 数据库资源地址
+ String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
+ // 下载名称
+ String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
+ response.setCharacterEncoding("utf-8");
+ response.setContentType("multipart/form-data");
+ response.setHeader("Content-Disposition",
+ "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
+ FileUtils.writeBytes(downloadPath, response.getOutputStream());
+ }
}
--
Gitblit v1.9.2