java-blog

Blog

@Entity
@Table(name = “t_blog”)
public class Blog {

@Id
@GeneratedValue
private Long id;private String title;@Basic(fetch = FetchType.LAZY)
@Lob
private String content;
private String firstPicture;
private String flag;
private Integer views;
private boolean appreciation;
private boolean shareStatement;
private boolean commentabled;
private boolean published;
private boolean recommend;
@Temporal(TemporalType.TIMESTAMP)
private Date createTime;
@Temporal(TemporalType.TIMESTAMP)
private Date updateTime;@ManyToOne
private Type type;@ManyToMany(cascade = {CascadeType.PERSIST})
private List tags = new ArrayList<>();@ManyToOne
private User user;@OneToMany(mappedBy = "blog")
private List comments = new ArrayList<>();@Transient
private String tagIds;private String description;public Blog() {
}public Long getId() {return id;
}public void setId(Long id) {this.id = id;
}public String getTitle() {return title;
}public void setTitle(String title) {this.title = title;
}public String getContent() {return content;
}public void setContent(String content) {this.content = content;
}public String getFirstPicture() {return firstPicture;
}public void setFirstPicture(String firstPicture) {this.firstPicture = firstPicture;
}public String getFlag() {return flag;
}public void setFlag(String flag) {this.flag = flag;
}public Integer getViews() {return views;
}public void setViews(Integer views) {this.views = views;
}public boolean isAppreciation() {return appreciation;
}public void setAppreciation(boolean appreciation) {this.appreciation = appreciation;
}public boolean isShareStatement() {return shareStatement;
}public void setShareStatement(boolean shareStatement) {this.shareStatement = shareStatement;
}public boolean isCommentabled() {return commentabled;
}public void setCommentabled(boolean commentabled) {this.commentabled = commentabled;
}public boolean isPublished() {return published;
}public void setPublished(boolean published) {this.published = published;
}public boolean isRecommend() {return recommend;
}public void setRecommend(boolean recommend) {this.recommend = recommend;
}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 Type getType() {return type;
}public void setType(Type type) {this.type = type;
}public List getTags() {return tags;
}public void setTags(List tags) {this.tags = tags;
}public User getUser() {return user;
}public void setUser(User user) {this.user = user;
}public List getComments() {return comments;
}public void setComments(List comments) {this.comments = comments;
}public String getTagIds() {return tagIds;
}public void setTagIds(String tagIds) {this.tagIds = tagIds;
}public String getDescription() {return description;
}public void setDescription(String description) {this.description = description;
}public void init() {this.tagIds = tagsToIds(this.getTags());
}//1,2,3
private String tagsToIds(List tags) {if (!tags.isEmpty()) {StringBuffer ids = new StringBuffer();boolean flag = false;for (Tag tag : tags) {if (flag) {ids.append(",");} else {flag = true;}ids.append(tag.getId());}return ids.toString();} else {return tagIds;}
}@Override
public String toString() {return "Blog{" +"id=" + id +", title='" + title + '\'' +", content='" + content + '\'' +", firstPicture='" + firstPicture + '\'' +", flag='" + flag + '\'' +", views=" + views +", appreciation=" + appreciation +", shareStatement=" + shareStatement +", commentabled=" + commentabled +", published=" + published +", recommend=" + recommend +", createTime=" + createTime +", updateTime=" + updateTime +", type=" + type +", tags=" + tags +", user=" + user +", comments=" + comments +", tagIds='" + tagIds + '\'' +", description='" + description + '\'' +'}';
}public void initTags(Long id) {//3,4,5List tags = this.getTags();StringBuffer ids=new StringBuffer();if(!tags.isEmpty()){Boolean flag=false;for(Tag t:tags){if(flag){ids.append(t.getId());flag=true;}else {ids.append(",");ids.append(t.getId());}}this.setTagIds(ids.toString());}}

}

comment

@Entity
@Table(name = “t_comment”)
public class Comment {

@Id
@GeneratedValue
private Long id;
private String nickname;
private String email;
private String content;
private String avatar;
@Temporal(TemporalType.TIMESTAMP)
private Date createTime;@ManyToOne
private Blog blog;@OneToMany(mappedBy = "parentComment")
private List replyComments = new ArrayList<>();@ManyToOne
private Comment parentComment;public Comment() {
}public Long getId() {return id;
}public void setId(Long id) {this.id = id;
}public String getNickname() {return nickname;
}public void setNickname(String nickname) {this.nickname = nickname;
}public String getEmail() {return email;
}public void setEmail(String email) {this.email = email;
}public String getContent() {return content;
}public void setContent(String content) {this.content = content;
}public String getAvatar() {return avatar;
}public void setAvatar(String avatar) {this.avatar = avatar;
}public Date getCreateTime() {return createTime;
}public void setCreateTime(Date createTime) {this.createTime = createTime;
}public Blog getBlog() {return blog;
}public void setBlog(Blog blog) {this.blog = blog;
}public List getReplyComments() {return replyComments;
}public void setReplyComments(List replyComments) {this.replyComments = replyComments;
}public Comment getParentComment() {return parentComment;
}public void setParentComment(Comment parentComment) {this.parentComment = parentComment;
}@Override
public String toString() {return "Comment{" +"id=" + id +", nickname='" + nickname + '\'' +", email='" + email + '\'' +", content='" + content + '\'' +", avatar='" + avatar + '\'' +", createTime=" + createTime +'}';
}

}

tag

@Entity
@Table(name = “t_tag”)
public class Tag {

@Id
@GeneratedValue
private Long id;
private String name;@ManyToMany(mappedBy = "tags")
private List blogs = new ArrayList<>();public Tag() {
}public Long getId() {return id;
}public void setId(Long id) {this.id = id;
}public String getName() {return name;
}public void setName(String name) {this.name = name;
}public List getBlogs() {return blogs;
}public void setBlogs(List blogs) {this.blogs = blogs;
}@Override
public String toString() {return "Tag{" +"id=" + id +", name='" + name + '\'' +'}';
}

}

type

@Entity
@Table(name = “t_type”)
public class Type {

@Id
@GeneratedValue
private Long id;private String name;@OneToMany(mappedBy = "type")
private List blogs = new ArrayList<>();public Type() {
}public Long getId() {return id;
}public void setId(Long id) {this.id = id;
}public String getName() {return name;
}public void setName(String name) {this.name = name;
}public List getBlogs() {return blogs;
}public void setBlogs(List blogs) {this.blogs = blogs;
}@Override
public String toString() {return "Type{" +"id=" + id +", name='" + name + '\'' +'}';
}

}

User

@Entity
@Table(name = “t_user”)
public class User {

@Id
@GeneratedValue
private Long id;
private String nickname;
private String username;
private String password;
private String email;
private String avatar;
private Integer type;
@Temporal(TemporalType.TIMESTAMP)
private Date createTime;
@Temporal(TemporalType.TIMESTAMP)
private Date updateTime;@OneToMany(mappedBy = "user")
private List blogs = new ArrayList<>();public User() {
}public Long getId() {return id;
}public void setId(Long id) {this.id = id;
}public String getNickname() {return nickname;
}public void setNickname(String nickname) {this.nickname = nickname;
}public String getUsername() {return username;
}public void setUsername(String username) {this.username = username;
}public String getPassword() {return password;
}public void setPassword(String password) {this.password = password;
}public String getEmail() {return email;
}public void setEmail(String email) {this.email = email;
}public String getAvatar() {return avatar;
}public void setAvatar(String avatar) {this.avatar = avatar;
}public Integer getType() {return type;
}public void setType(Integer type) {this.type = type;
}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 List getBlogs() {return blogs;
}public void setBlogs(List blogs) {this.blogs = blogs;
}@Override
public String toString() {return "User{" +"id=" + id +", nickname='" + nickname + '\'' +", username='" + username + '\'' +", password='" + password + '\'' +", email='" + email + '\'' +", avatar='" + avatar + '\'' +", type=" + type +", createTime=" + createTime +", updateTime=" + updateTime +'}';
}

}

fragment

最新博客

用户故事(User Story) 用户故事(User Story) 用户故事(User Story)

联系我

Email:1129226393@163.com QQ:1129226393

Blog

这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...

Copyright © 2016 - 2017 liuhuali Designed by liuhuali

blog

发布 列表 分类 错误日志 开发者手册 clear
      
标题类型推荐状态更新时间操作
1刻意练习清单认知升级草稿2017-10-02 09:45编辑删除
1" >新增
提示:

恭喜,操作成功!



最新博客

用户故事(User Story) 用户故事(User Story) 用户故事(User Story)

联系我

Email:hulili@163.com QQ:hulili

Blog

这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...

Copyright © 2016 - 2017 hulili Designed by hulili

blog-imput

发布 列表 原创 原创 转载 翻译
    分类错误日志标签java



最新博客

用户故事(User Story) 用户故事(User Story) 用户故事(User Story)

联系我

Email:hulili@163.com QQ:hulili

Blog

这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...

Copyright © 2016 - 2017 hulili Designed by hulili

index

Hi,

hualili,欢迎登录!

  



最新博客

用户故事(User Story) 用户故事(User Story) 用户故事(User Story)

联系我

Email:hualili@163.com QQ:1234567

Blog

这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...

Copyright © 2016 - 2017 liuhuali Designed by liuhuali

login

管理后台登录

登 录
       111

tags

新增 列表 提示:

恭喜,操作成功!

名称操作
1刻意练习清单 编辑 删除
上一页 下一页 新增


最新博客

用户故事(User Story) 用户故事(User Story) 用户故事(User Story)

联系我

Email:liuhuali@163.com QQ:liuhuali

Blog

这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...

Copyright © 2016 - 2017 liuhuali Designed by liuhuali

tag-input

新增 列表
    









最新博客

用户故事(User Story) 用户故事(User Story) 用户故事(User Story)

联系我

Email:liuhuali@163.com QQ:liuhuali

Blog

这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...

Copyright © 2016 - 2017 liuhuali Designed by liuhuali

types

新增 列表 提示:

恭喜,操作成功!

名称操作
1刻意练习清单 编辑 删除
上一页 下一页 新增


最新博客

用户故事(User Story) 用户故事(User Story) 用户故事(User Story)

联系我

Email:liuhuali@163.com QQ:liuhuali

Blog

这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...

Copyright © 2016 - 2017 liuhuali Designed by liuhuali

type-input

新增 列表
    









最新博客

用户故事(User Story) 用户故事(User Story) 用户故事(User Story)

联系我

Email:liuhuali@163.com QQ:liuhuali

Blog

这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...

Copyright © 2016 - 2017 liuhuali Designed by liuhuali


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部