package com.easyproject.web.controller.aiModel;

import java.util.List;
import javax.annotation.Resource;

import com.easyproject.common.core.domain.AjaxResult;
import com.easyproject.system.domain.dto.EditKnowledgeDto;
import com.easyproject.system.domain.dto.KnowledgeListDto;
import com.easyproject.system.service.aiModel.IKnowledgeService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.easyproject.common.core.controller.BaseController;
import com.easyproject.common.core.page.TableDataInfo;

/**
 * 方法说明: 知识库
 * @param
 * @return
 * @author java-101
 * @date 2025-03-25 23:03:03
 */
@RestController
@RequestMapping("/system/knowledge")
public class KnowledgeController extends BaseController{

    @Resource
    private IKnowledgeService knowledgeService;

    /**
     * 方法说明: 查询知识库列表
     * @param
     * @return
     * @author java-101
     * @date 2025-03-25 23:05:41
     */
    @PreAuthorize("@ss.hasPermi('system:knowledge:list')")
    @GetMapping("/list")
    public TableDataInfo list(KnowledgeListDto dto) {
        return knowledgeService.selKnowledgeList(dto);
    }

    /**
     * 方法说明: 添加知识库
     * @param
     * @return
     * @author java-101
     * @date 2025-03-30 15:14:05
     */
    @PreAuthorize("@ss.hasPermi('system:knowledge:add')")
    @PostMapping("/add")
    public AjaxResult addKnowledge(@RequestBody EditKnowledgeDto dto) {
        return knowledgeService.addKnowledge(dto);
    }

    /**
     * 方法说明: 修改知识库
     * @param
     * @return
     * @author java-101
     * @date 2025-03-30 15:14:05
     */
    @PreAuthorize("@ss.hasPermi('system:knowledge:update')")
    @PostMapping("/update")
    public AjaxResult updateKnowledge(@RequestBody EditKnowledgeDto dto) {
        return knowledgeService.updateKnowledge(dto);
    }

    /**
     * 方法说明: 删除知识库
     * @param
     * @return
     * @author java-101
     * @date 2025-03-31 19:08:30
     */
    @PreAuthorize("@ss.hasPermi('system:knowledge:delete')")
    @PostMapping("/delete")
    public AjaxResult deleteKnowledge(@RequestBody EditKnowledgeDto dto) {
        return knowledgeService.deleteKnowledge(dto);
    }

    /**
     * 方法说明: 查询知识库列表-全部
     * @param
     * @return
     * @author java-101
     * @date 2025-03-25 23:05:41
     */
    @GetMapping("/allList")
    public AjaxResult allList(EditKnowledgeDto dto) {
        return knowledgeService.selKnowledgeAllList(dto);
    }

}
