参数校验
This commit is contained in:
parent
e30312c743
commit
cd0c3a99e9
|
@ -29,6 +29,7 @@ import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.greenorange.promotion.model.dto;
|
package com.greenorange.promotion.model.dto;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
@ -12,7 +13,8 @@ import java.util.List;
|
||||||
public class CommonBatchRequest implements Serializable {
|
public class CommonBatchRequest implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "id列表", example = "[8, 9, 17]")
|
@NotEmpty(message = "id列表不能为空")
|
||||||
|
@Schema(description = "id列表", example = "[1, 2, 3]")
|
||||||
private List<Long> ids;
|
private List<Long> ids;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.greenorange.promotion.model.dto;
|
package com.greenorange.promotion.model.dto;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
@ -13,7 +15,8 @@ public class CommonRequest implements Serializable {
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@Schema(description = "id", example = "2")
|
@NotNull(message = "id不能为null")
|
||||||
|
@Schema(description = "id", example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.greenorange.promotion.model.dto;
|
package com.greenorange.promotion.model.dto;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
@ -14,6 +15,7 @@ public class CommonStringRequest implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 字符串
|
* 字符串
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "字符串不能为空")
|
||||||
@Schema(description = "String", example = "templateString")
|
@Schema(description = "String", example = "templateString")
|
||||||
private String templateString;
|
private String templateString;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.greenorange.promotion.model.dto.user;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
|
@ -17,14 +17,14 @@ public class UserInfoLoginRequest implements Serializable {
|
||||||
* 账号
|
* 账号
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "账号不能为空")
|
@NotBlank(message = "账号不能为空")
|
||||||
@Schema(description = "账号", example = "${field.example}")
|
@Schema(description = "账号", example = "qingcheng_account")
|
||||||
private String userAccount;
|
private String userAccount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码
|
* 密码
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "密码不能为空")
|
@NotBlank(message = "密码不能为空")
|
||||||
@Schema(description = "密码", example = "${field.example}")
|
@Schema(description = "密码", example = "qingcheng_password")
|
||||||
private String userPassword;
|
private String userPassword;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class UserInfoQueryRequest extends PageRequest implements Serializable {
|
||||||
* 手机号
|
* 手机号
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "手机号不能为空")
|
@NotBlank(message = "手机号不能为空")
|
||||||
@Schema(description = "手机号", example = "${field.example}")
|
@Schema(description = "手机号", example = "15888610253")
|
||||||
private String phoneNumber;
|
private String phoneNumber;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户基本信息表
|
* 用户基本信息表
|
||||||
* @TableName user_info
|
* @TableName user_info
|
||||||
|
|
Loading…
Reference in New Issue
Block a user