被java的注解恶心到了

一个实体类,总共才几个属性,竟然一多半的代码都是注解。


@ApiModel(value="博客作者对象",description="博客作者对象信息")
@Entity
@JsonIgnoreProperties(value = { "hibernateLazyInitializer" })
public class Author {

    public Author() {
        super();
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @ApiModelProperty(value="用户名",name="username",example="落安")
    private String username;
    @ApiModelProperty(value="年龄",name="age",example="21")
    private int age;

    @ApiModelProperty(value="id数组",hidden=true)
    @JsonIgnoreProperties(value = {"author"})
    @JoinColumn(name = "author_id")
    @OneToMany
    private List<BlogModel> blogs;

    public void setBlogs(List<BlogModel> blogs) {
        this.blogs = blogs;
    }

    public List<BlogModel> getBlogs() {
        return blogs;
    }
    
}
posted @ 2021-08-19 14:31  暖暖De幸福  阅读(144)  评论(0编辑  收藏  举报