DYL
2025-01-10 5ac72fbfc76d24974a620d0b0e17abd09138f43a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package com.zhitan.web.controller.knowledgeBase;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhitan.common.core.controller.BaseController;
import com.zhitan.common.core.domain.AjaxResult;
import com.zhitan.common.core.page.TableDataInfo;
import com.zhitan.knowledgeBase.domain.dto.KnowledgeBaseAddDTO;
import com.zhitan.knowledgeBase.domain.dto.KnowledgeBaseEditDTO;
import com.zhitan.knowledgeBase.domain.dto.KnowledgeBasePageDTO;
import com.zhitan.knowledgeBase.domain.vo.KnowledgeBaseDetailVO;
import com.zhitan.knowledgeBase.domain.vo.KnowledgeBasePageVO;
import com.zhitan.knowledgeBase.service.IKnowledgeBaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
/**
 * 知识库(KnowledgeBase)表控制层
 *
 * @author makejava
 * @since 2025-01-10 15:05:26
 */
@RestController
@Api(tags = "知识库管理")
@RequestMapping("/knowledgeBase")
public class KnowledgeBaseController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private IKnowledgeBaseService IKnowledgeBaseService;
 
    /**
     * 知识库-列表查询
     */
    @GetMapping("/page")
    @ApiOperation(value = "知识库-列表查询")
    public TableDataInfo page(KnowledgeBasePageDTO pageDTO) {
        Page<KnowledgeBasePageVO> responsePage = IKnowledgeBaseService.getPageList(pageDTO);
        return getDataTable(responsePage);
    }
 
    /**
     * 知识库-查询详情
     */
    @GetMapping("/detail")
    @ApiOperation(value = "知识库-查询详情")
    public AjaxResult page(@RequestParam("id") Long id) {
        KnowledgeBaseDetailVO responsePage = IKnowledgeBaseService.getDetail(id);
        return success(responsePage);
    }
 
    /**
     * 知识库-新增
     */
    @PostMapping("/add")
    @ApiOperation(value = "知识库-新增")
    public AjaxResult add(@RequestBody @Validated KnowledgeBaseAddDTO addDTO) {
        IKnowledgeBaseService.add(addDTO);
        return success();
    }
 
    /**
     * 知识库-更新
     */
    @PostMapping("/edit")
    @ApiOperation(value = "知识库-更新")
    public AjaxResult edit(@RequestBody @Validated KnowledgeBaseEditDTO editDTO) {
        IKnowledgeBaseService.edit(editDTO);
        return success();
    }
 
    /**
     * 知识库-删除
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "知识库-删除")
    public AjaxResult delete(@PathVariable("id") Long id) {
        IKnowledgeBaseService.delete(id);
        return success();
    }
}