参数校验
This commit is contained in:
@ -53,7 +53,7 @@ public class UserInfoAddRequest implements Serializable {
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Size(min = 6, max = 10, message = "密码长度在 6 到 10 个字符")
|
||||
@Schema(description = "密码", example = "qingcheng")
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
/**
|
||||
@ -67,7 +67,7 @@ public class UserInfoAddRequest implements Serializable {
|
||||
*/
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "用户角色", example = "USER")
|
||||
private UserRoleEnum userRole;
|
||||
private String userRole;
|
||||
|
||||
/**
|
||||
* 上级用户id
|
||||
@ -78,7 +78,7 @@ public class UserInfoAddRequest implements Serializable {
|
||||
/**
|
||||
* 上级用户列表(1,2,3)
|
||||
*/
|
||||
@Schema(description = "上级用户列表(1,2,3)", example = "1, 2, 3")
|
||||
@Schema(description = "上级用户列表(1,2,3)", example = "1,2,3")
|
||||
private String superUserList;
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class UserInfoLoginRequest implements Serializable {
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Size(min = 6, max = 10, message = "密码长度在 6 到 10 个字符")
|
||||
@Schema(description = "密码", example = "qingcheng")
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.greenorange.promotion.model.dto.user;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
@ -60,7 +62,7 @@ public class UserInfoUpdateRequest implements Serializable {
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Size(min = 6, max = 10, message = "密码长度在 6 到 10 个字符")
|
||||
@Schema(description = "密码", example = "qingcheng")
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
/**
|
||||
@ -72,7 +74,7 @@ public class UserInfoUpdateRequest implements Serializable {
|
||||
/**
|
||||
* 用户角色
|
||||
*/
|
||||
@NotBlank(message = "用户角色不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "用户角色", example = "user")
|
||||
private String userRole;
|
||||
|
||||
@ -85,7 +87,7 @@ public class UserInfoUpdateRequest implements Serializable {
|
||||
/**
|
||||
* 上级用户列表(1,2,3)
|
||||
*/
|
||||
@Schema(description = "上级用户列表(1,2,3)", example = "1, 2, 3")
|
||||
@Schema(description = "上级用户列表(1,2,3)", example = "1,2,3")
|
||||
private String superUserList;
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class UserInfo implements Serializable {
|
||||
private String userAccount;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
* 密码(建议加密存储)
|
||||
*/
|
||||
private String userPassword;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.greenorange.promotion.model.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -39,7 +40,7 @@ public enum UserRoleEnum {
|
||||
* 获取值列表
|
||||
*/
|
||||
public static UserRoleEnum getEnumByValues(String value) {
|
||||
if (ObjectUtils.isEmpty(value)) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
for (UserRoleEnum anEnum : UserRoleEnum.values()) {
|
||||
@ -49,4 +50,6 @@ public enum UserRoleEnum {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.greenorange.promotion.model.vo.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
@ -16,55 +18,63 @@ public class UserInfoVO implements Serializable {
|
||||
/**
|
||||
* 用户表 ID
|
||||
*/
|
||||
@Schema(description = "用户表 ID", example = "1")
|
||||
@Schema(description = "用户ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "${field.example}")
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像URL
|
||||
*/
|
||||
@Schema(description = "用户头像URL", example = "${field.example}")
|
||||
@Schema(description = "用户头像URL", example = "http://xxx.png")
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "${field.example}")
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@Schema(description = "账号", example = "qingcheng")
|
||||
private String userAccount;
|
||||
|
||||
|
||||
/**
|
||||
* 密码(建议加密存储)
|
||||
*/
|
||||
@Schema(description = "密码(建议加密存储)", example = "${field.example}")
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
/**
|
||||
* 邀请码
|
||||
*/
|
||||
@Schema(description = "邀请码", example = "${field.example}")
|
||||
@Schema(description = "邀请码", example = "666999")
|
||||
private String invitationCode;
|
||||
|
||||
/**
|
||||
* 用户角色
|
||||
*/
|
||||
@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;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user