Skip to content

Commit

Permalink
fix: nickName、userPhoto 更新校验
Browse files Browse the repository at this point in the history
  • Loading branch information
201206030 committed Dec 28, 2023
1 parent 8a63cff commit c62da9b
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions novel-common/src/main/java/com/java2nb/novel/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,48 @@ public class User {
private Long id;


@NotBlank(groups = {AddGroup.class},message="手机号不能为空!")
@Pattern(groups = {AddGroup.class},regexp="^1[3|4|5|6|7|8|9][0-9]{9}$",message="手机号格式不正确!")
@NotBlank(groups = {AddGroup.class}, message = "手机号不能为空!")
@Pattern(groups = {AddGroup.class}, regexp = "^1[3|4|5|6|7|8|9][0-9]{9}$", message = "手机号格式不正确!")
@Null(groups = {UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String username;

@NotBlank(groups = {AddGroup.class},message="密码不能为空!")
@NotBlank(groups = {AddGroup.class}, message = "密码不能为空!")
@Null(groups = {UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String password;

@Null(groups = {AddGroup.class})
@Pattern(groups = {
UpdateGroup.class}, regexp = "[\u4E00-\u9FA5A-Za-z0-9_]{1,20}", message = "昵称格式不正确!")
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String nickName;

@Null(groups = {AddGroup.class})
@Pattern(groups = {
UpdateGroup.class}, regexp = "^/localPic/\\d{4}/\\d{2}/\\d{2}/[A-Za-z0-9]+\\.(jpg|jpeg|swf|gif|png|JPG|JPEG|SWF|GIF|PNG)$", message = "只能上传图片格式的文件!")
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String userPhoto;

@Null(groups = {AddGroup.class})
@Min(value = 0,groups = {UpdateGroup.class})
@Max(value = 1,groups = {UpdateGroup.class})
@Min(value = 0, groups = {UpdateGroup.class})
@Max(value = 1, groups = {UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte userSex;

@Null(groups = {AddGroup.class,UpdateGroup.class})
@Null(groups = {AddGroup.class, UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long accountBalance;

@Null(groups = {AddGroup.class,UpdateGroup.class})
@Null(groups = {AddGroup.class, UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte status;

@Null(groups = {AddGroup.class,UpdateGroup.class})
@Null(groups = {AddGroup.class, UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;

@Null(groups = {AddGroup.class,UpdateGroup.class})
@Null(groups = {AddGroup.class, UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;

Expand Down

0 comments on commit c62da9b

Please sign in to comment.