package com.ruoyi.novel.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

// NovelController.java
@RestController
@RequestMapping("/novel")
public class NovelController {

    @Autowired
    private NovelService novelService;

    @GetMapping("/list")
    public TableDataInfo list(Novel novel) {
        startPage();
        List<Novel> list = novelService.selectNovelList(novel);
        return getDataTable(list);
    }

    @PostMapping
    public AjaxResult add(@RequestBody Novel novel) {
        return toAjax(novelService.insertNovel(novel));
    }

    // 其他接口...
}