在Message和MessageDto中添加replyid字段,支持消息回复功能 添加删除所有评论的API端点 重构消息控制器方法顺序 ``` ```msg feat(文章): 实现文章浏览量增加功能 添加incrementViewCount方法用于增加文章浏览量 在文章实体中添加likes字段记录点赞数 更新API文档说明新增字段 ``` ```msg chore: 移除数据初始化类 注释掉CategoryDataInit和MessageDataInit类 这些初始化功能将由其他方式实现
129 lines
2.7 KiB
Java
129 lines
2.7 KiB
Java
package com.qf.myafterprojecy.pojo;
|
||
|
||
import javax.persistence.*;
|
||
import javax.validation.constraints.NotBlank;
|
||
import javax.validation.constraints.NotNull;
|
||
import java.time.LocalDateTime;
|
||
|
||
@Entity
|
||
@Table(name = "article")
|
||
public class Article {
|
||
@Id
|
||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||
@Column(name = "articleid")
|
||
private Integer articleid;
|
||
|
||
@NotBlank(message = "标题不能为空")
|
||
@Column(name = "title")
|
||
private String title;
|
||
|
||
@NotBlank(message = "内容不能为空")
|
||
@Column(name = "content", columnDefinition = "TEXT")
|
||
private String content;
|
||
|
||
@NotNull(message = "类别id不能为空")
|
||
@Column(name = "attribute_id")
|
||
private Integer attributeid;
|
||
|
||
@Column(name = "img")
|
||
private String img;
|
||
|
||
@Column(name = "created_at")
|
||
private LocalDateTime createdAt;
|
||
|
||
@Column(name = "updated_at")
|
||
private LocalDateTime updatedAt;
|
||
|
||
@Column(name = "view_count")
|
||
private Integer viewCount;
|
||
|
||
@Column(name = "likes")
|
||
private Integer likes; // 点赞数
|
||
@Column(name = "status")
|
||
private Integer status; // 0-草稿,1-已发布,2-已删除
|
||
|
||
// Getters and Setters
|
||
|
||
public Integer getLikes() {
|
||
return likes;
|
||
}
|
||
|
||
public void setLikes(Integer likes) {
|
||
this.likes = likes;
|
||
}
|
||
|
||
|
||
|
||
public Integer getAttributeid() {
|
||
return attributeid;
|
||
}
|
||
|
||
public void setAttributeid(Integer attributeid) {
|
||
this.attributeid = attributeid;
|
||
}
|
||
|
||
public Integer getArticleid() {
|
||
return articleid;
|
||
}
|
||
|
||
public void setArticleid(Integer articleid) {
|
||
this.articleid = articleid;
|
||
}
|
||
|
||
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 LocalDateTime getCreatedAt() {
|
||
return createdAt;
|
||
}
|
||
|
||
public void setCreatedAt(LocalDateTime createdAt) {
|
||
this.createdAt = createdAt;
|
||
}
|
||
|
||
public LocalDateTime getUpdatedAt() {
|
||
return updatedAt;
|
||
}
|
||
|
||
public void setUpdatedAt(LocalDateTime updatedAt) {
|
||
this.updatedAt = updatedAt;
|
||
}
|
||
|
||
public Integer getStatus() {
|
||
return status;
|
||
}
|
||
|
||
public void setStatus(Integer status) {
|
||
this.status = status;
|
||
}
|
||
|
||
public String getImg() {
|
||
return img;
|
||
}
|
||
|
||
public void setImg(String img) {
|
||
this.img = img;
|
||
}
|
||
|
||
public Integer getViewCount() {
|
||
return viewCount;
|
||
}
|
||
|
||
public void setViewCount(Integer viewCount) {
|
||
this.viewCount = viewCount;
|
||
}
|
||
}
|