import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.enums.IdType; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.Range; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.Date; /** * <p> * 以下注解参数,只针对PO的校验 * * 参考:http://jinnianshilongnian.iteye.com/blog/1733708 * * @NotNull : Collection, Map 和 Array 对象不能是 null, 但可以是空集(size = 0)。 * @NotEmpty : Collection, Map 和 Array 对象不能是 null 并且相关对象的 size 大于 0。 * @NotBlank : 不是 null 且去除两端空白字符后的长度(trimmed length)大于 0。 * * @Null 被注释的元素必须为null * @NotNull 被注释的元素不能为null * @AssertTrue 被注释的元素必须为true * @AssertFalse 被注释的元素必须为false * @Min(value) 被注释的元素必须是一个数字,其值必须大于等于指定的最小值 * @Max(value) 被注释的元素必须是一个数字,其值必须小于等于指定的最大值 * @DecimalMin(value) 被注释的元素必须是一个数字,其值必须大于等于指定的最小值 * @DecimalMax(value) 被注释的元素必须是一个数字,其值必须小于等于指定的最大值 * @Size(max,min) 被注解的元素必须在制定的范围(数据类型:String, Collection, Map and arrays) * @Range(min=, max=) 被注释的元素必须在合适的范围内 (数据:BigDecimal, BigInteger, String, byte, short, int, long and 原始类型的包装类 ) * @Digits(integer,fraction) 被注释的元素必须是一个数字,其值必须在可接受的范围内 * @Past 被注释的元素必须是一个过去的日期 * @Future 被注释的元素必须是一个将来的日期 * @Pattern(value) 被注释的元素必须符合指定的正则表达式。 * @Email 被注释的元素必须是电子邮件地址 * @Length 被注释的字符串的大小必须在指定的范围内 * @NotEmpty 被注释的字符串必须非空 * @Range 被注释的元素必须在合适的范围内 * * @Valid 任何非原子类型,指定递归验证关联的对象;如用户对象中有个地址对象属性,如果想在验证用户对象时一起验证地址对象的话,在地址对象上加@Valid注解即可级联验证 * eg: * 手机号校验:@Pattern(regexp = "^1[3|4|5|7|8][0-9]\\d{4,8}$") * </p> * * * @author beyond * @since 2019-05-07 */ @ApiModel("用户模型-po") @TableName("t_user_base") public class UserBase implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "用户id", example = "1001") @TableId(value = "id", type = IdType.AUTO) private Integer id; @Pattern(regexp = "^[a-zA-Z_]\\w{4,19}$", message = "用户名必须以字母下划线开头,可由字母数字下划线组成") @NotEmpty() @ApiModelProperty(value = "用户昵称", example = "张三") private String userName; @Range(max = 200) @NotNull() @ApiModelProperty(value = "年龄", example = "16") private Integer age; @Email @ApiModelProperty(value = "邮箱|登录帐号", example = "root@gmail.com") private String email; @Pattern(regexp = "^1[3|4|5|6|7|8][0-9]\\d{4,8}$", message = "手机号码输入不合法") @ApiModelProperty(value = "手机号码", example = "15261404040") private String mobile; @Size(min = 6, max = 8) @ApiModelProperty(value = "密码", example = "root") private String password; @ApiModelProperty(value = "创建时间", example = "2018-06-29 09:17:54") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT") private Date createTime; @ApiModelProperty(value = "更新时间", example = "2018-06-29 09:17:54") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT") private Date updateTime; @ApiModelProperty(value = "1|有效,0|无效", example = "0") private Integer status; // @Valid // @NotEmpty(message = "集合不能为空") // private List<UserBase> list ; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } }
相关推荐
Java中 PO VO BO DTO DAO 和 POJO 关系图
Appium使用po实例和封装打包,包含断言、po封装,还有几个例子
自动根据配置文件中的java 自动 转换为 C# po 2.有版本控制功能,工具会自动对比老文件和新文件,会自动添加“修改记录”,版本号自动加1(使用该功能,必须将新文件输出路径和老文件路径一样,否则无法使用) 3.该...
首先 介绍Java的缩写,给一些入门Java的帮助,
Java的几种对象(PO-VO-DAO-BO-POJO)解释
关于selenium+Java+PO模式的讲解。
java(PO,VO,BO,DAO,POJO)Explained Collection 详解
关于VO、PO的理解——java的(PO,VO,TO,BO,DAO,POJO)解释
自测可用,根据已存在的数据库中的表结构,反向生成java po的工具, generator
用于验证 PO 文件的脚本。 安装 $ npm install 用法 $ node po-validate.js POFILE.po 例子 当 po-validator 检测到一些错误时: $ node po-validate.js sample-data/wrong-ja.po Error: Hello, %s! こんに...
java开发使用c3p0连接池技术时。做需要导入的jar包。 此文件中,包含两个jar包。
很好用的连接池很好用的连接池很好用的连接池很好用的连接池很好用的连接池
JAVA的POS打印图像工具类,代码语句有非常详尽的说明,适合做POS打印哟
Appium使用po实例和封装打包,包含断言、po封装,还有几个例子。专栏地址:https://blog.csdn.net/niubitianping/category_6414306.html
J2EE开发人员必须知道 Java Web开发中VO、PO、DTO、POJO代表含义。
java术语(PO/POJO/VO/BO/DAO/DTO)
有以下3种功能: JDBC Connect Test To DB XML Parser Test FTP Connection Test
SAP PO 流程集成平台介绍
PI-PO的SPECPI-PO的SPECPI-PO的SPEC