yinshaojie 6 mēnešus atpakaļ
vecāks
revīzija
f3b279323b

+ 2
- 5
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/controller/AdminNovelController.java Parādīt failu

@@ -4,17 +4,14 @@ import com.ruoyi.common.core.controller.BaseController;
4 4
 import com.ruoyi.common.core.domain.AjaxResult;
5 5
 import com.ruoyi.common.core.page.TableDataInfo;
6 6
 import com.ruoyi.novel.domain.AuthorApplication;
7
-import com.ruoyi.novel.domain.Chapter;
8 7
 import com.ruoyi.novel.domain.Novel;
8
+import com.ruoyi.novel.domain.NovelChapter;
9 9
 import com.ruoyi.novel.service.NovelService;
10 10
 import org.springframework.beans.factory.annotation.Autowired;
11
-import org.springframework.http.HttpStatus;
12
-import org.springframework.http.ResponseEntity;
13 11
 import org.springframework.web.bind.annotation.*;
14 12
 import org.springframework.web.multipart.MultipartFile;
15 13
 
16 14
 import java.util.List;
17
-import java.util.Map;
18 15
 
19 16
 @RestController
20 17
 @RequestMapping("/admin/novel")
@@ -44,7 +41,7 @@ public class AdminNovelController extends BaseController {
44 41
                                     @RequestParam Long novelId,
45 42
                                     @RequestParam(required = false) Integer chapterOrder) {
46 43
         try {
47
-            Chapter chapter = novelService.processChapterUpload(file, novelId, chapterOrder);
44
+            NovelChapter chapter = novelService.processChapterUpload(file, novelId, chapterOrder);
48 45
             return AjaxResult.success(chapter);
49 46
         } catch (Exception e) {
50 47
             return AjaxResult.error(e.getMessage());

+ 2
- 3
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/controller/NovelController.java Parādīt failu

@@ -9,14 +9,13 @@ import com.ruoyi.common.core.page.PageDomain;
9 9
 import com.ruoyi.common.core.page.TableDataInfo;
10 10
 import com.ruoyi.common.core.page.TableSupport;
11 11
 import com.ruoyi.novel.domain.AuthorApplicationDTO;
12
-import com.ruoyi.novel.domain.Chapter;
13 12
 import com.ruoyi.novel.domain.Novel;
14 13
 import com.ruoyi.novel.domain.NovelCategory;
14
+import com.ruoyi.novel.domain.NovelChapter;
15 15
 import com.ruoyi.novel.mapper.NovelMapper;
16 16
 import com.ruoyi.novel.service.IAuthService;
17 17
 import com.ruoyi.novel.service.NovelSearchService;
18 18
 import com.ruoyi.novel.service.NovelService;
19
-import jdk.jfr.Category;
20 19
 import org.springframework.beans.factory.annotation.Autowired;
21 20
 import org.springframework.beans.factory.annotation.Qualifier;
22 21
 import org.springframework.cache.annotation.Cacheable;
@@ -116,7 +115,7 @@ public class NovelController extends BaseController {
116 115
     public AjaxResult getChapterContent(@PathVariable("chapterId") Long chapterId) {
117 116
         //return AjaxResult.success(novelService.getChapterContent(chapterId));
118 117
 
119
-        Chapter chapter = novelService.getChapterContent(chapterId);
118
+        NovelChapter chapter = novelService.getChapterContent(chapterId);
120 119
         if (chapter == null) {
121 120
             return AjaxResult.error("章节不存在");
122 121
         }

+ 0
- 33
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/domain/Chapter.java Parādīt failu

@@ -1,33 +0,0 @@
1
-package com.ruoyi.novel.domain;
2
-
3
-
4
-import com.ruoyi.novel.service.NovelService;
5
-import com.ruoyi.system.domain.SysOperLog;
6
-import lombok.Data;
7
-import org.springframework.beans.factory.annotation.Autowired;
8
-
9
-import javax.persistence.*;
10
-import java.util.Date;
11
-
12
-@Data
13
-@Entity
14
-@Table(name = "chapter")
15
-public class Chapter {
16
-
17
-    @Id
18
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
19
-    private Long id;
20
-    @Column(name = "novel_id")
21
-    private Long novelId;
22
-    private String title;
23
-    @Lob
24
-    @Column(columnDefinition = "TEXT")
25
-    private String content;
26
-    @Column(name = "chapter_order")
27
-    private Integer chapterOrder;
28
-
29
-    @Column(name = "create_time")
30
-    private Date createTime;
31
-
32
-    // Getters and setters
33
-}

+ 0
- 15
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/mapper/CategoryMapper.java Parādīt failu

@@ -1,15 +0,0 @@
1
-package com.ruoyi.novel.mapper;
2
-
3
-import com.ruoyi.novel.domain.NovelCategory;
4
-import jdk.jfr.Category;
5
-import org.apache.ibatis.annotations.Mapper;
6
-import org.apache.ibatis.annotations.Param;
7
-
8
-import java.util.List;
9
-
10
-// CategoryMapper.java
11
-@Mapper
12
-public interface CategoryMapper {
13
-    List<NovelCategory> selectCategoryList();
14
-    NovelCategory selectById(@Param("categoryId") String categoryId);
15
-}

+ 0
- 14
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/mapper/ChapterMapper.java Parādīt failu

@@ -1,14 +0,0 @@
1
-package com.ruoyi.novel.mapper;
2
-
3
-import com.ruoyi.novel.domain.Chapter;
4
-import org.apache.ibatis.annotations.Mapper;
5
-
6
-import java.util.List;
7
-@Mapper
8
-public interface ChapterMapper {
9
-    Chapter selectChapterById(Long id);
10
-    int insertChapter(Chapter chapter);
11
-    List<Chapter> selectChapterList(Chapter chapter);
12
-    Integer selectMaxChapterOrder(Long novelId);
13
-    int selectChapterCountByNovelId(Long novelId);
14
-}

+ 5
- 1
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/mapper/NovelCategoryMapper.java Parādīt failu

@@ -3,9 +3,13 @@ package com.ruoyi.novel.mapper;
3 3
 import com.ruoyi.novel.domain.NovelCategory;
4 4
 import java.util.List;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
6 7
 
7 8
 @Mapper // 确保添加 Mapper 注解
8 9
 public interface NovelCategoryMapper {
9 10
     List<NovelCategory> selectCategoryList();
10
-    NovelCategory selectById(Integer categoryId);
11
+    //NovelCategory selectById(Integer categoryId);
12
+
13
+//    List<NovelCategory> selectCategoryList();
14
+    NovelCategory selectById(@Param("categoryId") String categoryId);
11 15
 }

+ 6
- 0
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/mapper/NovelChapterMapper.java Parādīt failu

@@ -27,4 +27,10 @@ public interface NovelChapterMapper {
27 27
     Integer selectMaxChapterOrderByNovelId(Long novelId);
28 28
 
29 29
     void updateReadCount(Long id);
30
+
31
+//    NovelChapter selectChapterById(Long id);
32
+//    int insertChapter(NovelChapter chapter);
33
+    List<NovelChapter> selectChapterList(NovelChapter chapter);
34
+    Integer selectMaxChapterOrder(Long novelId);
35
+    int selectChapterCountByNovelId(Long novelId);
30 36
 }

+ 5
- 5
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/service/ChapterRepository.java Parādīt failu

@@ -1,6 +1,6 @@
1 1
 package com.ruoyi.novel.service;
2 2
 
3
-import com.ruoyi.novel.domain.Chapter;
3
+import com.ruoyi.novel.domain.NovelChapter;
4 4
 import org.apache.ibatis.annotations.Param;
5 5
 //import org.springframework.data.elasticsearch.annotations.Query;
6 6
 import org.springframework.data.jpa.repository.JpaRepository;
@@ -9,10 +9,10 @@ import org.springframework.data.jpa.repository.Query;
9 9
 import java.util.List;
10 10
 
11 11
 // ChapterRepository.java
12
-public interface ChapterRepository extends JpaRepository<Chapter, Long> {
12
+public interface ChapterRepository extends JpaRepository<NovelChapter, Long> {
13 13
 
14
-    List<Chapter> findByNovelIdOrderByChapterOrderAsc(Long novelId);
14
+    List<NovelChapter> findByNovelIdOrderByChapterOrderAsc(Long novelId);
15 15
 
16
-    @Query("SELECT MAX(c.chapterOrder) FROM Chapter c WHERE c.novelId = :novelId")
17
-    Integer findMaxChapterOrderByNovelId(@Param("novelId") Long novelId);
16
+//    @Query("SELECT MAX(c.chapterOrder) FROM NovelChapter c WHERE c.novelId = :novelId")
17
+//    Integer findMaxChapterOrderByNovelId(@Param("novelId") Long novelId);
18 18
 }

+ 1
- 1
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/service/NovelCategoryService.java Parādīt failu

@@ -8,6 +8,6 @@ import java.util.List;
8 8
 public interface NovelCategoryService {
9 9
     List<NovelCategory> list();
10 10
     List<NovelCategory> selectCategoryList();
11
-    NovelCategory getCategoryById(Integer categoryId);
11
+    NovelCategory getCategoryById(String categoryId);
12 12
     List<NovelCategory> getCategoryTree();
13 13
 }

+ 3
- 3
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/service/NovelService.java Parādīt failu

@@ -34,15 +34,15 @@ public interface NovelService {
34 34
     List<NovelCategory> getAllCategories();
35 35
     List<Novel> getHotNovels();
36 36
     NovelCategory getNovelsByCategory(Long categoryId);
37
-    List<Chapter> getChaptersByNovelId(Long novelId);
38
-    Chapter getChapterContent(Long chapterId);
37
+    List<NovelChapter> getChaptersByNovelId(Long novelId);
38
+    NovelChapter getChapterContent(Long chapterId);
39 39
     void submitAuthorApplication(AuthorApplicationDTO dto, Long userId);
40 40
 
41 41
     List<Novel> getAllNovels();
42 42
 
43 43
     Novel processNovelUpload(MultipartFile file, String title, Long authorId);
44 44
 
45
-    Chapter processChapterUpload(MultipartFile file, Long novelId, Integer chapterOrder);
45
+    NovelChapter processChapterUpload(MultipartFile file, Long novelId, Integer chapterOrder);
46 46
 
47 47
 //    void processNovelUpload(NovelUploadDTO dto);
48 48
 //

+ 1
- 1
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/service/impl/ChapterServiceImpl.java Parādīt failu

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 5
 import com.ruoyi.novel.domain.NovelChapter;
6 6
 import com.ruoyi.novel.domain.NovelContent;
7
-import com.ruoyi.novel.mapper.ChapterMapper;
7
+//import com.ruoyi.novel.mapper.ChapterMapper;
8 8
 import com.ruoyi.novel.mapper.NovelChapterMapper;
9 9
 import com.ruoyi.novel.mapper.NovelContentMapper;
10 10
 import com.ruoyi.novel.service.ChapterService;

+ 1
- 1
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/service/impl/NovelCategoryServiceImpl.java Parādīt failu

@@ -26,7 +26,7 @@ public class NovelCategoryServiceImpl implements NovelCategoryService {
26 26
     }
27 27
 
28 28
     @Override
29
-    public NovelCategory getCategoryById(Integer categoryId) {
29
+    public NovelCategory getCategoryById(String categoryId) {
30 30
         return novelCategoryMapper.selectById(categoryId);
31 31
     }
32 32
 

+ 35
- 22
RuoYi-Vue/ruoyi-system/src/main/java/com/ruoyi/novel/service/impl/NovelServiceImpl.java Parādīt failu

@@ -10,8 +10,8 @@ import com.ruoyi.common.utils.StringUtils;
10 10
 import com.ruoyi.novel.config.TableSupport;
11 11
 import com.ruoyi.novel.domain.*;
12 12
 import com.ruoyi.novel.mapper.AuthorApplicationMapper;
13
-import com.ruoyi.novel.mapper.CategoryMapper;
14
-import com.ruoyi.novel.mapper.ChapterMapper;
13
+import com.ruoyi.novel.mapper.NovelCategoryMapper;
14
+import com.ruoyi.novel.mapper.NovelChapterMapper;
15 15
 import com.ruoyi.novel.mapper.NovelMapper;
16 16
 //import com.ruoyi.novel.repository.elastic.NovelSearchRepository;
17 17
 
@@ -19,7 +19,6 @@ import com.ruoyi.novel.repository.jpa.NovelRepository;
19 19
 import com.ruoyi.novel.service.*;
20 20
 import com.ruoyi.novel.utils.Base64Utils;
21 21
 import com.ruoyi.system.mapper.SysUserMapper;
22
-import jdk.jfr.Category;
23 22
 import org.slf4j.Logger;
24 23
 import org.slf4j.LoggerFactory;
25 24
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,13 +45,13 @@ public class NovelServiceImpl implements NovelService {
46 45
     @Autowired
47 46
     private NovelMapper novelMapper;
48 47
     @Autowired
49
-    private ChapterMapper chapterMapper;
48
+    private NovelChapterMapper chapterMapper;
50 49
 
51 50
     @Autowired
52 51
     private AuthorApplicationMapper authorApplicationMapper;
53 52
 
54 53
     @Autowired
55
-    private CategoryMapper categoryMapper;
54
+    private NovelCategoryMapper categoryMapper;
56 55
 
57 56
     @Autowired
58 57
     private SysUserMapper userMapper;
@@ -114,9 +113,9 @@ public class NovelServiceImpl implements NovelService {
114 113
             novelMapper.insertNovel(novel);
115 114
 
116 115
             // 解析并保存章节
117
-            List<Chapter> chapters = parseChapters(file);
116
+            List<NovelChapter> chapters = parseChapters(file);
118 117
             for (int i = 0; i < chapters.size(); i++) {
119
-                Chapter chapter = chapters.get(i);
118
+                NovelChapter chapter = chapters.get(i);
120 119
                 chapter.setNovelId(novel.getId());
121 120
                 chapter.setChapterOrder(i + 1);
122 121
                 chapter.setCreateTime(new Date());
@@ -129,8 +128,8 @@ public class NovelServiceImpl implements NovelService {
129 128
         }
130 129
     }
131 130
 
132
-    private List<Chapter> parseChapters(MultipartFile file) throws IOException {
133
-        List<Chapter> chapters = new ArrayList<>();
131
+    private List<NovelChapter> parseChapters(MultipartFile file) throws IOException {
132
+        List<NovelChapter> chapters = new ArrayList<>();
134 133
         try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream()))) {
135 134
             StringBuilder content = new StringBuilder();
136 135
             String line;
@@ -165,15 +164,15 @@ public class NovelServiceImpl implements NovelService {
165 164
                         line.matches("第\\d+章\\s+.+"));
166 165
     }
167 166
 
168
-    private Chapter createChapter(String title, String content) {
169
-        Chapter chapter = new Chapter();
167
+    private NovelChapter createChapter(String title, String content) {
168
+        NovelChapter chapter = new NovelChapter();
170 169
         chapter.setTitle(title);
171 170
         chapter.setContent(content);
172 171
         return chapter;
173 172
     }
174 173
     @Override
175 174
     @Transactional
176
-    public Chapter processChapterUpload(MultipartFile file, Long novelId, Integer chapterOrder) {
175
+    public NovelChapter processChapterUpload(MultipartFile file, Long novelId, Integer chapterOrder) {
177 176
         try {
178 177
             // 验证小说存在
179 178
             Novel novel = novelMapper.selectNovelById(novelId);
@@ -192,7 +191,7 @@ public class NovelServiceImpl implements NovelService {
192 191
             String content = new String(file.getBytes());
193 192
 
194 193
             // 创建章节
195
-            Chapter chapter = new Chapter();
194
+            NovelChapter chapter = new NovelChapter();
196 195
             chapter.setNovelId(novelId);
197 196
             chapter.setTitle("第" + chapterOrder + "章");
198 197
             chapter.setContent(content);
@@ -279,24 +278,38 @@ public class NovelServiceImpl implements NovelService {
279 278
     }
280 279
 
281 280
     @Override
282
-    public List<Chapter> getChaptersByNovelId(Long novelId) {
283
-        Chapter chapter = new Chapter();
281
+    public List<NovelChapter> getChaptersByNovelId(Long novelId) {
282
+        NovelChapter chapter = new NovelChapter();
284 283
         chapter.setNovelId(novelId);
285 284
         return chapterMapper.selectChapterList(chapter);
286 285
     }
287 286
 
287
+//    @Override
288
+//    public Chapter getChapterContent(Long chapterId) {
289
+//        Chapter chapter = chapterMapper.selectChapterById(chapterId);
290
+//        if (chapter != null && chapter.getContent() != null) {
291
+//            // 解码Base64内容
292
+//            String decodedContent = Base64Utils.decode(chapter.getContent());
293
+//            chapter.setContent(decodedContent);
294
+//        }
295
+//        return chapter;
296
+//        //return chapterMapper.selectChapterById(chapterId);
297
+//    }
288 298
     @Override
289
-    public Chapter getChapterContent(Long chapterId) {
290
-        Chapter chapter = chapterMapper.selectChapterById(chapterId);
299
+    public NovelChapter getChapterContent(Long chapterId) {
300
+        NovelChapter chapter = chapterMapper.selectChapterById(chapterId);
291 301
         if (chapter != null && chapter.getContent() != null) {
292
-            // 解码Base64内容
293
-            String decodedContent = Base64Utils.decode(chapter.getContent());
294
-            chapter.setContent(decodedContent);
302
+            try {
303
+                // 解码Base64内容
304
+                String decodedContent = Base64Utils.decode(chapter.getContent());
305
+                chapter.setContent(decodedContent);
306
+            } catch (Exception e) {
307
+                logger.error("Base64解码失败,章节ID: " + chapterId, e);
308
+                // 如果解码失败,保持原内容不变
309
+            }
295 310
         }
296 311
         return chapter;
297
-        //return chapterMapper.selectChapterById(chapterId);
298 312
     }
299
-
300 313
     @Override
301 314
     @Transactional
302 315
     public void submitAuthorApplication(AuthorApplicationDTO dto, Long userId) {

RuoYi-Vue/ruoyi-system/src/main/resources/mapper/novel/ChapterMapper.xml → RuoYi-Vue/ruoyi-system/src/main/resources/mapper/novel/NovelCategoryMapper.xml Parādīt failu

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
-<mapper namespace="com.ruoyi.novel.mapper.CategoryMapper">
3
+<mapper namespace="com.ruoyi.novel.mapper.NovelCategoryMapper">
4 4
 
5 5
     <resultMap id="NovelCategoryResult" type="NovelCategory">
6 6
         <id property="id" column="id" />
@@ -17,12 +17,9 @@
17 17
         ORDER BY sort ASC
18 18
     </select>
19 19
 
20
-    <select id="selectById" parameterType="String" resultMap="NovelCategoryResult">
20
+    <select id="selectById" resultMap="NovelCategoryResult">
21 21
         SELECT id, title, pid, sort
22 22
         FROM novel_category
23 23
         WHERE id = #{categoryId}
24 24
     </select>
25
-    <select id="selectChapterCountByNovelId" parameterType="Long" resultType="int">
26
-        SELECT COUNT(*) FROM novel_chapter WHERE novel_id = #{novelId}
27
-    </select>
28 25
 </mapper>

+ 72
- 15
RuoYi-Vue/ruoyi-system/src/main/resources/mapper/novel/NovelChapterMapper.xml Parādīt failu

@@ -1,25 +1,82 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
-<mapper namespace="com.ruoyi.novel.mapper.NovelCategoryMapper">
3
+<mapper namespace="com.ruoyi.novel.mapper.NovelChapterMapper">
4 4
 
5
-    <resultMap id="NovelCategoryResult" type="NovelCategory">
5
+    <resultMap id="NovelChapterResult" type="NovelChapter">
6 6
         <id property="id" column="id" />
7
-        <result property="title" column="title" />
8
-        <result property="pid" column="pid" />
9
-        <result property="sort" column="sort" />
10
-        <!-- 其他字段映射 -->
7
+        <result property="novelId" column="novel_id" />
8
+        <result property="chapterTitle" column="chapter_title" />
9
+        <result property="chapterOrder" column="chapter_order" />
10
+        <result property="publishTime" column="publish_time" />
11
+        <result property="isVip" column="is_vip" />
12
+        <result property="createTime" column="create_time" />
13
+        <result property="updateTime" column="update_time" />
14
+        <result property="content" column="content" />
15
+        <result property="novelType" column="novel_type" />
16
+        <result property="updated" column="updated" />
17
+        <result property="reurl" column="reurl" />
11 18
     </resultMap>
12 19
 
13
-    <select id="selectCategoryList" resultMap="NovelCategoryResult">
14
-        SELECT id, title, pid, sort
15
-        FROM novel_category
16
-        WHERE status = 1
17
-        ORDER BY sort ASC
20
+    <sql id="selectChapterVo">
21
+        select id, novel_id, chapter_title, chapter_order, publish_time, is_vip, create_time, update_time, content, novel_type, updated, reurl
22
+        from novel_chapter
23
+    </sql>
24
+
25
+    <!-- 根据ID查询章节 -->
26
+    <select id="selectChapterById" parameterType="Long" resultMap="NovelChapterResult">
27
+        <include refid="selectChapterVo"/>
28
+        where id = #{id}
29
+    </select>
30
+
31
+    <!-- 插入章节 -->
32
+    <insert id="insertChapter" parameterType="NovelChapter" useGeneratedKeys="true" keyProperty="id">
33
+        insert into novel_chapter (
34
+            novel_id,
35
+            chapter_title,
36
+            chapter_order,
37
+            publish_time,
38
+            is_vip,
39
+            create_time,
40
+            update_time,
41
+            content,
42
+            novel_type,
43
+            updated,
44
+            reurl
45
+        ) values (
46
+                     #{novelId},
47
+                     #{chapterTitle},
48
+                     #{chapterOrder},
49
+                     #{publishTime},
50
+                     #{isVip},
51
+                     #{createTime},
52
+                     #{updateTime},
53
+                     #{content},
54
+                     #{novelType},
55
+                     #{updated},
56
+                     #{reurl}
57
+                 )
58
+    </insert>
59
+
60
+    <!-- 查询章节列表 -->
61
+    <select id="selectChapterList" parameterType="NovelChapter" resultMap="NovelChapterResult">
62
+        <include refid="selectChapterVo"/>
63
+        <where>
64
+            <if test="novelId != null"> and novel_id = #{novelId}</if>
65
+            <if test="chapterTitle != null and chapterTitle != ''"> and chapter_title like concat('%', #{chapterTitle}, '%')</if>
66
+            <if test="chapterOrder != null"> and chapter_order = #{chapterOrder}</if>
67
+            <if test="isVip != null"> and is_vip = #{isVip}</if>
68
+        </where>
69
+        order by chapter_order asc
18 70
     </select>
19 71
 
20
-    <select id="selectById" resultMap="NovelCategoryResult">
21
-        SELECT id, title, pid, sort
22
-        FROM novel_category
23
-        WHERE id = #{categoryId}
72
+    <!-- 查询小说的最大章节序号 -->
73
+    <select id="selectMaxChapterOrder" parameterType="Long" resultType="Integer">
74
+        select max(chapter_order) from novel_chapter where novel_id = #{novelId}
24 75
     </select>
76
+
77
+    <!-- 查询小说的章节数量 -->
78
+    <select id="selectChapterCountByNovelId" parameterType="Long" resultType="int">
79
+        select count(*) from novel_chapter where novel_id = #{novelId}
80
+    </select>
81
+
25 82
 </mapper>

Notiek ielāde…
Atcelt
Saglabāt