Compare commits
No commits in common. 'main' and 'master' have entirely different histories.
@ -1,11 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/service/src/main/resources/db/luojia_channel.sql" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/service/src/main/resources/db/luojia_channel.sql" dialect="GenericSQL" />
|
||||
<file url="PROJECT" dialect="MySQL" />
|
||||
</component>
|
||||
</project>
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,7 @@
|
||||
package com.luojia_channel.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MybatisConfig {
|
||||
}
|
@ -1,19 +1,12 @@
|
||||
package com.luojia_channel.common.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
// 统一返回前端的结果
|
||||
@Data
|
||||
@Schema(description = "统一返回前端的结果")
|
||||
public class Result<T> {
|
||||
@Schema(description = "状态码")
|
||||
private int code;
|
||||
|
||||
@Schema(description = "提示消息")
|
||||
private String msg;
|
||||
|
||||
@Schema(description = "响应数据")
|
||||
private T data;
|
||||
public Result(int code, String msg, T data) {
|
||||
this.code = code;
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
artifactId=common
|
||||
groupId=com.luojia
|
||||
version=1.0.0
|
@ -0,0 +1,11 @@
|
||||
com\luojia\luojia_channel\advice\GlobalExceptionHandler.class
|
||||
com\luojia\luojia_channel\domain\UserDTO.class
|
||||
com\luojia\luojia_channel\utils\UserContext.class
|
||||
com\luojia\luojia_channel\utils\JWTUtil.class
|
||||
com\luojia\luojia_channel\config\RedisConfig.class
|
||||
com\luojia\luojia_channel\utils\RedisUtil$ZSetItem.class
|
||||
com\luojia\luojia_channel\domain\UserDTO$UserDTOBuilder.class
|
||||
com\luojia\luojia_channel\exception\BaseException.class
|
||||
com\luojia\luojia_channel\utils\RedisUtil.class
|
||||
com\luojia\luojia_channel\domain\Result.class
|
||||
com\luojia\luojia_channel\exception\UserException.class
|
@ -0,0 +1,9 @@
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\advice\GlobalExceptionHandler.java
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\config\RedisConfig.java
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\domain\Result.java
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\domain\UserDTO.java
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\exception\BaseException.java
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\exception\UserException.java
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\utils\JWTUtil.java
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\utils\RedisUtil.java
|
||||
D:\javaCode\luojia_channel\common\src\main\java\com\luojia\luojia_channel\utils\UserContext.java
|
@ -0,0 +1,32 @@
|
||||
package com.luojia_channel.modules.user.controller;
|
||||
|
||||
import com.luojia_channel.common.domain.Result;
|
||||
import com.luojia_channel.modules.user.dto.UserChangeInfoDTO;
|
||||
import com.luojia_channel.modules.user.service.UserInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/user/info")
|
||||
@RequiredArgsConstructor
|
||||
public class UserInfoController {
|
||||
private final UserInfoService userInfoService;
|
||||
@PostMapping("/update")
|
||||
public Result<Void> updateInfo(@RequestBody UserChangeInfoDTO userChangeInfoDTO){
|
||||
userInfoService.updateInfo(userChangeInfoDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/password")
|
||||
public Result<Void> updatePassword(@RequestParam String password){
|
||||
userInfoService.updatePassword(password);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/avatar")
|
||||
public Result<Void> updateAvatar(@RequestParam MultipartFile file){
|
||||
// TODO 通过oss存储服务或者minio实现头像更新
|
||||
return Result.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.luojia_channel.modules.user.controller;
|
||||
|
||||
import com.luojia_channel.common.domain.Result;
|
||||
import com.luojia_channel.common.domain.UserDTO;
|
||||
import com.luojia_channel.modules.user.dto.UserLoginDTO;
|
||||
import com.luojia_channel.modules.user.dto.UserRegisterDTO;
|
||||
import com.luojia_channel.modules.user.service.UserLoginService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
@RequiredArgsConstructor
|
||||
public class UserLoginController {
|
||||
private final UserLoginService userLoginService;
|
||||
@PostMapping("/login")
|
||||
public Result<UserDTO> login(@RequestBody UserLoginDTO userLoginDTO){
|
||||
return Result.success(userLoginService.login(userLoginDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
public Result<UserDTO> register(@RequestBody UserRegisterDTO userRegisterDTO){
|
||||
return Result.success(userLoginService.register(userRegisterDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public Result<Void> logout(HttpServletRequest request){
|
||||
userLoginService.logout(request);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/hello")
|
||||
public Result<String> hello(){
|
||||
return Result.success("hello");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.luojia_channel.modules.user.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserChangeInfoDTO {
|
||||
private String username;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String email;
|
||||
|
||||
private String studentId;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private Integer gender;
|
||||
|
||||
private String college;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.luojia_channel.modules.user.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserLoginDTO {
|
||||
// 用户标志,支持学号,手机号,邮箱
|
||||
private String userFlag;
|
||||
|
||||
private String password;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.luojia_channel.modules.user.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserRegisterDTO {
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String email;
|
||||
|
||||
private String studentId;
|
||||
}
|
@ -1,16 +1,11 @@
|
||||
package com.luojia_channel.modules.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.luojia_channel.modules.file.dto.UploadFileDTO;
|
||||
import com.luojia_channel.modules.user.dto.UserChangeInfoDTO;
|
||||
import com.luojia_channel.modules.user.entity.User;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface UserInfoService extends IService<User> {
|
||||
|
||||
void updateInfo(UserChangeInfoDTO userChangeInfoDTO);
|
||||
|
||||
void updatePassword(String password);
|
||||
|
||||
String uploadAvatar(MultipartFile file);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
# 本地开发环境
|
||||
lj:
|
||||
db:
|
||||
host: 192.168.59.129
|
||||
password: Forely123!
|
||||
redis:
|
||||
host: 192.168.59.129
|
||||
port: 6379
|
||||
password: Forely123!
|
||||
rabbitmq:
|
||||
host: 192.168.59.129
|
||||
port: 5672
|
||||
username: admin
|
||||
password: Forely123!
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.luojia_channel.modules.user.mapper.UserMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
# 本地开发环境
|
||||
lj:
|
||||
db:
|
||||
host: 192.168.59.129
|
||||
password: Forely123!
|
||||
redis:
|
||||
host: 192.168.59.129
|
||||
port: 6379
|
||||
password: Forely123!
|
||||
rabbitmq:
|
||||
host: 192.168.59.129
|
||||
port: 5672
|
||||
username: admin
|
||||
password: Forely123!
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.luojia_channel.modules.user.mapper.UserMapper">
|
||||
|
||||
</mapper>
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 121 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 MiB |
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue