| package com.example.g8backend.entity; |
| |
| import com.baomidou.mybatisplus.annotation.IdType; |
| import com.baomidou.mybatisplus.annotation.TableField; |
| import com.baomidou.mybatisplus.annotation.TableId; |
| import com.baomidou.mybatisplus.annotation.TableName; |
| |
| import java.sql.Timestamp; |
| import lombok.Data; |
| |
| @Data |
| @TableName("posts") |
| public class Post { |
| @TableId(type = IdType.AUTO) |
| private Long postId; |
| |
| private Long userId; |
| private String postTitle; |
| private String postContent; |
| private Timestamp createdAt; |
| private String postType; |
| |
| @TableField("view_count") |
| private Integer viewCount = 0; |
| |
| |
| @Override |
| public String toString() { |
| return "Post{" + |
| "postId=" + postId + |
| ", userId=" + userId + |
| ", postTitle='" + postTitle + '\'' + |
| ", postContent='" + postContent + '\'' + |
| ", createdAt=" + createdAt + |
| ", postType='" + postType + '\'' + |
| ", viewCount=" + viewCount + // ✅ 更新 toString 方法 |
| '}'; |
| } |
| } |