记录一下实体类模型(Entity)的常用注解
1. @Data ,lombok注解
@Data 注解的主要作用是提高代码的简洁,使用这个注解可以省去代码中大量的get()、 set()、 toString()等方法;
2. @TableName ,MybatisPlus注解
@TableName注解主要是实现实体类型和数据库中的表实现映射。如: @TableName("tenant_role")
3. @Accessors ,lombok注解
①@Accessors(chain = true):chain的中文含义是链式的,设置为true,则setter方法返回当前对象 ②@Accessors(fluent = true) 与chain=true类似,区别在于getter和setter不带set和get前缀。 ③@Accessors(prefix = "f") set方法忽略指定的前缀。不推荐大神们这样去命名。
4.@EqualsAndHashCode(callSuper = false)
自动的给bean实现equals方法和hashcode方法。
5.@ApiModel , swagger注解
在实体类上边使用,标记类时swagger的解析类 如: @ApiModel(value = "tenant_role对象", description = "tenant_role")
