完成了Web端用户登录和退出登录的功能
This commit is contained in:
parent
a768e1ff55
commit
f36e4a38a8
11
pom.xml
11
pom.xml
|
@ -62,6 +62,15 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
|
@ -116,7 +125,7 @@
|
|||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Gson-->
|
||||
<!-- Gson -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.greenorange.promotion.controller.user;
|
|||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.net.HttpHeaders;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
|
@ -23,17 +22,15 @@ import com.greenorange.promotion.service.common.CommonService;
|
|||
import com.greenorange.promotion.service.user.UserInfoService;
|
||||
import com.greenorange.promotion.utils.JWTUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -109,13 +106,14 @@ public class UserInfoController {
|
|||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加用户表", description = "参数:用户表添加请求体,权限:管理员(boss, admin),方法名:addUserInfo")
|
||||
public BaseResponse<Boolean> addUserInfo(@RequestBody @Valid UserInfoAddRequest userInfoAddRequest) {
|
||||
public BaseResponse<Boolean> addUserInfo(@Valid @RequestBody UserInfoAddRequest userInfoAddRequest) {
|
||||
UserInfo userInfo = commonService.copyProperties(userInfoAddRequest, UserInfo.class);
|
||||
userInfoService.save(userInfo);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员更新用户表
|
||||
* @param userInfoUpdateRequest 用户表更新请求体
|
||||
|
@ -123,7 +121,7 @@ public class UserInfoController {
|
|||
*/
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员更新用户表", description = "参数:用户表更新请求体,权限:管理员(boss, admin),方法名:updateUserInfo")
|
||||
public BaseResponse<Boolean> updateUserInfo(@RequestBody @Valid UserInfoUpdateRequest userInfoUpdateRequest) {
|
||||
public BaseResponse<Boolean> updateUserInfo(@RequestBody UserInfoUpdateRequest userInfoUpdateRequest) {
|
||||
ThrowUtils.throwIf(userInfoUpdateRequest == null || userInfoUpdateRequest.getId() <= 0, ErrorCode.PARAMS_ERROR);
|
||||
UserInfo userInfo = commonService.copyProperties(userInfoUpdateRequest, UserInfo.class);
|
||||
userInfoService.updateById(userInfo);
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package com.greenorange.promotion.model.dto.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@ -19,59 +18,60 @@ public class UserInfoAddRequest implements Serializable {
|
|||
* 用户昵称
|
||||
*/
|
||||
@NotBlank(message = "参数不能为空")
|
||||
@Schema(description = "用户昵称", example = "${field.example}")
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像URL
|
||||
*/
|
||||
@Schema(description = "用户头像URL", example = "${field.example}")
|
||||
@NotBlank(message = "参数不能为空")
|
||||
@Schema(description = "用户头像URL", example = "http://xxx.png")
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@NotBlank(message = "参数不能为空")
|
||||
@Schema(description = "手机号", example = "${field.example}")
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@NotBlank(message = "参数不能为空")
|
||||
@Schema(description = "账号", example = "${field.example}")
|
||||
@Schema(description = "账号", example = "qingcheng_account")
|
||||
private String userAccount;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@NotBlank(message = "参数不能为空")
|
||||
@Schema(description = "密码", example = "${field.example}")
|
||||
@Schema(description = "密码", example = "qingcheng_password")
|
||||
private String userPassword;
|
||||
|
||||
/**
|
||||
* 邀请码
|
||||
*/
|
||||
@Schema(description = "邀请码", example = "${field.example}")
|
||||
@Schema(description = "邀请码", example = "666999")
|
||||
private String invitationCode;
|
||||
|
||||
/**
|
||||
* 用户角色
|
||||
*/
|
||||
@NotBlank(message = "参数不能为空")
|
||||
@Schema(description = "用户角色", example = "${field.example}")
|
||||
@Schema(description = "用户角色", example = "user")
|
||||
private String userRole;
|
||||
|
||||
/**
|
||||
* 上级用户id
|
||||
*/
|
||||
@Schema(description = "上级用户id", example = "${field.example}")
|
||||
@Schema(description = "上级用户id", example = "1")
|
||||
private Long parentUserId;
|
||||
|
||||
/**
|
||||
* 上级用户列表(1,2,3)
|
||||
*/
|
||||
@Schema(description = "上级用户列表(1,2,3)", example = "${field.example}")
|
||||
@Schema(description = "上级用户列表(1,2,3)", example = "1, 2, 3")
|
||||
private String superUserList;
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 用户基本信息表
|
||||
* @TableName user_info
|
||||
|
|
|
@ -10,7 +10,6 @@ spring:
|
|||
|
||||
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
|
|
Loading…
Reference in New Issue
Block a user