实体类上的一些注解及其依赖,方便判断

1.@NotNull(message = "有效期不能为空")
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>

2.@JsonFormat(pattern = "yyyy-MM-dd")
<!-- JSON工具类 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

3.@TableName("we_group_code_actual")

<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>

4.
@EqualsAndHashCode(callSuper = true)

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>


这个简单说明一下,和@Data是在一个包下面的,作用在子类上。
callSuper = true 的时候,equals()和hashcode()方法比较的时候比较父类的属性,即调用父类的相关方法。
callSuper = false 的时候,只比较子类的属性
posted @ 2022-10-24 16:50  了悟  阅读(71)  评论(0编辑  收藏  举报