文件保存地址

This commit is contained in:
裴浩宇 2021-01-08 09:10:15 +08:00
parent 9e91d986e2
commit 70b7f60905
4 changed files with 10 additions and 9 deletions

View File

@ -483,6 +483,9 @@ public class HSController {
*/ */
@RequestMapping("/showImg/{fileName}") @RequestMapping("/showImg/{fileName}")
private void responPhoto(HttpServletResponse response, @PathVariable(value = "fileName") String fileName) throws IOException { private void responPhoto(HttpServletResponse response, @PathVariable(value = "fileName") String fileName) throws IOException {
//Linux环境下的路径
// String filePath = filesPath + "/" + fileName;
//Window环境下的路径
String filePath = filesPath + "\\" + fileName; String filePath = filesPath + "\\" + fileName;
File imageFile = new File(filePath); File imageFile = new File(filePath);
if (imageFile.exists()) { if (imageFile.exists()) {

View File

@ -203,6 +203,9 @@ public class AdminHSServiceImpl implements AdminHSService {
@Override @Override
public Map<String, Object> deleteRotationPhoto(Map<String, Object> param) { public Map<String, Object> deleteRotationPhoto(Map<String, Object> param) {
int res = 0; int res = 0;
//Linux环境下的路径
// File file = new File(filesPath + "/" + param.get("fileEncryption"));
//Window环境下的路径
File file = new File(filesPath + "\\" + param.get("fileEncryption")); File file = new File(filesPath + "\\" + param.get("fileEncryption"));
// 路径为文件且不为空则进行删除 // 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) { if (file.isFile() && file.exists()) {

View File

@ -1,8 +0,0 @@
{
"properties": [
{
"name": "filePath",
"type": "java.lang.String",
"description": "Description for filePath."
}
] }

View File

@ -21,4 +21,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
##文件保存路径 ##文件保存路径
filePath: ${user.dir}\src\main\static\files # Linux环境下
filePath: /usr/local/src/phy/file
# Window环境下
#filePath: ${user.dir}\src\main\static\files