package com.ruoyi.novel.service.impl;

// ChapterServiceImpl.java
@Service
public class ChapterServiceImpl implements ChapterService {

    @Autowired
    private NovelChapterMapper chapterMapper;

    @Autowired
    private NovelContentMapper contentMapper;

    @Override
    @Transactional
    public int saveChapter(NovelChapter chapter, String content) {
        chapterMapper.insertChapter(chapter);
        NovelContent novelContent = new NovelContent();
        novelContent.setChapterId(chapter.getId());
        novelContent.setContent(content);
        return contentMapper.insertContent(novelContent);
    }
}