wuchimedes | e5722e3 | 2025-04-13 17:38:50 +0800 | [diff] [blame] | 1 | package com.example.g8backend.entity; |
| 2 | |
| 3 | import com.baomidou.mybatisplus.annotation.IdType; |
夜雨声烦 | f4b8b6f | 2025-04-24 00:58:36 +0800 | [diff] [blame^] | 4 | import com.baomidou.mybatisplus.annotation.TableField; |
wuchimedes | e5722e3 | 2025-04-13 17:38:50 +0800 | [diff] [blame] | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | |
| 8 | import java.sql.Timestamp; |
| 9 | import lombok.Data; |
| 10 | |
| 11 | @Data |
| 12 | @TableName("posts") |
| 13 | public class Post { |
| 14 | @TableId(type = IdType.AUTO) |
| 15 | private Long postId; |
| 16 | |
| 17 | private Long userId; |
| 18 | private String postTitle; |
| 19 | private String postContent; |
| 20 | private Timestamp createdAt; |
| 21 | private String postType; |
| 22 | |
夜雨声烦 | f4b8b6f | 2025-04-24 00:58:36 +0800 | [diff] [blame^] | 23 | @TableField("view_count") |
| 24 | private Integer viewCount = 0; |
| 25 | |
| 26 | |
wuchimedes | e5722e3 | 2025-04-13 17:38:50 +0800 | [diff] [blame] | 27 | @Override |
| 28 | public String toString() { |
| 29 | return "Post{" + |
| 30 | "postId=" + postId + |
| 31 | ", userId=" + userId + |
| 32 | ", postTitle='" + postTitle + '\'' + |
| 33 | ", postContent='" + postContent + '\'' + |
| 34 | ", createdAt=" + createdAt + |
| 35 | ", postType='" + postType + '\'' + |
夜雨声烦 | f4b8b6f | 2025-04-24 00:58:36 +0800 | [diff] [blame^] | 36 | ", viewCount=" + viewCount + // ✅ 更新 toString 方法 |
wuchimedes | e5722e3 | 2025-04-13 17:38:50 +0800 | [diff] [blame] | 37 | '}'; |
| 38 | } |
| 39 | } |