feat: add book admin display fields

This commit is contained in:
2026-04-27 13:53:37 +08:00
parent 67c33d06be
commit 2fa15625b0
20 changed files with 472 additions and 70 deletions

View File

@@ -11,6 +11,7 @@
- 实体模型:`book.BookComment`
- 搜索入参:`bookReq.BookCommentSearch`
- 详情响应:`bookRes.BookCommentResponse`
- 列表项:`bookRes.BookCommentListItem`
- 返回:写操作 `response.Response{msg}`;详情 `response.Response{data}`;列表 `response.PageResult`
- 删除策略:硬删
@@ -143,7 +144,9 @@
| bookComment.updatedAt | time | 更新时间 |
| bookComment.memberUserId | uint | 评论用户的会员 ID |
| bookComment.bookId | uint | 所属书籍 ID |
| bookComment.bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
| bookComment.chapterId | uint | 评论目标章节 ID`0` 表示整本书 |
| bookComment.chapterTitle | string | 章节标题展示字段,来源于 `book_chapter.title AS chapter_title`;整书评论可为空 |
| bookComment.lineIndex | int | 评论目标文本行下标,`0` 表示整章或整本书 |
| bookComment.content | string | 评论正文内容 |
| bookComment.likeCount | int64 | 评论点赞聚合值 |
@@ -172,13 +175,15 @@
| 字段 | 类型 | 说明 |
|:---|:---|:---|
| list | array | `book.BookComment` 列表 |
| list | array | `bookRes.BookCommentListItem` 列表 |
| list[].id | uint | 评论 ID |
| list[].createdAt | time | 创建时间 |
| list[].updatedAt | time | 更新时间 |
| list[].memberUserId | uint | 评论用户的会员 ID |
| list[].bookId | uint | 所属书籍 ID |
| list[].bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
| list[].chapterId | uint | 评论目标章节 ID`0` 表示整本书 |
| list[].chapterTitle | string | 章节标题展示字段,来源于 `book_chapter.title AS chapter_title`;整书评论可为空 |
| list[].lineIndex | int | 评论目标文本行下标,`0` 表示整章或整本书 |
| list[].content | string | 评论正文内容 |
| list[].likeCount | int64 | 评论点赞聚合值 |
@@ -190,6 +195,7 @@
#### 规则
- 列表默认排序:`id desc`
- 列表通过 `book_comment` 联表 `book``book_chapter` 补充 `bookTitle/chapterTitle` 展示字段;写接口仍只接收 `bookId/chapterId`
## 规则
@@ -197,3 +203,4 @@
- `lineIndex/likeCount` 不能小于 `0`
- 整书评论 `chapterId=0``lineIndex` 必须为 `0`
- 删除策略为硬删。
- `bookTitle/chapterTitle` 为只读展示字段,禁止写入实体表结构,禁止作为创建或更新入参。