fzzj il y a 9 mois
Parent
révision
28408437b8

+ 22
- 0
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/domain/ChapterUpdateInfo.java Voir le fichier

@@ -0,0 +1,22 @@
1
+package com.ruoyi.novel.domain;
2
+
3
+import lombok.Data;
4
+
5
+import java.text.SimpleDateFormat;
6
+import java.util.Date;
7
+
8
+@Data
9
+public class ChapterUpdateInfo {
10
+    private String id;
11
+    private String title;
12
+    private Long update_time;
13
+    private Integer count;
14
+
15
+    // 获取格式化时间
16
+    public String getFormattedTime() {
17
+        if (update_time != null) {
18
+            return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(update_time * 1000));
19
+        }
20
+        return "";
21
+    }
22
+}

+ 20
- 6
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/domain/Novel.java Voir le fichier

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.novel.domain;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
5 6
 import com.baomidou.mybatisplus.annotation.TableName;
6 7
 import lombok.Data;
@@ -19,7 +20,6 @@ import java.util.Date;
19 20
 
20 21
 @Entity
21 22
 @TableName("novel")
22
-//@Document(indexName = "novels")
23 23
 @Data
24 24
 public class Novel {
25 25
     @javax.persistence.Id
@@ -31,23 +31,37 @@ public class Novel {
31 31
     private String title;
32 32
     //@Field(type = FieldType.Keyword)
33 33
     private String author;
34
-    private Long authorId;
35
-    private String cover;
34
+    @TableField("cover_img")
36 35
     private String coverImg;
37
-    //@Field(type = FieldType.Long)
36
+    @TableField("category_id")
38 37
     private Long categoryId;
39 38
     //@Field(type = FieldType.Keyword)
40 39
     private Integer status = 0; // 0: 连载中, 1: 已完结// 连载/完本
41 40
     //@Field(type = FieldType.Text, analyzer = "ik_smart")
42 41
     private String description;
42
+    @TableField("word_count")
43 43
     private Long wordCount;
44
-    //@Field(type = FieldType.Long)
44
+    @TableField("read_count")
45 45
     private Long readCount;
46
+    @TableField("create_time")
46 47
     //@Field(type = FieldType.Date)
47 48
     @Column(name = "create_time")
48 49
     private Date createTime = new Date();
50
+    @TableField("update_time")
49 51
     @Column(name = "update_time")
50 52
     private Date updateTime = new Date();
53
+    @TableField
54
+    @Column(name = "author_id")
55
+    private Long authorId;
56
+    private String cover;
57
+    private String sourceUrl; // 来源URL
58
+    // 增加虚拟字段用于前端展示
59
+    @TableField(exist = false)
60
+    private String categoryName;
61
+    @TableField(exist = false)
62
+    private String statusText;
51 63
 
52
-
64
+    public String getStatusText() {
65
+        return "0".equals(status) ? "连载中" : "已完结";
66
+    }
53 67
 }

+ 50
- 0
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/domain/NovelCategory.java Voir le fichier

@@ -0,0 +1,50 @@
1
+package com.ruoyi.novel.domain;
2
+import com.baomidou.mybatisplus.annotation.TableField;
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import lombok.Data;
7
+
8
+import java.text.SimpleDateFormat;
9
+import java.util.Date;
10
+import java.util.List;
11
+
12
+
13
+@Data
14
+@TableName("novel_category")
15
+public class NovelCategory {
16
+    @TableId(type = IdType.AUTO)
17
+    private Integer id;
18
+    private String title;
19
+    private Integer pid;
20
+    private Integer sort;
21
+    @TableField("meta_title")
22
+    private String metaTitle;
23
+    @TableField("meta_keywords")
24
+    private String metaKeywords;
25
+    @TableField("meta_description")
26
+    private String metaDescription;
27
+    private String icon;
28
+    @TableField("template_index")
29
+    private String templateIndex;
30
+    @TableField("template_detail")
31
+    private String templateDetail;
32
+    @TableField("template_filter")
33
+    private String templateFilter;
34
+    private String link;
35
+    @TableField("create_time")
36
+    private Integer createTime;
37
+    @TableField("update_time")
38
+    private Integer updateTime;
39
+    private Integer status;
40
+    private Integer type;
41
+
42
+    // 增加虚拟字段用于树形结构
43
+    @TableField(exist = false)
44
+    private List<NovelCategory> children;
45
+
46
+    // 获取格式化创建时间
47
+    public String getFormattedCreateTime() {
48
+        return new SimpleDateFormat("yyyy-MM-dd").format(new Date(createTime * 1000L));
49
+    }
50
+}

+ 28
- 3
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/domain/NovelChapter.java Voir le fichier

@@ -1,8 +1,11 @@
1 1
 package com.ruoyi.novel.domain;
2 2
 
3
+import com.alibaba.fastjson2.JSON;
3 4
 import com.baomidou.mybatisplus.annotation.IdType;
5
+import com.baomidou.mybatisplus.annotation.TableField;
4 6
 import com.baomidou.mybatisplus.annotation.TableId;
5 7
 import com.baomidou.mybatisplus.annotation.TableName;
8
+import com.ruoyi.common.utils.StringUtils;
6 9
 import lombok.Data;
7 10
 
8 11
 import java.util.Date;
@@ -13,14 +16,36 @@ import java.util.Date;
13 16
 public class NovelChapter {
14 17
     @TableId(type = IdType.AUTO)
15 18
     private Long id;
19
+    @TableField("novel_id")
16 20
     private Long novelId;
17 21
     private String title;
22
+    @TableField("chapter_title")
18 23
     private String chapterTitle;
24
+    @TableField("chapter_order")
19 25
     private Integer chapterOrder;
26
+    @TableField("publish_time")
20 27
     private Date publishTime;
28
+    @TableField("is_vip")
21 29
     private String isVip;
30
+    @TableField("create_time")
31
+    private Date createTime;
32
+    @TableField("update_time")
33
+    private Date updateTime;
34
+    private String content;
35
+    @TableField("novel_type")
36
+    private String novelType;
37
+    private String updated; // JSON格式的更新信息
38
+    private String reurl; // 来源URL
22 39
 
23
-    public Date createTime;
40
+    // 解析updated字段
41
+    @TableField(exist = false)
42
+    private ChapterUpdateInfo updateInfo;
24 43
 
25
-    public Date updateTime;
26
-}
44
+    public ChapterUpdateInfo getUpdateInfo() {
45
+        if (StringUtils.isNotBlank(updated)) {
46
+            return JSON.parseObject(updated, ChapterUpdateInfo.class);
47
+        }
48
+        return new ChapterUpdateInfo();
49
+    }
50
+
51
+}

Chargement…
Annuler
Enregistrer