All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quhaodian.article.data.entity.Article Maven / Gradle / Ivy

The newest version!
package com.quhaodian.article.data.entity;

import com.quhaodian.data.entity.AbstractEntity;
import com.quhaodian.user.data.entity.UserInfo;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * 文章
 *
 * @author 年高
 */
@Entity
@Table(name = "article")
public class Article extends AbstractEntity {

    public static Article fromId(Long id){
        Article result=new Article();
        result.setId(id);
        return result;
    }

    /**
     * 文章分类
     */
    @ManyToOne(fetch = FetchType.LAZY)
    private ArticleCatalog catalog;
    /**
     * 文章评论数量
     */
    private Integer comments;

    /**
     * 喜欢的数量
     */
    private Integer likes;


    /**
     * 文章内容
     */
    private String contents;

    /**
     * 文章扩展信息
     */
    private String exts;


    /**
     * 文章图片集
     */
    private String images;

    /**
     * 封面
     */
    private String img;

    /**
     * 文章介绍
     */
    private String introduction;
    @JoinTable(name = "article_link_tag")
    @ManyToMany
    private Set tags;

    /**
     * 文章标题
     */
    private String title;

    /**
     * 点赞数量
     */
    private Integer ups;

    /**
     * 文章作者
     */
    @ManyToOne(fetch = FetchType.LAZY)
    private UserInfo user;
    /**
     * 文章查看数量
     */
    private Integer views;


    public ArticleCatalog getCatalog() {
        return catalog;
    }

    public void setCatalog(ArticleCatalog catalog) {
        this.catalog = catalog;
    }

    public Integer getComments() {
        if (comments == null) {
            comments = 0;
        }
        return comments;
    }

    public void setComments(Integer comments) {
        this.comments = comments;
    }

    public String getContents() {
        return contents;
    }

    public void setContents(String contents) {
        this.contents = contents;
    }

    public String getExts() {
        return exts;
    }

    public void setExts(String exts) {
        this.exts = exts;
    }

    public String getImages() {
        return images;
    }

    public void setImages(String images) {
        this.images = images;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public Set getTags() {
        if (tags == null) {
            tags = new HashSet();
        }
        return tags;
    }

    public void setTags(Set tags) {
        this.tags = tags;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getUps() {
        if (ups == null) {
            ups = 0;
        }
        return ups;
    }

    public void setUps(Integer ups) {
        this.ups = ups;
    }

    public UserInfo getUser() {
        return user;
    }

    public void setUser(UserInfo user) {
        this.user = user;
    }

    public Integer getViews() {
        return views;
    }

    public void setViews(Integer views) {
        this.views = views;
    }

    @Override
    public String toString() {
        return "Article [catalog=" + catalog + ", user=" + user
                + ", introduction=" + introduction + ", tags=" + tags + ", title=" + title + ", exts=" + exts
                + ", images=" + images + ", ups=" + ups + ", comments=" + comments + ", views=" + views + "]";
    }

    public Integer getLikes() {
        return likes;
    }

    public void setLikes(Integer likes) {
        this.likes = likes;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy