package com.ruoyi.web.work.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.web.work.domain.Knowledge;
import com.ruoyi.web.work.service.IKnowledgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 知识库管理
 *
 * @author lsw
 * @date 2024-07-10
 */
@RestController
@RequestMapping("/app/knowledge")
public class Api_KnowledgeController extends BaseController {
    @Autowired
    private IKnowledgeService knowledgeService;

    @GetMapping("/list")
    public TableDataInfo list(Knowledge knowledge) {
        startPage();
        List<Knowledge> list = knowledgeService.selectList(knowledge);
        return getDataTable(list);
    }

    @GetMapping(value = "/detail/{id}")
    public AjaxResult detail(@PathVariable("id") Long id) {
        return knowledgeService.detail(id);
    }

}
