🔨 Refactor: [后台]:开始头像上传
This commit is contained in:
parent
05d07e49a6
commit
4a063ec343
@ -8,6 +8,7 @@ import com.fanxb.bookmark.common.util.UserContextHolder;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类功能简述:
|
* 类功能简述:
|
||||||
@ -63,6 +64,17 @@ public class UserController {
|
|||||||
return Result.success(userService.getUserInfo(UserContextHolder.get().getUserId()));
|
return Result.success(userService.getUserInfo(UserContextHolder.get().getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户头像
|
||||||
|
*
|
||||||
|
* @param file 头像文件
|
||||||
|
*/
|
||||||
|
@PostMapping("/icon")
|
||||||
|
public Result pushIcon(@RequestParam("file") MultipartFile file) {
|
||||||
|
return Result.success(userService.updateIcon(file));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: 用户登录
|
* Description: 用户登录
|
||||||
*
|
*
|
||||||
|
@ -11,6 +11,7 @@ import com.fanxb.bookmark.common.exception.FormDataException;
|
|||||||
import com.fanxb.bookmark.common.util.*;
|
import com.fanxb.bookmark.common.util.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -155,4 +156,13 @@ public class UserService {
|
|||||||
public User getUserInfo(int userId) {
|
public User getUserInfo(int userId) {
|
||||||
return userDao.selectByUserId(userId);
|
return userDao.selectByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户头像
|
||||||
|
* @param file file
|
||||||
|
* @return 修改后的路径
|
||||||
|
*/
|
||||||
|
public String updateIcon(MultipartFile file){
|
||||||
|
return "asdf";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fanxb</groupId>
<artifactId>bookMarkService</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>common</module>
<module>business</module>
<module>web</module>
</modules>
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
<java.version>11</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/>
</parent>
<dependencyManagement>
<dependencies>
<!--定义es版本号,因为spring-boot-start-parent中引入了es的依赖,会导致es的版本问题,无法正常使用high-level-client-->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.2.0</version>
</dependency>
<!--<!– https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-client –>-->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>7.2.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fanxb</groupId>
<artifactId>bookMarkService</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>common</module>
<module>business</module>
<module>web</module>
</modules>
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
<java.version>8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/>
</parent>
<dependencyManagement>
<dependencies>
<!--定义es版本号,因为spring-boot-start-parent中引入了es的依赖,会导致es的版本问题,无法正常使用high-level-client-->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.2.0</version>
</dependency>
<!--<!– https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-client –>-->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>7.2.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
|
@ -66,3 +66,6 @@ es:
|
|||||||
host: localhost
|
host: localhost
|
||||||
port: 9200
|
port: 9200
|
||||||
scheme: http
|
scheme: http
|
||||||
|
|
||||||
|
# 默认文件上传基路径
|
||||||
|
fileSavePath: ./
|
||||||
|
Loading…
x
Reference in New Issue
Block a user